Development Environment Setup
The LearnHouse CLI sets up and runs the entire development environment with a single command.
Prerequisites
Make sure you have the following installed before proceeding:
- Docker (with Docker Compose v2)
- Node.js 22+ (to run the CLI with
npx) - Bun: used to install and run the web and collab workspaces
- uv: used to manage and run the Python API
Make sure Docker has at least 4GB of RAM allocated. You can check and adjust this in Docker Desktop under Settings > Resources.
npx learnhouse dev runs bun install and uv sync to install project dependencies, but it does not install bun or uv themselves. It checks for both and stops with an install link if either is missing.
Setup Steps
1. Clone the Repository and Start Development
git clone https://github.com/learnhouse/learnhouse && cd learnhouse && npx learnhouse dev
That single command handles everything:
- Checks env files: if
apps/api/.env,apps/web/.env.localorapps/collab/.envlack a required variable, it offers to write development defaults (including matching secrets for the API and the collaboration server). - Starts backing services: PostgreSQL and Redis are launched via Docker Compose. On the first run it asks for the admin email and password.
- Installs dependencies: Python dependencies via
uvand JavaScript dependencies viabun, when they are not installed yet. - Starts the API: The FastAPI backend starts on port 1338 with hot reload.
- Starts the frontend: The Next.js development server starts with
--turbopackand hot reload. - Starts the collaboration server: The Hocuspocus collaboration server starts via
tsx watchon port 4000.
See Dev Mode for the full startup flow, the keyboard controls, and how to run with Enterprise code (--ee).
All services are coordinated automatically so you do not need to manage them individually.
Accessing the Application
Once npx learnhouse dev is running, you can access:
| Service | URL |
|---|---|
| Frontend | |
| API | |
| API Documentation (Swagger) |
The Swagger UI at /docs is only available in development mode. Production instances do not expose the interactive API documentation.
Stopping the Environment
Press q or Ctrl+C in the terminal where npx learnhouse dev is running to stop the API, web and collab servers. The PostgreSQL and Redis containers keep running for the next session. To stop them:
docker compose -f .learnhouse/docker-compose.dev.yml -p learnhouse-dev down
Troubleshooting
- Port conflicts: Make sure ports 3000 (web), 1338 (API), 4000 (collab), 5432 (Postgres), and 6379 (Redis) are not in use by other applications.
- Docker not running: Ensure the Docker daemon is started before running
npx learnhouse dev. - Dependency issues: The CLI only installs dependencies when
node_modules(web, collab) or.venv(API) is missing. After pulling changes that touch dependencies, runbun installoruv syncyourself, or delete those directories and re-runnpx learnhouse dev. - Lockfile errors in CI: after changing a
package.jsonorapps/api/pyproject.toml, runscripts/lockfiles.shto regenerate every lockfile. CI runsscripts/lockfiles.sh --check.