Day 1: Docker Compose & Monorepo Setup

~5 min read

What I Built

  • Turborepo + pnpm workspaces configured for monorepo structure
  • Docker Compose with MySQL 8.4, Redis 7 Alpine, and FastAPI backend scaffold
  • dev.sh bootstrap script for local development (start/stop/restart/logs/shell/status)
  • Basic FastAPI app with health check endpoints
  • Marketing website infrastructure with Tailwind CSS and blog structure
  • Cloudflare Pages deployment configuration

Code Highlight


services:
  mysql:
    image: mysql:8.4
    container_name: zephyrapex-mysql
    environment:
      MYSQL_ROOT_PASSWORD: rootpassword
      MYSQL_DATABASE: zephyrapex
      MYSQL_USER: zephyrapex
      MYSQL_PASSWORD: [REDACTED]
    ports:
      - "3308:3306"  # External access port
    volumes:
      - mysql_data:/var/lib/mysql
    networks:
      - zephyrapex-internal
    restart: unless-stopped

  redis:
    image: redis:7-alpine
    container_name: zephyrapex-redis
    ports:
      - "6379:6379"
    networks:
      - zephyrapex-internal
    restart: unless-stopped

  backend:
    build:
      context: ./packages/backend
      dockerfile: Dockerfile
    container_name: zephyrapex-backend
    environment:
      - DATABASE_URL=mysql://zephyrapex:[REDACTED]@mysql/zephyrapex
      - REDIS_URL=redis://redis:6379
    ports:
      - "8000:8000"
    depends_on:
      - mysql
      - redis
    networks:
      - zephyrapex-internal
    restart: unless-stopped

Architecture Decision

Chose MySQL 8.4 over PostgreSQL for the database for simplicity and the application's distributed locking needs being solvable via code-level mutexes rather than native advisory locks. This keeps the stack simpler while maintaining full functionality for swing trading workloads.

Next Steps

Day 2: MySQL schema design with constraints and audit trails, plus state machine implementation with code-level mutexes.


Follow @therealkamba on X for regular updates. View all posts →