Edit

Dev Mode

The dev command starts a full local development environment with hot reload for all services.

npx learnhouse dev

How It Works

The command splits infrastructure and application services:

  • Infrastructure (Docker): PostgreSQL with pgvector and Redis run in containers, defined in .learnhouse/docker-compose.dev.yml (the CLI writes this file on each run)
  • Application (local): the API, web, and collab servers run directly on your machine with hot reload

Requirements

  • Docker with Docker Compose v2
  • bun (for web and collab dependencies)
  • uv (for Python API dependencies)

Startup Flow

  1. Detect project root: walks up from the current directory until it finds apps/api and apps/web
  2. Check env files: looks for the variables each app needs (see below). If any are missing, it lists them and offers to write development defaults or stop.
  3. Link Enterprise code (only with --ee)
  4. Check tools: bun, uv, Docker, and a running Docker daemon
  5. Admin setup and infrastructure: when the learnhouse-db-dev and learnhouse-redis-dev containers are not already running, prompts for an admin email (default [email protected]) and password, then starts them. When they are running, they are reused and the prompt is skipped. Pass --admin-email and --admin-password to skip the prompt.
  6. Health checks: waits for PostgreSQL and Redis to be ready
  7. Install dependencies: runs bun install in apps/web and apps/collab when node_modules is missing, and uv sync in apps/api when .venv is missing
  8. Start services: launches the API, web, and collab servers with color-coded output

Env files

The CLI checks these variables and, if you accept, appends development defaults for the missing ones only:

FileVariableDefault written
apps/api/.envLEARNHOUSE_AUTH_JWT_SECRET_KEYRandom secret
apps/api/.envCOLLAB_INTERNAL_KEYRandom secret
apps/web/.env.localNEXT_PUBLIC_LEARNHOUSE_BACKEND_URLhttp://localhost:1338/
apps/collab/.envCOLLAB_PORT4000
apps/collab/.envLEARNHOUSE_API_URLhttp://localhost:1338
apps/collab/.envLEARNHOUSE_AUTH_JWT_SECRET_KEYSame value as the API
apps/collab/.envCOLLAB_INTERNAL_KEYSame value as the API

Other API settings fall back to apps/api/config/config.yaml, which ships localhost defaults (database postgresql://learnhouse:learnhouse@localhost:5432/learnhouse, Redis redis://localhost:6379/learnhouse).

The CLI also sets these for the processes it starts:

VariableValue
LEARNHOUSE_DEVELOPMENT_MODEtrue
LEARNHOUSE_INITIAL_ADMIN_EMAIL / LEARNHOUSE_INITIAL_ADMIN_PASSWORDThe admin credentials, when given
LEARNHOUSE_DISABLE_EE1, unless --ee is passed
LEARNHOUSE_FORCE_EE1, only with --ee

Services

ServiceCommandPort
APIuv run python app.py1338
Webnext dev --turbopack3000
Collabtsx watch src/index.ts4000
PostgreSQLDocker (pgvector/pgvector:pg16)5432, bound to 127.0.0.1
RedisDocker (redis:8.6.1-alpine)6379, bound to 127.0.0.1

The development database uses user, password and database name learnhouse.

Interactive Controls

While running, you can type these keys to manage services:

KeyAction
raRestart API
rwRestart Web
rcRestart Collab
rbRestart all services
qQuit (graceful shutdown)

Enterprise Edition

Use the --ee flag to enable Enterprise Edition features:

npx learnhouse dev --ee

With the flag, the CLI links apps/api/ee and apps/web/ee to a sibling EE checkout at ../ee/apps/<app>/ee (on Windows it uses directory junctions). If no EE checkout is found, that app runs as the community edition. Without the flag, LEARNHOUSE_DISABLE_EE=1 keeps the app on the community edition even if an ee/ folder exists.

Shutdown

When you quit (q or Ctrl+C):

  • Local services (API, Web, Collab) are stopped
  • Docker containers (PostgreSQL, Redis) keep running for the next session
  • To fully stop infrastructure:
docker compose -f .learnhouse/docker-compose.dev.yml -p learnhouse-dev down

Database and Redis data persist across dev sessions in Docker volumes. Running down keeps them; add -v to delete them.