Skip to main content

Development Guide

This guide covers how to set up your development environment, contribute code, and submit pull requests to AgentHiFive.

Prerequisites

  • Node.js 24+ with pnpm 9.x
  • Docker 24+ (for PostgreSQL and Nginx in development)
  • VS Code (recommended IDE)

Repository Structure

AgentHiFive is a monorepo managed with pnpm workspaces and Turborepo:

agenthifive-enterprise/
apps/
web/ # Next.js 16 frontend (dashboard)
api/ # Fastify 5.x backend (API gateway)
cli/ # CLI tool
docs/ # Docusaurus documentation site
packages/
contracts/ # Shared Zod schemas and TypeScript types
security/ # Encryption utilities
sdk/ # Official TypeScript SDK
oauth-connectors/ # OAuth provider adapters
openclaw/ # OpenClaw Gateway plugin
agenthifive-mcp/ # MCP server
integration-testing/ # Fully containerized e2e tests

Getting Started

# Clone the repository
git clone https://github.com/agenthifive/agenthifive-enterprise.git
cd agenthifive-enterprise

# Initialize the project (install dependencies, start Docker services, run migrations)
make init

# Start development servers (web + api running natively for fast HMR)
make dev

# Stop Docker services
make down

The Makefile at the repository root provides all common development commands. Run make help to see the full list.

Code Style

  • TypeScript across the entire codebase. Strict mode is enabled.
  • Zod 4.x for runtime validation. Schemas live in packages/contracts.
  • Drizzle ORM for database queries. No raw SQL in application code.
  • Fastify 5.x with typed routes and JSON schema validation.
  • Tailwind 4.x for frontend styling.

Naming Conventions

ContextConventionExample
Files and directorieskebab-casejwt-auth.ts, oauth-connectors/
TypeScript variablescamelCaseworkspaceId, auditEvents
TypeScript types/interfacesPascalCaseExecuteRequest, PolicySummary
Database tablessnake_case with prefixt_connections, l_audit_events
Database columnssnake_caseworkspace_id, created_at
Environment variablesSCREAMING_SNAKE_CASEDATABASE_URL, WEB_JWKS_URL

Branch Conventions

BranchPurpose
mainProduction-ready code. Protected branch.
<name>/<feature>Feature branches. Named ralph/agenthifive-mvp, alice/policy-engine, etc.

All changes go through pull requests targeting main.

Pull Request Process

  1. Create a feature branch from main.
  2. Make your changes with clear, atomic commits.
  3. Ensure all checks pass locally: pnpm lint, pnpm typecheck, pnpm test.
  4. Push your branch and open a pull request against main.
  5. CI runs automatically: lint, typecheck, and test (see CI/CD).
  6. Request review from a team member.
  7. After approval and passing CI, merge via squash-and-merge.
Before Submitting

Run pnpm turbo run build --filter='./packages/*' to verify that shared packages build correctly before opening a PR.

Common Makefile Commands

CommandDescription
make prereqsInstall prerequisites (nvm, Node.js 24, pnpm, Docker)
make initFull project setup (install, Docker up, migrate)
make reset-envReset .env from core/.env.example
make devStart all dev servers (web + api + admin)
make dev-webStart only Next.js web (port 3000)
make dev-apiStart only Fastify API (port 4000)
make dev-adminStart only Admin SPA (port 3002)
make dev-docsStart Docusaurus (port 3001)
make upStart PostgreSQL in Docker
make downStop Docker services
make down-hardStop and remove Docker volumes
make logsTail Docker logs
make prodBuild and start production stack
make prod-buildRebuild production images
make prod-downStop production stack
make prod-logsTail production logs
make buildBuild all packages and apps
make migrateRun database migrations
make migrate-generateGenerate a new migration
make db-resetDrop and recreate the database
make psqlConnect to PostgreSQL shell
make dummydataSeed example data
make lintRun linter
make typecheckRun TypeScript checks
make testRun tests
make rebaseBump core submodule to latest public repo
make cleanRemove all build artifacts and node_modules
make killStop everything

Next Steps

  • Testing -- test architecture, patterns, and how to run tests.
  • Database -- Drizzle ORM patterns and naming conventions.
  • CI/CD -- GitHub Actions pipelines for continuous integration and deployment.