How slowdust18/civic_guardian works
Main Components (arranged left→right)
• Frontend (React SPA)
– Components: LoginPage, ComplaintPage, MapPage, AdminPage
– Bundler: npm/webpack
– Fetch layer: src/api.js
• Backend (FastAPI)
– Entry point: main.py
– Routers: admin, user, complaints, votes, autofillAi, resolved
– Business logic: crud.py, seed.py
– Models & schemas: models.py, schemas.py
– Migrations: Alembic (versions folder)
• Database & Storage
– PostgreSQL + PostGIS (database.py)
– Migration state: alembic.ini + env.py
– File store: /uploads (complaint images)
• External Services (optional)
– Map provider (e.g., Google Maps)
– AI autofill service (router: autofillAi)
Relationships & Data Flows
• Frontend → Backend
– HTTP(S) requests to endpoints (e.g., GET /complaints/all, POST /votes).
• Backend → Database
– SQLAlchemy ORM calls to PostgreSQL
– Alembic migrations update schema
• Backend → Storage
– File upload/download to local /uploads
• (Optional) Backend → External AI/Map service
Architectural Patterns
• Layered architecture (Presentation → API → Data)
• Router-based modularity (one router per feature)
• ORM + Migration toolchain (SQLAlchemy + Alembic)
• Separation of concerns:
– CRUD layer (crud.py)
– Schema validation (Pydantic schemas.py)
Technologies & Frameworks
• React (JSX, CSS modules)
• FastAPI (Starlette, Pydantic)
• PostgreSQL + PostGIS
• SQLAlchemy + Alembic
• Node.js / npm