Architecture Overview
Taskforge is a self-hosted workflow automation system built as a monorepo.
System Components
Taskforge
|- CLI/TUI (Go)
| \- Calls Taskforge HTTP API
|- Server (NestJS + Fastify)
| |- Auth, workflows, triggers, runs, steps, secrets
| \- Enqueues step-run jobs
|- Worker (NestJS + BullMQ)
| \- Consumes jobs and executes workflow steps
|- PostgreSQL
| \- Durable state for all entities and run history
\- Redis
\- Queue backend for step-run execution
Monorepo Structure
Apps
apps/server: API serverapps/worker: queue consumer and step execution engineapps/cli: CLI + TUI interface
Packages
packages/contracts: shared schemas/contractspackages/db-access: Prisma service and repositoriespackages/queue: queue configuration package (@taskforge/queue-config)
API Shape
- Global API prefix:
/v{VERSION}/api - Default local base URL:
http://localhost:3000/v1/api - Swagger UI:
http://localhost:3000/api
Execution Flow
Workflow Creation
- Create workflow
- Create workflow version (definition snapshot)
- Create trigger(s)
Workflow Run
- Trigger is invoked (manual/webhook/cron)
- Event is stored
- Workflow run is created (
QUEUED) - Step runs are created (
QUEUED) - Step runs are enqueued to Redis (
step-runsqueue) - Worker executes each step
- Step runs transition to terminal state
- Workflow run resolves to final status
Webhook ingress supports a public path-key route for WEBHOOK triggers:
POST /v1/api/hooks/:workflowId/:triggerId/:webhookKey
Webhook keys are trigger-scoped and rotated by operators via CLI/API.
Current MVP Execution Types
Worker executors currently include:
httptransformcondition
Build and Dependency Order
When contracts or Prisma types change, build in this order:
pnpm -C apps/server prisma:generatepnpm -C packages/db-access buildpnpm -C packages/queue buildpnpm -C packages/contracts buildpnpm -C apps/server buildpnpm -C apps/worker build
Runtime Requirements
Taskforge server/worker can run with either:
- external managed Postgres + Redis services, or
- bundled local Postgres + Redis containers (CLI opt-in).
Required server env vars:
DATABASE_URLREDIS_URLTASKFORGE_ADMIN_TOKENTASKFORGE_SECRET_KEY
Optional:
PORT(default3000)VERSION(default1)CACHE_TTL_SECONDSCACHE_REDIS_PREFIX
Related Documentation
- Getting started:
docs/Getting-Started.md - CLI usage:
docs/CLI-Usage.md - Development setup:
docs/Development.md - CLI commands:
apps/cli/README.md - TUI usage and internals:
docs/Taskforge - TUI.md