Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
5.5 KiB
id, title, kind, expected_rounds
| id | title | kind | expected_rounds |
|---|---|---|---|
| nestng-crm | Simple NestJS + Angular CRM | create | 30-70 |
Simple NestJS + Angular CRM
Task for the vanilla Strata vs Leleka comparison with the real Codex CLI (written 2026-11-05). Single phase, two projects in one workspace.
The seed is two freshly scaffolded projects (a Nest module with no controllers, an Angular 20 standalone app with an empty router) with exact-pinned
package.json and package-lock.json files; node_modules is NOT part of the seed: the runner installs both trees once from the lockfiles (NOTES.md)
and hard-links them into every workspace, because the agent has no network. Node.js 22 must be on the PATH of the Codex shell. No browser, no Karma.
Acceptance (accept.py, 56 checks, 20-120 s): black-box REST checks over HTTP against node dist/main.js, the agent's own jest tests (>= 15 cases),
the production ng build, static checks of the Angular sources. A browser check of the UI is NOT part of the acceptance (the server has no browser).
Prompt
Build a small CRM web application in the current directory. It has two parts that are already scaffolded here: a NestJS REST API in backend/ and an Angular single-page app in frontend/. Both already have their package.json, tsconfig files and installed dependencies (backend/node_modules, frontend/node_modules). There is NO network and NO browser: you cannot install packages, so do not change the dependencies and use only what is installed (NestJS 11: @nestjs/common, core, platform-express, testing; class-validator, class-transformer; jest, ts-jest, supertest; Angular 20: common, core, forms, router, platform-browser with the esbuild application builder). Node.js 22 and npm are on the PATH.
Backend (backend/, TypeScript, NestJS, in-memory storage, no database):
- Fixed commands:
npm run buildcompiles todist/;node dist/main.jsstarts the server on the port in the environment variable PORT (default 3000), bound to 127.0.0.1. Every route is under the/apiprefix and speaks JSON. - Resources and fields: companies {id, name (required), website, industry}; contacts {id, name (required), email, phone, companyId}; deals {id, title (required), amount, stage, companyId, contactId}. Optional fields that were not given are returned as null. A deal's amount is a number >= 0 (default 0); its stage is exactly one of lead, qualified, proposal, won, lost (default lead). companyId and contactId are optional integers or null.
- For each of /api/companies, /api/contacts, /api/deals: GET lists all records (a JSON array); POST creates a record and answers 201 with it, including an integer id (1, 2, 3, ..., never reused); GET /api//:id returns one record; PUT /api//:id updates the fields that are present in the body and answers 200 with the updated record (null clears companyId or contactId); DELETE /api//:id answers 204. An unknown id gives 404 for GET, PUT and DELETE.
- Validation, answered with 400 on POST and on PUT for the fields given: name or title missing, empty or not a string; amount not a number or negative; stage not one of the five values; email that is not a valid email address; companyId or contactId that is not an integer or that refers to a record that does not exist.
- Search: GET /api/companies?q=text filters by name; GET /api/contacts?q=text by name or email; GET /api/deals?q=text by title. All are case-insensitive substring matches. GET /api/deals?stage=won filters by stage and combines with q; an invalid stage in the query is 400.
- GET /api/pipeline returns {"lead": {"count": n, "amount": total}, "qualified": {...}, "proposal": {...}, "won": {...}, "lost": {...}}, all five stages always present, summing the deals of each stage.
- Deleting a company must not delete anything else: it sets companyId to null on its contacts and deals. Deleting a contact sets contactId to null on its deals.
- Tests:
npm testruns jest unit tests (src/**/.spec.ts) andnpm run test:e2eruns end-to-end tests with supertest (test/.e2e-spec.ts; the config is already there). Both must run offline and pass, and together they must cover every endpoint and the validation rules.
Frontend (frontend/, Angular 20, standalone components, TypeScript strict mode as scaffolded):
npm run build(the production build) must succeed without errors. There are no frontend tests.frontend/proxy.conf.jsonproxies/apito http://127.0.0.1:3000 andnpm start(ng serve) uses it.- Use the Angular Router with the routes /companies, /contacts and /deals (the empty path redirects to /deals) and a navigation bar linking to them. The app talks to the API with HttpClient at /api/....
- Each of the companies, contacts and deals pages lists its records, has a search box that filters the list through the ?q= parameter, a form to create a record, a way to edit a record and a delete button. Contact and deal forms let the user pick the company (and the deal form the contact) from the existing records.
- The deals page is a board with one column per stage (lead, qualified, proposal, won, lost) showing the deals of that stage, and each deal can be moved to another stage from the board (a select or buttons that send a PUT).
Work step by step. Verify your work before finishing: run both test commands, start the server and exercise it with curl or a small Node script, and run npm run build in both projects. Write a short README.md at the top level that says how to run everything. When all of this works, reply with a short summary of what you built and how you verified it.