Local Development
Clone Anvio, install dependencies, and run it from source with or without Docker.
4 min read
Anvio is a pnpm + Turborepo monorepo. You can build and run the entire platform — CLI, agent runtime, tool gateway — from a laptop with no database and no Docker. Docker only becomes relevant if you want the optional Level 3 stack (PostgreSQL, Redis, NATS, Qdrant) or the background worker/API/gateway apps running as separate services.
Prerequisites
Node.js 20+ and pnpm 9+ (packageManager: pnpm@9.15.9 is pinned in package.json). Docker and PostgreSQL are optional — only needed for Level 3+.
Setup
Clone the repository
git clone https://github.com/viantonugroho11/Anvio.git
cd AnvioInstall dependencies
pnpm installThis installs dependencies for every workspace package under apps/ and packages/ in one pass via pnpm workspaces.
Build
pnpm buildRuns turbo run build across the monorepo, respecting the apps → platform → packages → core dependency graph so packages build before the apps that depend on them.
Run Level 1 — no Docker, no database
pnpm anvio chatpnpm anvio invokes node apps/cli/dist/main.js (the built CLI). Without a model API key set, Anvio runs in mock mode — it echoes your message back so you can validate the wiring end to end. Set ANTHROPIC_API_KEY (or DEEPSEEK_API_KEY, OPENROUTER_API_KEY, etc.) in your shell for real completions.
For rapid iteration without rebuilding, use the tsx-backed dev entrypoint instead:
pnpm cli --helppnpm cli runs tsx apps/cli/src/main.ts directly from TypeScript source, skipping the dist/ build step.
At this point you have a fully working Anvio: filesystem sessions under workspace/sessions/, JSON memory under workspace/memory/, no auth, no external services. This is enough to develop and test the CLI, agent runtime, tool gateway, and most packages.
Optional — Level 3 with Docker Compose
Level 3 adds PostgreSQL, Redis, NATS JetStream, and (optionally) Qdrant, and lets you run the API, worker, and gateway apps against real services instead of in-process defaults.
Copy the environment template
cp .env.example .envFill in a model API key and any Level 2+ variables you need (API_PORT, GATEWAY_PORT, ANVIO_CREDENTIALS_PASSPHRASE, etc.). See .env.example for the full annotated list.
Start the dev service stack
docker compose -f docker/docker-compose.dev.yml up -dThis starts postgres (16-alpine), redis (7-alpine), and nats (2.10-alpine, JetStream enabled) with health checks. qdrant is included behind a full Compose profile — add --profile full if you need semantic memory locally.
Migrate and seed the database
pnpm db:migrate
pnpm db:seedBoth scripts delegate to the @anvio/db package (pnpm --filter @anvio/db db:migrate / db:seed). Use pnpm db:generate after changing a Drizzle schema to regenerate migrations.
Run the full dev stack
pnpm devRuns turbo run dev --parallel, starting every app (cli, api, worker, gateway) concurrently in watch mode.
Docker is still optional at this point
Level 3 is for exercising PostgreSQL/Redis/NATS-backed code paths (multi-user storage, event bus, credential pools) or working on apps/api, apps/worker, or apps/gateway. If you're only touching the CLI, agent runtime, or tool gateway, Level 1 is sufficient and faster to iterate on.
Everyday commands
| Command | What it does |
|---|---|
pnpm build | turbo run build across the monorepo |
pnpm dev | turbo run dev --parallel — all apps in watch mode |
pnpm lint | turbo run lint (ESLint per package) |
pnpm typecheck | turbo run typecheck (tsc --noEmit per package) |
pnpm test | vitest run — unit tests |
pnpm test:integration | vitest run tests/integration — phase integration suites |
pnpm format / pnpm format:check | Prettier write / check across ts,tsx,js,json,md,yml,yaml |
pnpm db:generate / db:migrate / db:seed | Drizzle schema generation, migration, and seed (@anvio/db) |
pnpm cli | Run the CLI from TypeScript source via tsx (no build step) |
pnpm anvio | Run the built CLI (apps/cli/dist/main.js) |
pnpm clean | turbo run clean + remove node_modules |
Run pnpm test and pnpm typecheck before opening a pull request — both are required CI jobs (see Pull Requests).
Last updated on