# coffree0123/tsmc-quick-parking architecture

> Architecture diagram of the GitHub repository coffree0123/tsmc-quick-parking, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/coffree0123/tsmc-quick-parking
- Repository: https://github.com/coffree0123/tsmc-quick-parking

## Overview

##### Project Type and Purpose
- This is a full-stack, web-based “quick parking” management system.
- Frontend: a React + TypeScript single-page application (served via Nginx).
- Backend: a Python (FastAPI) service with routers for users, vehicles, parking lots, parking sessions, and a dashboard.
- Data store: a relational database provisioned via Docker-Compose (SQL scripts for initialization and sample data).
- CI/CD: GitHub Actions triggers automatic deployment to Azure (static site for frontend, container for backend).

##### File Structure Analysis
A. Top-level
- .github/workflows: CI/CD pipelines for linting, building, delivering both frontend and backend.
- backend/: FastAPI service, Dockerfiles, Docker-Compose, SQL scripts, entrypoint scripts, src/ routers, utils, tests.
- frontend/: React app scaffolded via Create React App, tsconfig, ESLint, Nginx config, Dockerfile, package manifests, src/ components, pages, utils.
B. Backend micro-services style
- Modules under src/: users, vehicles, parkinglots, parking, dashboard.
- Constants, security, database connection, scripts to seed or clear records.
- docker-compose.yml orchestrates app + database containers.
C. Frontend
- Auth integration (authConfig.ts, AuthContext)
- Pages: Home, Dashboard, Parking Lot list/detail, Settings, Vehicle.
- Shared UI components, API wrapper (utils/api.ts), CSS styles, tests.
D. Deployment
- Dockerfiles for production (backend/Dockerfile.prod, frontend/Dockerfile + Nginx).
- GitHub Actions workflows for build/test and push to Azure.

##### Details to Capture
- The Docker-Compose service definitions (app, db)
- SQL init and seed steps in the database lifecycle
- Frontend’s Nginx reverse proxy to the SPA
- AuthContext → FastAPI’s security layer (JWT verification)
- Git branches & workflows triggering builds and deployments to Azure

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "CI/CD Pipeline"
        GH["GitHub Actions"]:::cicd
        Azure["Azure (Web App & ACR)"]:::infra
        GH -->|"build & push"| Azure
    end

    User["User (Browser)"]:::user

    subgraph "Frontend Tier"
        Nginx["Nginx Reverse Proxy"]:::frontend
        SPA["React SPA"]:::frontend
        User -->|"HTTP(S)"| Nginx
        Nginx --> SPA
    end

    SPA -->|"REST API Calls (Axios)"| API["FastAPI Service"]:::backend

    subgraph "Backend Tier"
        API
        subgraph "FastAPI Routers"
            U["Users Router"]:::backend
            V["Vehicles Router"]:::backend
            PL["ParkingLots Router"]:::backend
            PS["ParkingSessions Router"]:::backend
            DBR["Dashboard Router"]:::backend
        end
        API --> U & V & PL & PS & DBR
        API -->|"JWT Auth"| Sec["Security Layer"]:::backend
        Sec -.->|verify tokens| U & V & PL & PS & DBR
    end

    API -->|"SQL Queries"| DB["PostgreSQL DB"]:::database

    classDef cicd fill:#f5a623,stroke:#333,stroke-width:1px
    classDef infra fill:#f8e71c,stroke:#333,stroke-width:1px
    classDef user fill:#9B9B9B,stroke:#333,stroke-width:1px
    classDef frontend fill:#4A90E2,stroke:#333,stroke-width:1px
    classDef backend fill:#50E3C2,stroke:#333,stroke-width:1px
    classDef database fill:#7ED321,stroke:#333,stroke-width:1px

    click GH "https://github.com/coffree0123/tsmc-quick-parking/blob/main/.github/workflows/backend.yml"
    click GH "https://github.com/coffree0123/tsmc-quick-parking/blob/main/.github/workflows/backend_delivery.yml"
    click GH "https://github.com/coffree0123/tsmc-quick-parking/blob/main/.github/workflows/frontend_lint.yml"
    click GH "https://github.com/coffree0123/tsmc-quick-parking/blob/main/.github/workflows/frontend_delivery.yaml"
    click SPA "https://github.com/coffree0123/tsmc-quick-parking/tree/main/frontend/"
    click Nginx "https://github.com/coffree0123/tsmc-quick-parking/blob/main/frontend/nginx/nginx.conf"
    click API "https://github.com/coffree0123/tsmc-quick-parking/blob/main/backend/src/main.py"
    click U "https://github.com/coffree0123/tsmc-quick-parking/blob/main/backend/src/users/router.py"
    click V "https://github.com/coffree0123/tsmc-quick-parking/blob/main/backend/src/vehicles/router.py"
    click PL "https://github.com/coffree0123/tsmc-quick-parking/blob/main/backend/src/parkinglots/router.py"
    click PS "https://github.com/coffree0123/tsmc-quick-parking/blob/main/backend/src/parking/router.py"
    click DBR "https://github.com/coffree0123/tsmc-quick-parking/blob/main/backend/src/dashboard/router.py"
    click Sec "https://github.com/coffree0123/tsmc-quick-parking/blob/main/backend/src/security.py"
    click DB "https://github.com/coffree0123/tsmc-quick-parking/blob/main/backend/docker/db/init.sql"
```
