A full-featured Trello-like Kanban board application built with Next.js 16. Organize projects with boards, lists, and cards in organization-based workspaces.
- Organization Workspaces - Multi-tenant support with Clerk authentication and organization switching
- Kanban Boards - Create and manage boards with custom Unsplash backgrounds
- Lists and Cards - Full CRUD with drag-and-drop reordering
- Pro Subscriptions - Stripe-powered billing with free tier limits (5 boards) and unlimited pro tier
- Activity Tracking - Audit logging for all board, list, and card operations
- Responsive Design - Works across desktop and mobile
| Category | Tools |
|---|---|
| Framework | Next.js 16 (App Router, Turbopack), TypeScript |
| Database | PostgreSQL, Prisma ORM |
| Authentication | Clerk (with organization support) |
| Payments | Stripe (subscriptions, webhooks) |
| UI | Tailwind CSS, shadcn/ui, Lucide React, next-themes |
| State | Zustand (client), TanStack Query (server) |
| Drag and Drop | @hello-pangea/dnd |
| Validation | Zod |
| Images | Unsplash API |
cardigan/
├── app/
│ ├── (marketing)/ # Public landing pages
│ ├── (platform)/ # Authenticated application
│ │ ├── (clerk)/ # Sign-in/sign-up flows
│ │ └── (dashboard)/ # Main application
│ │ ├── organization/ # Org settings, billing, activity
│ │ └── board/ # Board view with lists and cards
│ └── api/webhook/ # Stripe webhook endpoint
├── actions/ # Server actions (schema + handler + types)
├── components/
│ ├── ui/ # Design system (Radix-based)
│ ├── form/ # Validated form inputs
│ └── modal/ # Modal dialogs
├── hooks/ # Custom React hooks
├── lib/ # Utilities and configurations
├── constants/ # App constants (board limits, etc.)
└── prisma/ # Database schema
- Node.js 20.9+
- PostgreSQL database
- Clerk account
- Stripe account only when billing is enabled
- Unsplash API key (optional, for board backgrounds)
-
Clone and install:
git clone <repository-url> cd cardigan npm install
-
Create
.env.local:# Private deployment (set before building; rebuild to change) PRIVATE_MODE=true # Database DATABASE_URL="postgresql://username:password@localhost:5432/cardigan" DIRECT_URL="postgresql://username:password@localhost:5432/cardigan" # Clerk NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_... CLERK_SECRET_KEY=sk_... NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/ NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/ # Stripe (omit both keys in private mode) STRIPE_API_KEY=sk_... STRIPE_WEBHOOK_SECRET=whsec_... NEXT_PUBLIC_APP_URL=http://localhost:3000 # Unsplash (optional) NEXT_PUBLIC_UNSPLASH_ACCESS_KEY=...
-
Set up the database:
npm run schema:generate npm run schema:deploy
-
Start the dev server:
npm run dev
Open http://localhost:3000.
| Command | Description |
|---|---|
npm run dev |
Start dev server (Turbopack) |
npm run build |
Production build |
npm run start |
Start production server |
npm run lint |
Run ESLint |
npm run typecheck |
Type-check with tsc |
npm test |
Unit + integration tests (Vitest) |
npm run test:unit |
Unit tests only (no database) |
npm run test:integration |
Integration tests (needs TEST_DATABASE_URL) |
npm run test:e2e |
End-to-end journeys (see e2e/README.md) |
npm run schema:generate |
Generate Prisma client |
npm run schema:deploy |
Apply committed migrations |
npm run schema:reset |
Reset database |
npm run schema:studio |
Open Prisma Studio |
npm run lint enforces a 1,000-line code file cap, excluding bundled image data.
-
Unit tests (
tests/unit) need nothing and run in parallel. -
Integration tests (
tests/integration) run against a real, disposable Postgres database. SetTEST_DATABASE_URL; its database name must containtest, because the schema is force-reset at the start of each run. Every test starts from empty tables. Clerk'sauth()is mocked (tests/setup/mock-clerk.ts). Without the variable these tests are skipped.createdb cardigan_test TEST_DATABASE_URL=postgresql://postgres@localhost:5432/cardigan_test npm test -
End-to-end journeys (
e2e/) use the open-sourcee2eframework. Seee2e/README.md.
CI (.github/workflows/ci.yml) runs typecheck, lint and npm test against a
Postgres service on every pull request.
get_card, list_cards and search_cards include priority, assignee,
blockedByIds and blockedBy ({ id, title } entries). Existing calls remain
compatible. update_card accepts any of these optional edits along with
cardId and the version returned by the last read:
{ "cardId": "card-id", "version": 1, "priority": "high", "assignee": "Review agent", "blockedByIds": ["blocking-card-id"] }Priority is ordered none < low < medium < high and defaults to none; it does
not reorder the board. Assignee is trimmed free text, at most 80 characters;
"" clears it. It grants no permissions and is separate from future claims
(ADR 0008). Omitted fields stay as
they are. blockedByIds replaces all blockers (at most 50 per update); [] clears them. Blockers may
belong to another board in the same workspace. Missing/foreign ids return
not_found; self-links and cycles return invalid. Deleting a card removes
its incoming and outgoing dependency links. All edits bump the card version
and write an attributed activity/changes event in the same transaction; stale
versions return stale_version with the current card and last actor. Re-read
and compare intent before resubmitting. Agents need the update capability;
boards have no list workflow rules (ADR 0006).
All mutations follow a consistent pattern in /actions/[entity]/:
schema.ts- Zod validation schemaindex.ts- Handler with auth checks, limit enforcement, and audit loggingtypes.ts- TypeScript types
Client-side usage goes through the useAction hook which provides loading state and onSuccess/onError callbacks.
Organizations -> Boards -> Lists -> Cards
OrgLimittracks free tier board count per organization (max 5)OrgSubscriptionstores Stripe subscription stateAuditLogrecords all CRUD operations with user context- Cascade deletes maintain referential integrity
Clerk handles auth with proxy.ts (Next.js 16 convention, replaces middleware.ts) enforcing protected routes. All data access is scoped to the current organization.
For the private deployment, follow the private hosting runbook. Keep Clerk sign-in and workspaces enabled. PRIVATE_MODE=true disables billing and board limits; Stripe keys are unnecessary. Unsplash is optional in all modes, with bundled backgrounds used when unavailable. Billing code remains available when private mode is off.
Private and proprietary.