ποΈ Migrate Todos to PostgreSQL Database Storage
π Overview
Currently, todo items are stored in memory using the mock-todos.ts utilities. Update the backend so that all todo operations persist data in a PostgreSQL database instead of memory, making todos available across restarts and multiple users (no authentication needed).
Replace all existing usages of the mock data functions (getTodos, getTodoById, createTodo, updateTodo, toggleTodo, deleteTodo) with equivalent logic that reads/writes to Postgres via a Node.js database client of your choice (e.g., pg, Prisma, etc.).
Note: Authentication is NOT in scope. You may pick any PostgreSQL client/tooling.
π― Acceptance Criteria
π§ Technical Requirements
- Use PostgreSQL 17+ (local install or Docker)
- Use a Node.js database client that supports Postgres (your choice), e.g.:
- All existing API routes should preserve their current response format and validation logic
- Error handling must be retained for non-existent IDs and unexpected failures
π« Out of Scope
- Authentication/authorization (all API endpoints remain public)
- User-specific todo lists or multi-user support
- Cloud database hosting or deployment
- Schema migrations beyond the minimum required for todos
π Resources
π‘ Tips
- Use async/await for DB operations
- Add seed data if desired, but not required
- Document your SQL schema & migration steps in a README or a migration file
ποΈ Migrate Todos to PostgreSQL Database Storage
π Overview
Currently, todo items are stored in memory using the
mock-todos.tsutilities. Update the backend so that all todo operations persist data in a PostgreSQL database instead of memory, making todos available across restarts and multiple users (no authentication needed).Replace all existing usages of the mock data functions (
getTodos,getTodoById,createTodo,updateTodo,toggleTodo,deleteTodo) with equivalent logic that reads/writes to Postgres via a Node.js database client of your choice (e.g.,pg, Prisma, etc.).Note: Authentication is NOT in scope. You may pick any PostgreSQL client/tooling.
π― Acceptance Criteria
app/api/todos/and subroutes persist/read todos in a PostgreSQL database (not memory)id(primary key),text(string),completed(boolean),createdAt, andupdatedAtGET /api/todos)POST /api/todos)GET /api/todos/[id])PUT /api/todos/[id])DELETE /api/todos/[id])PATCH /api/todos/[id]/toggle)π§ Technical Requirements
pg(postgres)π« Out of Scope
π Resources
π‘ Tips