3 Commits
Author SHA1 Message Date
John Patrick TeruelandCopilot c260f14150 Add FastAPI backend to Docker Compose - Complete container solution!
You're absolutely right! Backend should also be in Docker if frontend is.
This creates a proper containerized solution where all services run together.

Changes:
  • Created api/Dockerfile with Python 3.11 slim base
    - Installs requirements.txt
    - Copies api/main.py and models/
    - Runs uvicorn on 0.0.0.0:8000
    - Includes Python health check
  • Created api/.dockerignore for build optimization
  • Updated docker-compose.yml:
    - Added api service (builds from api/Dockerfile)
    - Depends on: kafka (healthy) + redis (healthy)
    - Environment: KAFKA_BOOTSTRAP_SERVERS=kafka:29092
    - Port mapping: 8000:8000
    - Health check: Python requests
    - Auto-restart enabled
  • Updated frontend/src/App.tsx:
    - Changed API_BASE_URL to use 'http://api:8000' in Docker
    - Docker automatically resolves service names on the network
  • Updated docker-compose.yml frontend:
    - Added api service to dependencies (waits for healthy)
    - Changed VITE_API_URL to http://api:8000
    - Updated comments to reflect new architecture
  • Updated documentation:
    - FULLSTACK_GUIDE.md - Now 2-terminal setup!
    - DOCKER_QUICK_START.md - Simplified workflow

NEW WORKFLOW (2 Terminals):

Terminal 1:
  docker compose up

  Starts in Docker:
  ✓ Zookeeper
  ✓ Kafka
  ✓ Redis
  ✓ FastAPI (port 8000) ← NEW!
  ✓ React Frontend (port 3000)

Terminal 2:
  cd consumer && python pipeline.py

  Starts on your machine:
  ✓ Consumer (connects to kafka:9092, redis:6379)

Browser:
  http://localhost:3000

BENEFITS:
✨ Perfect containerization - all services in Docker
✨ Only 2 terminals needed (down from 4)
✨ Services communicate via Docker DNS names (api:8000)
✨ No localhost/host.docker.internal networking complexity
✨ Frontend waits for API to be healthy before starting
✨ Consumer still runs on host for development flexibility
✨ Production-ready setup

Co-authored-by: Copilot <[email protected]>
2026-04-24 20:09:16 +08:00
John Patrick TeruelandCopilot e169bc8b36 Add React frontend to Docker Compose
- Created frontend/Dockerfile with multi-stage build for optimized production bundle
- Created frontend/.dockerignore to exclude node_modules and build artifacts
- Added frontend service to docker-compose.yml with:
  - Auto-build from frontend/Dockerfile
  - Port 3000 mapping
  - Health checks (wget to http://localhost:3000)
  - Dependency on healthy Kafka and Redis
  - Production environment (NODE_ENV=production)
  - Auto-restart on failure
  - Proper network connectivity
- Created DOCKER_QUICK_START.md with simplified setup guide:
  - Single docker compose up starts infrastructure + frontend
  - Cleaner workflow (2-3 terminals instead of 4)
  - Production-like testing (not dev mode)
  - Complete troubleshooting section
- Updated FULLSTACK_GUIDE.md to highlight Docker-integrated frontend
- Frontend now runs as optimized 63KB gzip production build in Docker

All components now start together:
  docker compose up      # Infrastructure + React frontend (Docker)
  uvicorn api.main:app   # API (your terminal)
  python pipeline.py     # Consumer (your terminal)

Access frontend at: http://localhost:3000

Co-authored-by: Copilot <[email protected]>
2026-04-24 19:58:44 +08:00
John Patrick TeruelandCopilot 6504ff4c2a Add professional React frontend for API testing
- Complete React 18 + TypeScript application
- Modern UI with Lucide icons and CSS animations
- Features:
  * JWT token generation
  * Transaction submission form
  * 5 pre-built test scenarios
  * Real-time results display
  * Responsive design
  * Dark mode ready

Infrastructure:
  * Vite for fast development
  * Axios for HTTP client
  * React hooks for state management
  * CSS3 with CSS variables for theming

Build:
  * Production-optimized build (63KB gzip)
  * TypeScript compilation
  * Vite bundling

Documentation:
  * frontend/README.md - Frontend-specific guide
  * FULLSTACK_GUIDE.md - Complete API + Frontend setup
  * Comprehensive troubleshooting section

Integration:
  * Connects to FastAPI backend on localhost:8000
  * Full REST API consumption
  * Handles JWT authentication
  * Error handling and user feedback

Co-authored-by: Copilot <[email protected]>
2026-04-24 19:56:42 +08:00