Skip to content

infrastructure: add Docker Compose setup for full local development stack #37

@ShantKhatri

Description

@ShantKhatri

Summary

Product doc section 6.4 specifies DevCard must be fully self-hostable via Docker Compose. Create a working docker-compose.yml at the project root that spins up all services: PostgreSQL, Redis, backend, and web.

Context

The monorepo root already has a package.json and pnpm workspace. The backend uses Fastify (apps/backend) and the web app uses SvelteKit (apps/web). The backend references DATABASE_URL and environment variables in apps/backend/src/env.ts.

Tasks

  • create docker-compose.yml at the project root with services:
    • db: postgres:15-alpine with POSTGRES_DB, POSTGRES_USER, POSTGRES_PASSWORD env vars, persistent named volume.
    • redis: redis:7-alpine with persistent volume.
    • backend: built from apps/backend/Dockerfile (create Dockerfile if it doesn't exist), depends on db and redis, exposes port 3001.
    • web: built from apps/web/Dockerfile (create if needed), depends on backend, exposes port 5173.
  • create apps/backend/Dockerfile using multi-stage build: install deps → compile TypeScript → run production image.
  • create apps/web/Dockerfile using Node + SvelteKit adapter-node or adapter-static.
  • create .env.example at root with all required env vars and explanatory comments.
  • add a docker-compose.override.yml for dev-mode hot-reload mounts.
  • update README.md with a Self-Hosting section using the Compose workflow.
  • validate by running docker compose up and confirming health check at localhost:3001/health.

Acceptance Criteria

  • docker compose up brings up all services without errors.
  • backend /health responds 200 from within the compose network.
  • web app is reachable at localhost:5173.
  • data persists across docker compose down && docker compose up.

Difficulty

senior — requires Docker multi-stage build expertise, service dependency management, volume persistence, and environment variable security practices.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions