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 22.12+(AI開発ハーネスを含む検証環境)
- 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 [email protected] --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/health公開登録は提供しません。APIの起動前に JWT_SECRET を環境から渡し、必要なschema適用と初期管理者の作成を ローカル運用手順 に従って行ってください。schema適用と実際の管理者作成は、コード生成とは別のDB操作です。
In another terminal:
pnpm dev:webOpen http://localhost:3100, then:
- run the health check
- 管理者が作成したアカウントでログインする
- create a draft request
- inspect and transition requests from the workflow panel
- Auth now uses
httpOnlycookie + CSRF token instead oflocalStorage. - 認証は8時間で期限切れになり、パスワード変更時は全セッションが失効します。ユーザー・所属・roleは管理者が管理します。
- The API implementation and its tests use
apps/api/src. The old root-level domain/application prototype has been removed after migrating its tests. - The workflow panel is intentionally a verification UI. It is not yet a polished product screen.
- RoleとApproverPolicyの責務整理は、実装済みの認可条件を保った別計画で扱う
- Replace the verification-oriented workflow UI with dedicated request screens
- Expand auth from simple current-user resolution into real authorization rules
Git submoduleを含めてcloneする場合は git clone --recurse-submodules を使う。既存のcloneでは git submodule update --init --recursive を実行する。Node.js 22.12以上、pnpm 10.6.3を使用する。
pnpm install --frozen-lockfile --ignore-scripts
pnpm db:generate
pnpm typecheck
pnpm test
pnpm build
node .harness/upstream/scripts/validate.mjs --executeinstallではライフサイクルスクリプトを実行せず、Prisma Clientは明示的に生成する。db:generate はコード生成であり、DBへのmigration適用は行わない。生成時に必要なPrisma engineが手元にない場合は取得が必要。通常の pnpm typecheck は各workspaceに加え、ルートのテストと生成済みAPI型を検査する。テストはDB接続なしで現行のAPI実装を呼ぶ。HTTP/CORS/画面の一部は既存の文字列検査が残り、実ブラウザや実DBの保証は含まない。
テストの移行対応は 申請テストの案内、全体の残課題は レビュー記録 を参照する。lintは未導入のためハーネスで理由付きskipとし、型検査やbuildがlintの代わりに全問題を検出するとは扱わない。