MiniFlow is a prototype approval workflow system designed to explore SaaS-style backend architecture.
The project focuses on building a small but structured workflow application using a modern TypeScript monorepo architecture.
It is also used as an experiment for AI-assisted development using tools such as Codex and Claude Code.
MiniFlow follows a simple monorepo architecture.
apps/web
Next.js frontendapps/api
Fastify backend APIpackages/shared
Shared TypeScript typesdocs
Architecture and domain documentation
The backend is structured with domain / application / infrastructure layers so the system can grow into a larger workflow platform.
The current milestone now covers:
- local startup for
web + api + db - cookie-based authentication with CSRF protection
- request draft creation, update, submit, approve, reject, revise, delete
- request list/detail retrieval, including approval history on detail
apps/web: Next.js frontendapps/api: Fastify APIpackages/shared: shared TypeScript typesdocs: product, architecture, API, and domain notes
This is intentionally simplified. The domain/application/infrastructure/presentation split is only lightly populated in apps/api so the project can grow into it instead of retrofitting it later.
miniflow/
apps/
api/
web/
packages/
shared/
docs/
docker-compose.yml
package.json
pnpm-workspace.yaml
- Node.js 20+
- Corepack enabled (
corepack enable) - Docker Desktop
Create local env files from the examples.
cp apps/api/.env.example apps/api/.env
cp apps/web/.env.example apps/web/.env.localThe defaults already point to the local PostgreSQL container and local API.
For local auth development, set a non-empty JWT_SECRET in apps/api/.env.
corepack prepare pnpm@10.6.3 --activate
pnpm installdocker compose up -dThe container starts PostgreSQL on localhost:5432 with:
- user:
miniflow - password:
miniflow - database:
miniflow
Create or update the local schema before starting the API.
corepack pnpm --filter @miniflow/api exec prisma migrate devpnpm dev:apiExpected health response:
{
"status": "ok",
"service": "api",
"db": "connected"
}Manual check:
curl http://localhost:3001/healthRegister and login check:
curl -X POST http://localhost:3001/auth/register \
-H 'content-type: application/json' \
-d '{"email":"demo@example.com","password":"password1234"}'curl -i -X POST http://localhost:3001/auth/login \
-H 'content-type: application/json' \
-d '{"email":"demo@example.com","password":"password1234"}'In another terminal:
pnpm dev:webOpen http://localhost:3100, then:
- run the health check
- login or register from the auth panel
- create a draft request
- inspect and transition requests from the workflow panel
- Auth now uses
httpOnlycookie + CSRF token instead oflocalStorage. - This is still a minimal auth slice. It does not yet implement roles, team membership, or
ApproverPolicy. - Existing root-level prototype code is kept for reference. The runtime path for new API work now lives under
apps/api/src/domain. - The workflow panel is intentionally a verification UI. It is not yet a polished product screen.
- Introduce
ApproverPolicyafter actor resolution is stable - Replace the verification-oriented workflow UI with dedicated request screens
- Expand auth from simple current-user resolution into real authorization rules