AAnvio
Contributing

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 Anvio

Install dependencies

pnpm install

This installs dependencies for every workspace package under apps/ and packages/ in one pass via pnpm workspaces.

Build

pnpm build

Runs 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 chat

pnpm 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 --help

pnpm 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 .env

Fill 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 -d

This 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:seed

Both 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 dev

Runs 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

CommandWhat it does
pnpm buildturbo run build across the monorepo
pnpm devturbo run dev --parallel — all apps in watch mode
pnpm lintturbo run lint (ESLint per package)
pnpm typecheckturbo run typecheck (tsc --noEmit per package)
pnpm testvitest run — unit tests
pnpm test:integrationvitest run tests/integration — phase integration suites
pnpm format / pnpm format:checkPrettier write / check across ts,tsx,js,json,md,yml,yaml
pnpm db:generate / db:migrate / db:seedDrizzle schema generation, migration, and seed (@anvio/db)
pnpm cliRun the CLI from TypeScript source via tsx (no build step)
pnpm anvioRun the built CLI (apps/cli/dist/main.js)
pnpm cleanturbo run clean + remove node_modules

Run pnpm test and pnpm typecheck before opening a pull request — both are required CI jobs (see Pull Requests).

Edit on GitHub

Last updated on

On this page