🐳 full-stack-fastapi-template

Full-stack web application template with FastAPI, React, SQLModel, PostgreSQL, Vite, Tailwind CSS, shadcn/ui, FastAPI Cloud, and Docker Compose.

Docker Ready 4 Services 44,811 stars
1. Pull Image docker pull library/postgres
2. 1-Click Launch Command docker run -d --name full-stack-fastapi-template postgres:18
3. Compose Deployment docker compose up -d
compose.yml
Download .yml
services:

  proxy:
    image: traefik:3.6
    volumes:
      # Add Docker as a mounted volume, so that Traefik can read the labels of other services
      - /var/run/docker.sock:/var/run/docker.sock:ro
    command:
      # Enable Docker in Traefik, so that it reads labels from Docker services
      - --providers.docker
      # Do not expose all Docker services, only the ones explicitly exposed
      - --providers.docker.exposedbydefault=false
      # Create an entrypoint "http" listening on port 80
      - --entrypoints.http.address=:80
      # Enable the access log, with HTTP requests
      - --accesslog
      # Enable the Traefik log, for configurations and errors
      - --log

  db:
    image: postgres:18
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres -d app"]
      interval: 10s
      retries: 5
      start_period: 30s
      timeout: 10s
    volumes:
      - app-db-data:/var/lib/postgresql
    environment:
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:?Variable not set}
      - POSTGRES_DB=app

  adminer:
    image: adminer
    depends_on:
      - db
    environment:
      - ADMINER_DESIGN=pepa-linha-dark
    labels:
      # Enable Traefik for this service
      - traefik.enable=true
      # Route HTTP traffic for the Adminer subdomain
      - traefik.http.routers.adminer-http.rule=Host(`adminer.${DOMAIN:-localhost}`)
      - traefik.http.routers.adminer-http.entrypoints=http
      # Define the port inside of the Docker service to use
      - traefik.http.services.adminer.loadbalancer.server.port=8080

  backend:
    image: backend:latest
    depends_on:
      db:
        condition: service_healthy
        restart: true
    environment:
      PROJECT_NAME: ${PROJECT_NAME:?Variable not set}
      SECRET_KEY: ${SECRET_KEY:?Variable not set}
      FIRST_SUPERUSER: ${FIRST_SUPERUSER:?Variable not set}
      FIRST_SUPERUSER_PASSWORD: ${FIRST_SUPERUSER_PASSWORD:?Variable not set}
      SMTP_HOST: ${SMTP_HOST}
      SMTP_USER: ${SMTP_USER:-}
      SMTP_PASSWORD: ${SMTP_PASSWORD:-}
      EMAILS_FROM_EMAIL: ${EMAILS_FROM_EMAIL}
      DATABASE_URL: postgresql://postgres:${POSTGRES_PASSWORD:?Variable not set}@db:5432/app
      SENTRY_DSN: ${SENTRY_DSN:-}

    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8000/api/v1/utils/health-check/"]
      interval: 10s
      timeout: 5s
      retries: 5

    build:
      context: .
      dockerfile: backend/Dockerfile
    labels:
      # Enable Traefik for this service
      - traefik.enable=true

      # Define the port inside of the Docker service to use
      - traefik.http.services.backend.loadbalancer.server.port=8000

      # Route HTTP traffic for this domain
      - traefik.http.routers.backend-http.rule=Host(`${DOMAIN:-localhost}`)
      - traefik.http.routers.backend-http.entrypoints=http

volumes:
  app-db-data: