One-command local stack using Docker Compose with the dev profile.
- Docker Desktop (or Docker Engine + Compose plugin)
- Git
cp .env.dev.example .env.devOpen .env.dev and fill in any values marked as required. The defaults work
out of the box for local development — at minimum set a real JWT_SECRET:
# Generate a strong secret
node -e "console.log(require('crypto').randomBytes(64).toString('hex'))"docker compose -f docker-compose.dev.yml --profile dev upThis starts:
- PostgreSQL on
localhost:5432 - Backend (NestJS) on
localhost:3001with hot reload
Add --build to force a rebuild of the backend image (e.g. after changing
Dockerfile.dev or package.json):
docker compose -f docker-compose.dev.yml --profile dev up --buildcurl http://localhost:3001/v1/health
# Expected: {"status":"ok","timestamp":"..."}Or open http://localhost:3001/v1/health in your browser.
The backend source (./backend/src) is bind-mounted into the container.
nest start --watch watches for .ts file changes and recompiles automatically.
To see the watcher output:
docker compose -f docker-compose.dev.yml --profile dev logs -f backendEdit any file under backend/src/, save it, and watch the logs — the NestJS
process will restart within a few seconds and your change will be live.
To wipe the dev database and start fresh (removes the postgres_dev_data volume):
docker compose -f docker-compose.dev.yml --profile dev down -v
docker compose -f docker-compose.dev.yml --profile dev upNote: This only removes the dev volume (
myfans_postgres_dev_data). Production data is unaffected.
# Stop containers (keep volumes)
docker compose -f docker-compose.dev.yml --profile dev down
# Stop containers and remove volumes (full reset)
docker compose -f docker-compose.dev.yml --profile dev down -vPort 5432 already in use
Another Postgres instance is running locally. Stop it or change the host port
in docker-compose.dev.yml.
Backend container is unhealthy
Check the logs:
docker compose -f docker-compose.dev.yml --profile dev logs backendCommon causes: missing JWT_SECRET in .env.dev, TypeORM migration failure,
or Postgres not yet ready.
Changes not reflected after editing a file Confirm the watcher is running in the logs. If the container exited, restart it:
docker compose -f docker-compose.dev.yml --profile dev restart backendStale image after changing Dockerfile.dev or package.json
Force a rebuild:
docker compose -f docker-compose.dev.yml --profile dev up --build