Skip to content

Local Development

Prerequisites

  • Node.js 22+ and pnpm 12+
  • Rust and Cargo (Edition 2021+)
  • Docker (for PostgreSQL 17 with pgvector)

Setup

Terminal window
# 1. Start PostgreSQL 17 + pgvector
docker compose -f deploy/docker-compose.yml up -d --wait postgres
# 2. Prepare environment and local folders
cp .env.example .env
mkdir -p data/inbox data/derivatives data/library
# 3. Install dependencies and apply SQL migrations
pnpm install
pnpm db:migrate

Run Services in Dev Mode

Terminal window
# Terminal 1: Hono API (http://localhost:3000) and Vite React SPA (http://localhost:5173)
pnpm dev
# Terminal 2: Rust geometry and archive worker
pnpm dev:worker

If port 3000 is in use on your host, set PORT=3100, APP_ORIGIN=http://localhost:3100, BETTER_AUTH_URL=http://localhost:3100, and VITE_API_ORIGIN=http://localhost:3100 in .env. Vite reads VITE_API_ORIGIN automatically.

Build, Typecheck, and Test

Terminal window
pnpm build # Compiles @enmesh/shared, @enmesh/ui, @enmesh/api, and @enmesh/web
pnpm typecheck # Runs TypeScript checks across all packages
pnpm test # Runs Vitest unit tests
pnpm test:worker # Runs Rust unit tests

Site and Docs Preview

Terminal window
pnpm --filter @enmesh/site dev

This command opens the landing page at http://localhost:4321/ and Starlight docs at http://localhost:4321/docs/.