Tutorial: Build a Task Board API
Build a production-style Task Board API (Trello/Linear-style backend) from zero to deployment-ready structure using Minima.js.
By the end, you will have:
- JWT auth (access + refresh)
- Multi-workspace access control
- Nested boards/tasks routes
- File uploads for task attachments
- Consistent API error format
- OpenAPI docs and graceful shutdown
Why This Tutorial Is Structured This Way
This tutorial follows a strict copy → run → verify loop:
- Add code for one capability.
- Run a smoke check.
- Move to the next capability.
Each step has a clear outcome so you always know what “done” means before continuing.
What You’ll Learn (Framework Coverage)
| Feature | Where it appears |
|---|---|
| File-based module discovery | All modules |
meta.prefix for nested resources | Boards + Tasks |
@minimajs/auth | Auth plugin and guards |
@minimajs/cookie | Refresh token cookie |
@minimajs/schema + Zod | Body + query validation |
@minimajs/multipart | Attachment uploads |
| Prisma integration | All data access |
hook.lifespan | DB connect/disconnect |
hook("request") | Logging + route guards |
hook("error") | Centralized error behavior |
abort.* helpers | Typed HTTP failures |
cors + shutdown | Production runtime basics |
routes: Routes map | Handler wiring per module |
Final Project Structure
text
task-board/
├── src/
│ ├── index.ts # Entry + error serializers
│ ├── module.ts # Global plugins
│ ├── database.ts # Prisma + lifespan hook
│ ├── auth/
│ │ ├── index.ts # createAuth + token helpers
│ │ ├── guards.ts # authenticated/workspaceMember/boardMember/workspaceAdmin
│ │ └── module.ts # /auth routes
│ ├── workspaces/
│ │ └── module.ts
│ ├── boards/
│ │ └── module.ts
│ ├── tasks/
│ │ └── module.ts
│ └── members/
│ └── module.ts
├── prisma/
│ └── schema.prisma
└── package.jsonPrerequisites
- TypeScript basics
- REST API basics
- Node.js 20+
No prior Minima.js experience required.
Steps
- Project Setup: bootstrap app + Prisma schema
- Database & Root Module: lifespan hook + global plugins
- Authentication: access/refresh flow + guards
- Workspaces: first protected resource CRUD
- Boards & Tasks: nested routes + uploads + pagination
- Members & Roles: role-based authorization
- Error Handling & Polish: uniform error shape + operational polish
Working Method (Recommended)
- Keep one terminal running
npm run dev. - Keep one terminal for
curlchecks. - After each step, run the step’s smoke test before continuing.
Need To Present Minima.js?
Use the companion guide: Tutorial Presentation Playbook
Start here: Project Setup