- Requirements: Docker and Docker Compose v2
Steps
- Copy
.env.exampleto.envand set values (JWT_SECRET,API_URL). - Build and run containers:
docker compose up --build -d
- Services:
- App at
http://localhost:6002 - MongoDB at
mongodb://localhost:27017
- App at
- Environment variables consumed by the app:
PORT(default 6002)DB_HOST(default 127.0.0.1; in Compose set tomongo)DB_PORT(default 27017)DB_NAME(defaultspectra_db)JWT_SECRET(required for auth)API_URL(backend API base, defaulthttp://localhost:8000/api)
Useful commands
- Show logs:
docker compose logs -f app - Restart app:
docker compose restart app - Stop:
docker compose down - Wipe data:
docker compose down -v(drops Mongo volume)
Security notes
- Use a strong
JWT_SECRETin production. - Consider binding Mongo to a private network only; remove
portsfrommongoservice. - Terminate TLS at a reverse proxy (nginx/Traefik) in front of the app.