Local development
Start the Docker development stack with fast incremental compilation and reliable file synchronisation.
On this page
Use the development Compose file for live editing. It runs the frontend with Turbopack, the backend with Django's development server, PostgreSQL, Redis and a queue worker.
Prepare your environment#
Install Docker with Compose 2.32 or newer. Run commands from the repository root. On a new checkout, create your local settings:
cp .env.dev.example .env.dev
Keep an existing .env.dev when returning to a project. It contains the connection settings for your existing development database. Configure sign-in for your local deployment before creating accounts.
Start with live updates#
docker compose -f dev-docker-compose.yml config --quiet
docker compose -f dev-docker-compose.yml up --build --watch
Open https://localhost. The bundled certificate is self-signed for local development. Keep the terminal running while you edit.
Compose Watch copies frontend changes into the container's Linux filesystem. Turbopack receives native change events there and recompiles only affected code. This avoids reading and writing the build tree through a Windows bind mount.
Understand the cache#
The matii-frontend-next-dev named volume holds .next output and compiler cache. It survives normal container recreation. A page's first visit with a fresh cache still requires compilation; later visits and edits reuse the compiled work.
Frontend dependencies live in the image. Changes to package.json, yarn.lock or Dockerfile.dev trigger a rebuild while Watch is running. node_modules and .next on the host are not copied into the running frontend.
Run containers in the background#
If you prefer separate terminals for startup and file watching:
docker compose -f dev-docker-compose.yml up -d --build
docker compose -f dev-docker-compose.yml watch frontend
The second command must stay running for frontend edits to arrive in the container. Starting with -d alone serves the source included in the last image build.
After changing .env.dev, recreate the affected services to load the new environment. A source edit and an environment-variable edit are different kinds of change.
Inspect the stack#
docker compose -f dev-docker-compose.yml ps
docker compose -f dev-docker-compose.yml logs --tail 100 frontend backend nginx
A brief backend startup delay can occur while migrations run. An nginx 504 means an upstream did not respond in time; check frontend compilation and backend logs before changing the proxy timeout. See Troubleshooting.
Edit the documentation#
Guide source files live in frontend/matii/docs/pages. Regenerate the bundled content after changing them:
cd frontend
node matii/docs/generate.mjs
node matii/docs/generate.mjs --check
With Compose Watch running, the updated bundle is synced into the frontend.
Run checks#
From the frontend directory, run yarn test for the frontend suite. From the backend directory, run pytest tests/ -q for backend tests. Database-backed feature tests have their own environment setup; use the repository's contributor instructions for that suite.
Stop the development services with:
docker compose -f dev-docker-compose.yml stop
Production uses .env and docker-compose.yml, with the frontend compiled during its image build. See Deployment.