Skip to content

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:

  1. Add code for one capability.
  2. Run a smoke check.
  3. 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)

FeatureWhere it appears
File-based module discoveryAll modules
meta.prefix for nested resourcesBoards + Tasks
@minimajs/authAuth plugin and guards
@minimajs/cookieRefresh token cookie
@minimajs/schema + ZodBody + query validation
@minimajs/multipartAttachment uploads
Prisma integrationAll data access
hook.lifespanDB connect/disconnect
hook("request")Logging + route guards
hook("error")Centralized error behavior
abort.* helpersTyped HTTP failures
cors + shutdownProduction runtime basics
routes: Routes mapHandler 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.json

Prerequisites

  • TypeScript basics
  • REST API basics
  • Node.js 20+

No prior Minima.js experience required.

Steps

  1. Project Setup: bootstrap app + Prisma schema
  2. Database & Root Module: lifespan hook + global plugins
  3. Authentication: access/refresh flow + guards
  4. Workspaces: first protected resource CRUD
  5. Boards & Tasks: nested routes + uploads + pagination
  6. Members & Roles: role-based authorization
  7. Error Handling & Polish: uniform error shape + operational polish
  • Keep one terminal running npm run dev.
  • Keep one terminal for curl checks.
  • 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