How randroids-dojo/typescript-and-python-bootstrap works
Project Type and Purpose
• This is a *full-stack web application template* with separate authentication, API, and UI layers.
• Purpose: Provide user registration/login (Better Auth), profile management, and a shared counter feature.
File Structure
• Top-level directories:
• frontend/ (React TS + Vite + Tailwind)
• auth-service/ (Node.js Better Auth service)
• backend/ (Python FastAPI REST API)
• nginx/ (reverse-proxy config)
• Orchestration: docker-compose.yml & docker-compose.prod.yml
• Supporting infra: PostgreSQL & Redis (implied by README), .env.example for configs
README for Key Insights
• Tech Stack: React → Nginx → Node.js Auth → FastAPI → PostgreSQL & Redis
• All services containerized; single entry point (Nginx) unifies ports
• Docker Compose for dev/prod, Azure readiness
Main Components and Their Interactions
a. User (Browser)
• Loads the React SPA (served as static assets via Nginx)
• Calls REST endpoints for login, signup, profile, counter
b. Nginx Reverse Proxy
• Listens on port 80/443
• Routes “/auth”→Auth Service, “/api”→FastAPI backend, “/“→Static frontend
c. Frontend Service (React + Vite)
• Exposes static files (index.html, compiled JS/CSS)
• Contains auth-client.ts to talk to Auth Service
• Contains api.ts to call FastAPI endpoints
d. Auth Service (Node.js Better Auth)
• Handles /auth/signin, signup, session
• Uses secure cookies, stores sessions in Redis (cache)
• Persists user records in PostgreSQL
e. Backend API (FastAPI)
• Endpoints: /api/health, /api/user, /api/counter
• Enforces session-based auth (reads cookie, validates with Auth Service or Redis)
• Reads/writes PostgreSQL (user_profile), Redis (counter cache?)
f. Data Stores
• PostgreSQL: user_profiles, counters
• Redis: session store, potential cache for counter
g. Docker Compose
• Defines and networks all containers: frontend, auth-service, backend, postgres, redis, nginx
• Shared Docker network for inter-service communication
Architectural Patterns and Design Principles
• API Gateway pattern (Nginx as single ingress)
• Separation of concerns: UI, Auth microservice, API microservice, Data stores
• Session-based authentication with secure cookies
• Container-based isolation and orchestration
• Modular code structure (frontend/src/components, backend/app/routers/models)
Don’t Overthink – Maximize Modular Components
• Every service: Docker Compose, .env, code‐review artifacts (can be omitted if not part of runtime)