Skip to content

Local development

How to run the portal on your own machine, fill it with demo data and run the checks a pull request must pass. For a server, read Install instead. For the rules of contributing, read CONTRIBUTING.md.

  • Node.js 26 (the servers run 26.13.1, deploy/node-release.env) and pnpm 10. Node 26 ships no corepack: npm install -g corepack@0.36.0 && corepack enable gives you the pnpm version in package.json
  • ffmpeg, for video processing
  • Docker, or a local PostgreSQL 17 with pgvector and Redis 7
Terminal window
pnpm install
docker compose up -d # PostgreSQL on :5432, Redis on :6379
pnpm dev # API on :4000 (applies the migrations), web app on :3000

Open http://localhost:3000, create an organisation, and build a first course under Author. The defaults in apps/api/.env.example and apps/web/.env.example work with docker compose. Configuration lists every setting with its default and meaning.

The portal runs locally without any vendor account. Each feature that needs one falls back to something you can see:

Feature Locally, without a vendor To use the real thing
AI A deterministic stand-in answers by quoting course passages An organisation connects its model under Admin → Integrations → Language model. For development only, ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY or MISTRAL_API_KEY in apps/api/.env (optionally AI_PROVIDER, AI_MODEL). Production ignores them
Email Invitations, sign-in links and password resets are printed to the API log Set in the admin console under Mail (one SMTP server or Microsoft 365), with MAIL_SETTINGS_KEY
Live sessions Peer to peer through your own TURN server (TURN_URLS, TURN_SECRET), without either no audio or video A LiveKit server (LIVEKIT_*)
Transcripts Uploaded WebVTT or SRT captions A speech recognition model of the platform’s AI (admin console) or the organisation’s
Code lab The tests run Python and JavaScript in a child process (test/process-sandbox.ts) A lab node’s agent against the local API (the lab node repository’s README, ADR 0497)

To try live features, open the portal in a second browser as another user. The stage, polls, questions, breakouts, the activity feed and course presence then update on both sides.

To open a development instance at, say, http://203.0.113.10:

  • Web app: run the production build (pnpm --filter @academy/web build && pnpm --filter @academy/web start). The dev server serves its scripts only to localhost unless you set ALLOWED_DEV_ORIGINS=203.0.113.10.
  • API address: the browser uses port 4000 on the page’s host. On a domain it uses the api. subdomain (academy.example.com → api.academy.example.com). For anything else, set NEXT_PUBLIC_API_URL.
  • API settings: CORS_ORIGINS=http://203.0.113.10:3000, PUBLIC_WEB_URL=http://203.0.113.10:3000, PUBLIC_API_URL=http://203.0.113.10:4000.

With API and web app running in development (AUTH_MODE=dev):

Terminal window
node apps/api/scripts/demo-seed.mjs # organisation "demo": owner@, admin@, trainer@, learner@demo.test
node apps/web/scripts/help-screenshots.mjs # retakes the handbook pictures in English (Chrome or CHROME_PATH; ONLY=name,… for some)
node apps/web/scripts/help-screenshots-live.mjs # the pictures from inside a live session (FAKE_CAMERA=file.y4m for a calm picture)

The cast for the role test scenarios has a seed of its own. Run it on a database of its own, as that page explains.

The pictures of a learner with a platform account (My learning, Pro, purchases) need such an account. Sign up at /signup, confirm with the link in the API log, and pass DEMO_ACCOUNT_EMAIL and DEMO_ACCOUNT_PASSWORD. The evidence part of the HR systems page needs a connected HR system that takes evidence (HR_EVIDENCE=1).

The handbooks are Markdown in apps/docs/src/content/docs/en/<handbook>/. The portal’s Help and the docs site read the same files (ADR 0274). The guides for servers and developers are the files in this folder, and the docs site copies them in when it is built (apps/docs/src/repo-docs.mjs). Retake a page’s screenshots after changing the screen it shows.

Terminal window
pnpm --filter @academy/docs dev # the docs site on http://localhost:4321
Terminal window
pnpm typecheck
pnpm test # API tests need PostgreSQL and Redis; they reset the academy_test database and Redis DB 15
pnpm build
pnpm licences:check # after adding or updating a dependency

The repository’s CI runs the same checks on every pull request, against PostgreSQL 17 and Redis.

To run one test file: pnpm --filter @academy/api exec vitest run test/<name>.test.ts. Some files are generated, and their tests fail until you regenerate them. CONTRIBUTING.md lists which.

Terminal window
# Regional failover with a throwaway primary and standby (needs root and the PostgreSQL 17 server binaries)
pnpm --filter @academy/api build
pnpm --filter @academy/api exec tsx scripts/failover-drill.ts # asynchronous replication
pnpm --filter @academy/api exec tsx scripts/failover-drill.ts --sync # synchronous: no acknowledged write may be lost
# Collaboration load against running API nodes
pnpm --filter @academy/api exec tsx scripts/collab-load.ts http://localhost:4000 http://localhost:4001

Signed in, GET /v1/openapi.json gives the OpenAPI 3.1 description of every route, and GET /v1/api-docs a readable reference. GET /v1/integration-api/openapi.json gives the stable automation API with its versioning promise (automation API). Every route also has an MCP tool (list).

Every installation builds from its own checkout of the repository and runs only the built runtime (ADR 0444).

  1. An administrator updates the checkout and runs the update: sudo git -C <checkout> pull --ff-only && sudo <checkout>/deploy/update.sh (it never pulls itself, ADR 0481). It builds there and delivers the runtime into APP_DIR/releases/<commit>. Every migration says whether the running code survives it (-- deploy: expand or -- deploy: contract), and CI checks that it does (scripts/release/migration-classes.mjs).
  2. Before pending migrations it dumps the schema over the network, then migrates, switches the link current and checks the services. A failure restores the dump and switches back, and sudo deploy/update.sh rollback goes back to the release before.

The details are in Deploy and update.

This repository is exported from the maintainers’ own Git server once per release (The open-source projects). From the first public release on, self-hosters install the public tree the same way, from a checkout of a tagged commit. Each running installation links the source of its exact version (the footer’s Source code link and GET /v1/source).