# guru1802/patriot-parker architecture

> Architecture diagram of the GitHub repository guru1802/patriot-parker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/guru1802/patriot-parker
- Repository: https://github.com/guru1802/patriot-parker

## Overview

##### Project type and purpose
- This is a full-stack, mobile-friendly web application (“Patriot Parker”) that enables real-time parking spot lookups, check-in/check-out, and user authentication for the George Mason University community.
- The backend is a Node.js/Express REST API with a SQL database. The frontend is a React.js single-page application optimized for mobile.

##### File structure
- Root folder:
– app.js, userauth.js, spotreserve.js, sum.js → Express application entry point and route modules
– database/Patriot_Parker.sql → SQL schema and seed data
- Frontend code lives under “frontend/my-app” (duplicated under “my-app” but assume one working React project):
– public/ → static assets and index.html
– src/ → React components (pages, Modal, UserContext), styling (CSS), tests, and app bootstrap
- Tests: app.test.js, sum.test.js, plus React tests under src/*.
- No separate “services” folder, but route modules (userauth.js, spotreserve.js) implement controller logic.

##### README for additional insights
- Confirms tech stack: Node.js, Express, PostgreSQL, React.
- Describes core features: real-time availability, check-in/out, filtering, user auth, responsive design.
- Mentions RESTful API, database tables for users and lots.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    Browser["Web Browser\n(Mobile/Desktop)"]:::frontend

    %% Presentation Layer
    subgraph "Presentation Layer"
        style PresentationLayer fill:none,stroke:none
        IndexHTML["index.html"]:::frontend
        SPA["React SPA\n(UI Components)"]:::frontend
        SRC["UI Components & Pages"]:::frontend
        IndexJS["index.js"]:::frontend
        UserContext["UserContext.js"]:::frontend
        Modal["Modal.js"]:::frontend
        Home["Home.js"]:::frontend
        Registration["Registration.js"]:::frontend
        UserCheck["UserCheck.js"]:::frontend
    end

    %% Application Layer
    subgraph "Application Layer"
        style ApplicationLayer fill:none,stroke:none
        API["Express API Server"]:::backend
        UserAuth["userauth.js\n(User Auth Routes)"]:::backend
        SpotReserve["spotreserve.js\n(Parking Spot Routes)"]:::backend
        SumUtil["sum.js\n(Utility Endpoint)"]:::backend
    end

    %% Data Layer
    subgraph "Data Layer"
        style DataLayer fill:none,stroke:none
        DB["PostgreSQL Database"]:::database
        Schema["Patriot_Parker.sql"]:::database
    end

    %% Connections
    API -->|"Serves index.html"| IndexHTML
    Browser -->|"Loads SPA"| SPA
    SPA -->|"POST /api/auth/login\nPOST /api/auth/register"| UserAuth
    SPA -->|"GET /api/spots\nGET /api/spots?lot={lot}"| SpotReserve
    SPA -->|"POST /api/spots/checkin\nPOST /api/spots/checkout"| SpotReserve
    SPA -->|"GET /api/sum?values=[…]"| SumUtil

    UserAuth -->|"SQL Queries"| DB
    SpotReserve -->|"SQL Queries"| DB
    SumUtil -->|"No DB Interaction"| SumUtil

    DB -->|"Query Results"| UserAuth
    DB -->|"Query Results"| SpotReserve

    %% Click Events
    click SRC "https://github.com/guru1802/patriot-parker/tree/main/frontend/my-app/src"
    click IndexJS "https://github.com/guru1802/patriot-parker/blob/main/frontend/my-app/src/index.js"
    click UserContext "https://github.com/guru1802/patriot-parker/blob/main/frontend/my-app/src/components/UserContext.js"
    click Modal "https://github.com/guru1802/patriot-parker/blob/main/frontend/my-app/src/components/Modal.js"
    click Home "https://github.com/guru1802/patriot-parker/blob/main/frontend/my-app/src/pages/Home.js"
    click Registration "https://github.com/guru1802/patriot-parker/blob/main/frontend/my-app/src/pages/Registration.js"
    click UserCheck "https://github.com/guru1802/patriot-parker/blob/main/frontend/my-app/src/pages/UserCheck.js"
    click IndexHTML "https://github.com/guru1802/patriot-parker/blob/main/frontend/my-app/public/index.html"
    click API "https://github.com/guru1802/patriot-parker/blob/main/app.js"
    click UserAuth "https://github.com/guru1802/patriot-parker/blob/main/userauth.js"
    click SpotReserve "https://github.com/guru1802/patriot-parker/blob/main/spotreserve.js"
    click SumUtil "https://github.com/guru1802/patriot-parker/blob/main/sum.js"
    click Schema "https://github.com/guru1802/patriot-parker/blob/main/database/Patriot_Parker.sql"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef backend fill:#98FB98,stroke:#333,stroke-width:1px
    classDef database fill:#FFD580,stroke:#333,stroke-width:1px
```
