⚙️ Backend & API — Next.js scaffold + CRUD route handlers #4

Open
opened 2026-09-28 07:55:48 +00:00 by SemianiakaVY · 0 comments
Owner

Goal — scaffold Next.js on the existing brief-only repository and expose the task CRUD over HTTP.

Owner — Code Expert (w4c-code).

Deliverables

  • Next.js (App Router, TypeScript) scaffold on top of this repository — the template ships a brief, not code, so nothing has to be "deleted"; simply build nothing from the e-commerce scope (no catalog, cart, checkout, orders, admin).
  • Route handlers: GET /api/todos (open first, newest first), POST /api/todos ({title} → 201), PATCH /api/todos/:id ({title?, done?}), DELETE /api/todos/:id (204), GET /api/health.
  • Server-side validation (trim, 1…200 chars) and the error envelope { "error": string }; prepared statements only; 404 on a missing task.
  • Dev server lifecycle from the project's dev-server settings (image node:22-bookworm-slim, install corepack pnpm install, serve corepack pnpm dev --host 0.0.0.0 --port {port}, port 9000) — do not invent other commands.

Acceptance (runtime)

  • POST /api/todos with {"title":"buy milk"} → 201; GET /api/todos returns it; PATCH {"done":true} → 200 with done: true; DELETE → 204.
  • Restart the dev server, GET /api/todos → the task is still there (persistence proof).
  • POST with {"title":" "} → 400 with an error message.

Ref — docs/PLAN.md §3–§4, SPEC.md §3–§6; skills stack-nextjs, stack-nextjs-quality.

**Goal** — scaffold Next.js on the existing brief-only repository and expose the task CRUD over HTTP. **Owner** — Code Expert (`w4c-code`). **Deliverables** - Next.js (App Router, TypeScript) scaffold on top of this repository — the template ships a brief, not code, so nothing has to be "deleted"; simply build nothing from the e-commerce scope (no catalog, cart, checkout, orders, admin). - Route handlers: `GET /api/todos` (open first, newest first), `POST /api/todos` (`{title}` → 201), `PATCH /api/todos/:id` (`{title?, done?}`), `DELETE /api/todos/:id` (204), `GET /api/health`. - Server-side validation (trim, 1…200 chars) and the error envelope `{ "error": string }`; prepared statements only; 404 on a missing task. - Dev server lifecycle from the project's dev-server settings (image `node:22-bookworm-slim`, install `corepack pnpm install`, serve `corepack pnpm dev --host 0.0.0.0 --port {port}`, port 9000) — do not invent other commands. **Acceptance (runtime)** - `POST /api/todos` with `{"title":"buy milk"}` → 201; `GET /api/todos` returns it; `PATCH` `{"done":true}` → 200 with `done: true`; `DELETE` → 204. - Restart the dev server, `GET /api/todos` → the task is still there (persistence proof). - `POST` with `{"title":" "}` → 400 with an `error` message. **Ref** — `docs/PLAN.md` §3–§4, `SPEC.md` §3–§6; skills `stack-nextjs`, `stack-nextjs-quality`.
SemianiakaVY added the
High Priority
label 2026-09-28 07:55:49 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: SemianiakaVY/todo-list#4
No description provided.