Skip to content

Extend docker-compose.yml to Include API and Web Services for Local Full-Stack Development #267

Description

@vjuliaife

Description:
The current docker-compose.yml only starts a Postgres container, leaving developers to manually start the Express API and Next.js web app in separate terminals with hand-crafted environment variables. Adding api and web service definitions makes docker compose up the single command needed to run the entire TariffShield stack locally, eliminating environment drift between developers.

Acceptance Criteria:

  • Add an api service to docker-compose.yml that builds from a new apps/api/Dockerfile, exposes port 3001, depends on the postgres service, and injects all variables from .env.example via env_file
  • Add a web service that builds from a new apps/web/Dockerfile, exposes port 3000, and passes NEXT_PUBLIC_API_URL=http://api:3001 so it reaches the API container by service name
  • Both Dockerfiles use multi-stage builds: a deps stage that installs npm workspaces, a build stage, and a lean runner stage using node:20-alpine
  • A docker compose up --build from the repo root starts Postgres, API, and web with no additional steps and the web UI is reachable at http://localhost:3000
  • Hot-reload is supported for local development: the api and web services mount the source directory as a volume when NODE_ENV=development
  • Update .env.example with a DATABASE_URL that matches the Compose service name (postgres://...@postgres:5432/tariffshield)
  • Document the full-stack startup command in the project README.md under a "Local Development" section

Relevant Files:

  • docker-compose.yml — add api and web services
  • apps/api/Dockerfile — new multi-stage Dockerfile for the Express API
  • apps/web/Dockerfile — new multi-stage Dockerfile for the Next.js app
  • .env.example — update DATABASE_URL to use Compose service hostname
  • package.json — npm workspace root confirming workspace paths

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programdxDeveloper experience / docs / naminginfrastructureDocker / CI / deploy

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions