# progi-hoodclassics/hoodclassics architecture

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

- Interactive diagram: https://gitdiagram.com/progi-hoodclassics/hoodclassics
- Repository: https://github.com/progi-hoodclassics/hoodclassics

## Overview

##### Main System Components

The system should be represented as a modern full-stack application with these primary components:

a) Frontend Layer (React + TypeScript):
- User Interface Components (/frontend/src/components)
- Page Components (/frontend/src/pages)
- Authentication Utilities (/frontend/src/utils/auth.ts)

b) Backend Layer (Spring Framework):
- REST Controllers (/backend/src/main/java/hoodclassics/opp/rest)
- Security Configuration (/backend/src/main/java/hoodclassics/opp/sec)
- Service Layer (/backend/src/main/java/hoodclassics/opp/service)
- Data Access Layer (/backend/src/main/java/hoodclassics/opp/dao)
- Domain Models (/backend/src/main/java/hoodclassics/opp/domain)

##### Key Architectural Elements

a) External Services:
- OAuth 2.0 Authentication (Google Sign-in)
- Service Integration (for interactive map functionality)

b) Security Layer:
- Authentication Handlers
- Password Encoding
- OAuth2 Configuration
- Web Security Config

**[Client Layer]**

**[Frontend (React + TypeScript)]**

**[API Gateway/Load Balancer]**

**[Backend (Spring)]**

**[Data Layer]**

##### Component Interactions

- User Authentication Flow (both OAuth and email/password)
- Data Flow (pin creation, retrieval)
- User Registration Process
- Content Management Flow

##### Deployment Architecture

Deployment on Render.com with:
- Frontend deployment
- Backend deployment
- Database connection
- External service connections

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Web Browser"]
    end

    subgraph Frontend
        UI["UI Components"]:::frontend
        Pages["Page Components"]:::frontend
        Auth["Authentication Utils"]:::frontend
        MapInterface["Map Interface"]:::frontend
    end

    subgraph API
        LoadBalancer["API Gateway/Load Balancer"]:::api
    end

    subgraph Backend
        subgraph Controllers
            RestAPI["REST Controllers"]:::backend
            RegController["Registration Controller"]:::backend
        end

        subgraph Security
            WebSecurity["Web Security Config"]:::security
            OAuth["OAuth Service"]:::security
            PassEncoder["Password Encoder"]:::security
        end

        subgraph Core
            Services["Service Layer"]:::backend
            DAL["Data Access Layer"]:::backend
            Domain["Domain Models"]:::backend
        end
    end

    subgraph External
        GoogleAuth["Google OAuth 2.0"]:::external
        MapService["Map Service"]:::external
    end

    subgraph Storage
        Database[(Database)]:::storage
    end

    subgraph Deployment
        RenderFrontend["Render Frontend"]:::deploy
        RenderBackend["Render Backend"]:::deploy
    end

    %% Connections
    Browser --> UI
    UI --> Pages
    Pages --> Auth
    Pages --> MapInterface
    UI --> LoadBalancer
    LoadBalancer --> RestAPI
    RestAPI --> RegController
    RestAPI --> WebSecurity
    WebSecurity --> OAuth
    WebSecurity --> PassEncoder
    OAuth --> GoogleAuth
    RegController --> Services
    Services --> DAL
    DAL --> Domain
    DAL --> Database
    MapInterface --> MapService

    %% Click Events
    click UI "https://github.com/PROGI-HoodClassics/HoodClassics/tree/main/frontend/src/components/"
    click Pages "https://github.com/PROGI-HoodClassics/HoodClassics/tree/main/frontend/src/pages/"
    click Auth "https://github.com/PROGI-HoodClassics/HoodClassics/blob/main/frontend/src/utils/auth.ts"
    click RestAPI "https://github.com/PROGI-HoodClassics/HoodClassics/tree/main/backend/src/main/java/hoodclassics/opp/rest/"
    click WebSecurity "https://github.com/PROGI-HoodClassics/HoodClassics/blob/main/backend/src/main/java/hoodclassics/opp/sec/WebSecurityConfig.java"
    click OAuth "https://github.com/PROGI-HoodClassics/HoodClassics/blob/main/backend/src/main/java/hoodclassics/opp/sec/OAuth2Service.java"
    click PassEncoder "https://github.com/PROGI-HoodClassics/HoodClassics/blob/main/backend/src/main/java/hoodclassics/opp/sec/PasswordEncoderConfig.java"
    click Services "https://github.com/PROGI-HoodClassics/HoodClassics/tree/main/backend/src/main/java/hoodclassics/opp/service/"
    click DAL "https://github.com/PROGI-HoodClassics/HoodClassics/tree/main/backend/src/main/java/hoodclassics/opp/dao/"
    click Domain "https://github.com/PROGI-HoodClassics/HoodClassics/tree/main/backend/src/main/java/hoodclassics/opp/domain/"
    click RegController "https://github.com/PROGI-HoodClassics/HoodClassics/blob/main/backend/src/main/java/hoodclassics/opp/rest/RegistrationController.java"
    click MapInterface "https://github.com/PROGI-HoodClassics/HoodClassics/blob/main/frontend/src/pages/MapPage.tsx"
    click RenderFrontend "https://github.com/PROGI-HoodClassics/HoodClassics/blob/main/.github/workflows/build-and-push-frontend.yml"
    click RenderBackend "https://github.com/PROGI-HoodClassics/HoodClassics/blob/main/.github/workflows/build-and-push-backend.yml"

    %% Styles
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef security fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#9b59b6,stroke:#8e44ad,color:white
    classDef storage fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef api fill:#e74c3c,stroke:#c0392b,color:white
    classDef deploy fill:#1abc9c,stroke:#16a085,color:white
```
