Repository navigation
Quick Start
Canonical source:
docs/00-start-here/onboarding-5-minutes.md— this page is rendered from it on every publish; edit the source.
Get ClawAI running locally and make your first code change. This guide assumes you have basic familiarity with Node.js, Docker, and TypeScript.
Install these before starting:
| Tool | Minimum Version | Check Command |
|---|---|---|
| Node.js | 20.x | node -v |
| npm | 10.x | npm -v |
| Docker + Docker Compose | v2 | docker compose version |
| Git | 2.x | git --version |
Optional but recommended:
| Tool | Purpose |
|---|---|
| Ollama | Local AI models (auto-managed via Docker, but native install is faster for GPU) |
| pgAdmin or DBeaver | Database inspection |
| Postman or Bruno | API testing |
git clone <repo-url> ClawAI
cd ClawAI
npm installThis installs dependencies for all 21 backend services, the frontend, and shared packages (npm workspaces handles everything from the root).
cp .env.example .envThe .env.example file contains working defaults for local development. Review it and update any values if needed (database passwords, JWT secret, workspace OAuth credentials, etc.).
Or use the automated installer:
# Linux / macOS
./scripts/install.sh
# Windows PowerShell
./scripts/install.ps1The installer creates the .env file, sets up databases, runs Prisma migrations, seeds default data (admin user, default routing policies), and prepares the runtime stack.
./scripts/claw.sh up -dThis starts the whole stack: the 21 backend services, frontend, Nginx, the per-service PostgreSQL databases, MongoDB, Redis, RabbitMQ, Ollama, and ClamAV.
Wait about 60 seconds for all services to initialize, run migrations, and pull local models.
Check status:
./scripts/claw.sh statusVerify it's working:
- Frontend: http://localhost:3000
- API (via Nginx): http://localhost:4000/api/v1/health
- RabbitMQ management: http://localhost:15672
Default admin credentials (set in .env):
Email: admin@claw.local
Password: ClawAdmin123!
| Command | What It Does |
|---|---|
./scripts/claw.sh up -d |
Start all containers |
./scripts/claw.sh down |
Stop all containers |
./scripts/claw.sh logs -f chat-service |
Follow logs for one service |
./scripts/claw.sh status |
Check all service health |
./scripts/claw.sh logs |
Tail all service logs |
| Command | What It Does |
|---|---|
npm run lint |
ESLint across all workspaces |
npm run typecheck |
TypeScript strict check across all workspaces |
npm run build |
Production build all workspaces |
npm run test |
Run all tests (Vitest, every workspace) |
| Command | What It Does |
|---|---|
npx prisma migrate dev --name <name> |
Create a new migration (run from service directory) |
npx prisma studio |
Open Prisma Studio GUI (run from service directory) |
npx prisma generate |
Regenerate Prisma client after schema changes |
Run from the service directory (for example apps/claw-chat-service/):
npm run dev # Rebuild and restart on every change (nodemon)
npm run test # Run tests
npm run lint # Lint this serviceOr directly from the repo root:
npm run dev --workspace=claw-chat-service
npm run dev --workspace=claw-workspace-service
npm run dev --workspace=claw-agent-serviceClawAI/
apps/
claw-frontend/ # Next.js UI (pages, components, hooks, stores)
claw-auth-service/ # Authentication + user management
claw-chat-service/ # Chat threads, messages, AI execution
claw-connector-service/ # Cloud provider configuration
claw-routing-service/ # Intelligent routing engine
claw-memory-service/ # Memory extraction + context packs
claw-file-service/ # File upload + chunking
claw-audit-service/ # Audit trail + usage tracking
claw-ollama-service/ # Local Ollama model management
claw-health-service/ # Aggregated health checks
claw-client-logs-service/ # Frontend log ingestion
claw-server-logs-service/ # Backend log aggregation
claw-image-service/ # Image generation
claw-file-generation-service/ # File/document generation
claw-workspace-service/ # Workspace sync, search, action approvals
claw-agent-service/ # Local agent session and command backend
packages/
shared-types/ # Enums, event payloads, auth types
shared-constants/ # Exchange name, ports, API prefix
shared-rabbitmq/ # RabbitMQ module, retry logic, structured logger
shared-auth/ # AuthGuard, RolesGuard, decorators
infra/nginx/ # Nginx reverse proxy config
scripts/ # install.sh, install.ps1, claw.sh
docs/ # Architecture documentation
agent-cli/ # Local companion CLI for the agent service
CLAUDE.md # Coding rules (READ THIS)
.env.example # Environment variable template
docker-compose.dev.yml # Development Docker Compose
Every NestJS service follows the same structure:
apps/claw-chat-service/
prisma/
schema.prisma # Database schema
migrations/ # Migration history
src/
app/
decorators/ # Custom decorators
filters/ # Exception filters
guards/ # Auth/role guards
interceptors/ # Request/response interceptors
pipes/ # Validation pipes
common/
config/ # AppConfig (Zod-validated env)
constants/ # Service-level constants
enums/ # Service-level enums
errors/ # BusinessException, EntityNotFoundException
utilities/ # Third-party library wrappers
modules/
<domain>/
<domain>.controller.ts # HTTP endpoints
<domain>.service.ts # Business logic
<domain>.repository.ts # Data access
<domain>.manager.ts # Complex orchestration
<domain>.module.ts # NestJS module definition
dto/ # Zod schemas + inferred types
types/ # Domain-specific types
constants/ # Domain-specific constants
main.ts # Bootstrap
app.module.ts # Root module
test/ # Test files
apps/claw-frontend/
src/
app/ # Next.js pages (App Router)
components/
ui/ # shadcn/ui primitives (DO NOT EDIT)
<domain>/ # Feature components
hooks/
<domain>/ # Custom hooks (useQuery/useMutation wrappers)
repositories/
<domain>/ # API call functions
shared/query-keys.ts # TanStack Query key factory
stores/ # Zustand stores (auth, sidebar, filters)
types/ # TypeScript types
enums/ # Frontend enums
constants/ # Frontend constants
utilities/ # Utility functions
lib/
i18n/locales/ # 9 locale files
validation/ # Zod schemas for forms
- Find the relevant service in
apps/claw-<name>-service/ - Locate the module in
src/modules/<domain>/ - Make your change following the layer rules:
- Controller: extract, call service, return
- Service: business logic
- Repository: data access only
- Manager: complex orchestration
- Add/update Zod DTOs in
dto/for any input changes - Add/update tests in
test/or alongside the module - Run
npm run lint && npm run typecheck && npm run test - Check the mandatory change checklist in
CLAUDE.md(env vars, migrations, i18n, docs, etc.)
- Navigate to
apps/claw-frontend/src/ - Follow the pattern: Page -> Controller Hook -> Service -> Repository
- Extract types to
src/types/, hooks tosrc/hooks/, constants tosrc/constants/ - No business logic in
.tsxfiles -- put it in hooks - All user-facing text must use
t('key')and be added to all locale files - Run
npm run lint && npm run typecheck && npm run test
# All tests across all workspaces
npm run test
# Single service
cd apps/claw-chat-service && npm run test
# Single test file
cd apps/claw-chat-service && npx vitest run src/modules/chat/chat.service.spec.ts
# Frontend tests
cd apps/claw-frontend && npx vitest
# E2E tests
cd apps/claw-frontend && npx playwright testAnother process is using one of the service ports (3000, 4000-4015). Kill it or change the port in .env.
If a migration fails during container startup, the container will crash-loop. Fix the migration, then rebuild:
./scripts/claw.sh service:rebuild <service-name>RabbitMQ takes 10-20 seconds to start. Services retry automatically, but if it persists, check:
./scripts/claw.sh logs rabbitmqThe ollama runtime may auto-pull models on startup. This requires disk space and a working internet connection. Check progress:
./scripts/claw.sh logs -f ollama
./scripts/claw.sh logs -f ollama-serviceCheck that your workspace provider credentials and callback URLs in .env match the provider app configuration.
Check that:
-
agent-serviceis healthy - the CLI is pointed at the correct base URL
- the JWT used during registration is valid
After changing code in packages/shared-*, dependent services need to be restarted:
./scripts/claw.sh restart chat-service routing-service workspace-service agent-servicenpm installDependencies may have changed. Always run npm install after pulling.
- System at a Glance -- full architecture overview
-
CLAUDE.md(project root) -- mandatory coding rules and patterns - The service guide for whatever service you'll be working on (in
docs/04-backend/)
ClawAI Wiki · source-controlled under wiki/ · generated/mirrored from the current repository knowledge layer.
ClawAI Wiki
Product
- Product-Vision
- Flagship-Features
- Business-Overview
- Requirements-Register
- Drift-Log
- Runtime-Managed-Connector-Providers
- Threads
- ADR-Index
Architecture
- System-at-a-Glance
- Architecture-Map
- System-Architecture
- Message-Flow
- End-to-End-Data-Flow
- Routing-Engine
- Event-Bus
- Security-Architecture
Platform
- Backend-Services
- Frontend-Architecture
- Shared-Packages
- Database-Reference
- API-Reference
- Provider-Catalog
- Memory-and-Context-Architecture
- File-Support-Architecture
- Research-and-Web-Crawling
Runtime & Ops
- Docker-Guide
- Nginx-Reference
- CI-CD-Pipeline
- Logging-and-Observability
- Operational-Runbooks
- Troubleshooting
Quality
Engineering OS
- AI-Native-Engineering-OS
- Generated-Manifests
- Rules-Catalog
- Skills-Catalog
- Context-Layer
- Engineering-Memory
- Tooling-and-Automation
- Scripts-and-Operations
- ESLint-and-Architecture-Enforcement
- Extended-Work-Skills
Agents
Reference