NEVER edit task files directly. Always use backlog CLI commands.
# View/Search (use --plain for AI-readable output)
backlog task <id> --plain # View task details
backlog task list --plain # List all tasks
backlog search "keyword" --plain # Search tasks
# Task Lifecycle
backlog task create "Title" -d "Description" --ac "Criterion"
backlog task edit <id> -s "In Progress" -a @myself # Start work
backlog task edit <id> --plan $'1. Step\n2. Step' # Add plan
backlog task edit <id> --check-ac 1 # Mark AC complete
backlog task edit <id> --notes "Done X, Y, Z" # Add PR description
backlog task edit <id> -s Done # Mark complete
# Multi-line input requires ANSI-C quoting: $'line1\nline2'- Start:
backlog task edit <id> -s "In Progress" -a @myself - Plan: Add implementation plan with
--plan - Implement: Check ACs progressively with
--check-ac <index> - Notes: Add PR-ready description with
--notesor--append-notes - Complete:
backlog task edit <id> -s Done
- Must be outcome-oriented and testable (not implementation steps)
- Good: "User can login with valid credentials"
- Bad: "Add handleLogin() function in auth.ts"
- Use multiple
--check-acflags:--check-ac 1 --check-ac 2 --check-ac 3
| Action | Command |
|---|---|
| Add AC | --ac "Criterion" (multiple flags allowed) |
| Check AC | --check-ac <index> (multiple flags allowed) |
| Remove AC | --remove-ac <index> |
| Edit title | -t "New Title" |
| Edit description | -d "Description" |
| Change status | -s "Status" |
| Assign | -a @user |
| Add labels | -l label1,label2 |
Frontend (React + TanStack Router) ↔ tRPC ↔ Backend (Fastify) ↔ SQLite (Drizzle) ↔ Cosmian KMS
Backend:
- Fastify 5.2 (HTTP server)
- tRPC 11.0 (type-safe RPC)
- Drizzle ORM 0.36 (SQLite)
- Zod 3.24 (validation)
- Vitest 2.1 (testing)
Frontend:
- React 19.1
- TanStack Router 1.133 (file-based routing)
- TanStack Query 5.90 (data fetching)
- Tailwind CSS 4.1
- Vite 6.0
pki-manager/
├── backend/src/
│ ├── server.ts # Fastify server entry
│ ├── trpc/
│ │ ├── router.ts # Main API router
│ │ ├── schemas.ts # Zod validation schemas
│ │ └── procedures/ # API endpoints by domain
│ │ ├── ca.ts
│ │ ├── certificate.ts
│ │ └── crl.ts
│ └── db/
│ └── schema.ts # Drizzle ORM schema
├── frontend/src/
│ ├── main.tsx # App entry
│ ├── routes/ # File-based routing
│ │ ├── __root.tsx # Layout + nav
│ │ ├── index.tsx # Dashboard (/)
│ │ ├── cas.tsx # /cas
│ │ └── certificates.tsx # /certificates
│ └── lib/
│ └── trpc.ts # tRPC client config
└── backlog/
├── tasks/ # Active tasks
└── docs/ # Documentation
Add API Endpoint:
- Define schema in
backend/src/trpc/schemas.ts - Add procedure in
backend/src/trpc/procedures/*.ts - Use in frontend:
trpc.resource.method.useQuery/useMutation()
Add Frontend Route:
- Create
frontend/src/routes/filename.tsx→/filename - Use
filename.$id.tsxfor dynamic routes →/filename/:id
Database Changes:
# Edit backend/src/db/schema.ts, then:
cd backend && pnpm db:generate && pnpm db:migrate# Terminal 1: Backend
cd backend && pnpm dev # http://localhost:3000
# Terminal 2: Frontend
cd frontend && npm run dev # http://localhost:5173
# Testing
cd backend && pnpm test
# Database GUI
cd backend && pnpm db:studio # http://localhost:4983Backend:
- server.ts - Fastify server
- router.ts - tRPC router
- schemas.ts - Zod schemas
- schema.ts - DB schema
Frontend:
- main.tsx - Entry point
- trpc.ts - tRPC client
- __root.tsx - Navigation
| Issue | Solution |
|---|---|
| tRPC type errors | Run pnpm dev in backend |
| Frontend can't connect | Check VITE_API_URL |
| Database locked | Close Drizzle Studio |
| Port in use | lsof -ti:3000 | xargs kill |
- Type Safety: Use Zod for all input validation
- State: tRPC cache for server state, useState for local
- Errors: Try-catch async ops, user-friendly messages
- Performance: Use React Query caching, pagination for lists
- Testing: Write tests in
*.test.tsfiles - File References: Use markdown links
[file.ts](path/file.ts)or[file.ts:42](path/file.ts#L42)
Types: server, client, email, code_signing
Subject Fields (Required):
- CN (Common Name)
- O (Organization)
- C (Country - 2 letters)
Optional: OU, ST, L
SANs: DNS names, IP addresses, Email addresses