How abel-asfaw/photography-portfolio works
Project Type and Purpose
• This is a full-stack web application (“Photography Portfolio”) whose primary function is to let authenticated users upload, view, and delete photos.
• Frontend: React + TypeScript
• Backend: FastAPI (Python)
• Storage: Amazon S3 (for binary assets) and PostgreSQL (for metadata)
• Authentication: Auth0
• Deployed via Docker containers orchestrated with docker-compose and fronted by Nginx
File Structure Analysis
• Top-level “api” folder: FastAPI service
• src/main.py – entrypoint (uvicorn)
• routers/photos.py – upload/retrieve/delete endpoints
• config.py / database.py / models.py / schemas.py – DB & S3 configuration
• Dockerfile & .dockerignore
• Top-level “client” folder: React application
• src/App.tsx, components/, hooks/, api/ – UI, API client, queries
• package.json, tsconfig.json, Dockerfile, .dockerignore
• public/index.html, assets/images
• Deployment files
• docker-compose.yaml – defines containers + network
• default.conf – Nginx reverse-proxy config
• .prettierignore, .gitignore, etc.
Key Architectural Insights from README
• Single-host, containerized stack accessible at localhost:3005
• Auth0 protects upload/delete routes on both client and server
• External services: S3 bucket (photo storage), Auth0 (OAuth/JWT), PostgreSQL (metadata)
Main Components
a. User’s Web Browser (React Frontend)
b. Nginx Reverse Proxy (listening on 3005)
c. FastAPI Backend Service
d. PostgreSQL Database
e. Amazon S3 Bucket
f. Auth0 Identity Provider
Relationships & Data Flows
• Browser → (HTTPS) → Nginx
• Static assets (React JS/CSS) served directly from client container or via Nginx
• API calls (prefixed /api) forwarded to FastAPI
• React → Auth0
• Redirects for login, receives JWT
• React → FastAPI
• JWT Bearer token in Authorization header
• Endpoints: GET /photos, POST /photos, DELETE /photos
• FastAPI → PostgreSQL
• CRUD on photo metadata
• FastAPI → S3
• Upload binary data, generate presigned URLs for GET
• FastAPI → Auth0
• Optionally to verify tokens (JWKS endpoint)
Architectural Patterns & Principles
• Container-per-component pattern via Docker Compose
• API Gateway pattern (Nginx as reverse proxy)
• Layered architecture:
• Presentation layer (React)
• API layer (FastAPI routers, schemas)
• Data layer (PostgreSQL, S3)
• Secure by design: JWT authentication enforced at both client and server