# jayd-h/unisphere architecture

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

- Interactive diagram: https://gitdiagram.com/jayd-h/unisphere
- Repository: https://github.com/jayd-h/unisphere

## Overview

##### Main Components

a. Client-Side (Frontend):
- React Application (TypeScript)
- Component Layer
- Authentication Components
- Feed Components (Home/Events)
- Society Management
- User Settings
- API Integration Layer
- Context Management (UserContext)

b. Server-Side (Backend):
- Node.js/Express Server (TypeScript)
- Controller Layer
- Middleware Layer
- Routes Layer
- Data Access Layer

c. Database:
- SQL Database (as evidenced by .sql files)
- Entity Relationships

**[Client Tier]**
- ↕️ HTTP/REST
**[Server Tier]**
- ↕️
**[Database Tier]**

##### Detailed Component Breakdown

Frontend Layer:
**[Pages] → [Components] → [API Services]**
- ↓          ↓             ↓
**[Context] → [Types] → [HTTP Client]**

Backend Layer:
**[Routes] → [Middleware] → [Controllers]**
- ↓
- [Data Access]
- ↓
- [Database]

##### Key Relationships to Highlight

- User Authentication Flow
- Society Management Flow
- Event Management Flow
- Post/Reply System Flow

##### Implementation Details

a. Frontend Architecture:
**[React/TypeScript App]**
- ↓
**[Component Structure]**
- Pages
- Shared Components
- Context Providers
- ↓
**[API Integration]**

b. Backend Architecture:
**[Express Server]**
- ↓
**[Route Handlers]**
- ↓
**[Controllers]**
- ↓
**[Data Access Layer]**
- ↓
**[Database Models]**

##### Additional Elements

- Error handling flows
- Caching mechanisms (if any)
- Authentication boundaries
- Real-time features (if present)

For this specific social platform, emphasize the relationship between users, societies, and events, as these are the core features of the application according to the README and file structure.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        App["App"]:::frontend
        
        subgraph Components
            AuthComp["Authentication Components"]:::frontend
            FeedComp["Feed Components"]:::frontend
            SocietyComp["Society Management"]:::frontend
            UserComp["User Settings"]:::frontend
            ProtectedRoute["Protected Route"]:::frontend
        end
        
        subgraph Integration
            APILayer["API Integration"]:::frontend
            TypeDefs["Type Definitions"]:::frontend
            UserCtx["User Context"]:::frontend
        end
    end
    
    subgraph Server
        subgraph Routes
            AuthRoutes["Auth Routes"]:::backend
            APIRoutes["API Routes"]:::backend
        end
        
        subgraph Middleware
            AuthMW["Auth Middleware"]:::security
            ValidMW["Validation Middleware"]:::security
        end
        
        subgraph Controllers
            AuthController["Auth Controller"]:::backend
            DataController["Data Controller"]:::backend
        end
        
        DAL["Data Access Layer"]:::backend
    end
    
    subgraph Database
        SQL["SQL Database"]:::database
    end
    
    %% Relationships
    App --> Components
    App --> Integration
    
    APILayer --> AuthRoutes
    APILayer --> APIRoutes
    
    AuthRoutes --> AuthMW
    APIRoutes --> AuthMW
    AuthMW --> ValidMW
    
    ValidMW --> AuthController
    ValidMW --> DataController
    
    AuthController --> DAL
    DataController --> DAL
    
    DAL --> SQL
    
    %% Click Events
    click App "https://github.com/Jayd-H/UniSphere/blob/main/Client/src/App.tsx"
    click AuthComp "https://github.com/Jayd-H/UniSphere/tree/main/Client/src/Components/LoginRegister/"
    click ProtectedRoute "https://github.com/Jayd-H/UniSphere/blob/main/Client/src/Components/ProtectedRoute.tsx"
    click FeedComp "https://github.com/Jayd-H/UniSphere/tree/main/Client/src/Components/Home/Feed/"
    click SocietyComp "https://github.com/Jayd-H/UniSphere/tree/main/Client/src/Components/Societies/"
    click UserComp "https://github.com/Jayd-H/UniSphere/tree/main/Client/src/Components/UserSettings/"
    click APILayer "https://github.com/Jayd-H/UniSphere/tree/main/Client/src/api/"
    click AuthController "https://github.com/Jayd-H/UniSphere/blob/main/Server/src/Controllers/authController.ts"
    click AuthMW "https://github.com/Jayd-H/UniSphere/blob/main/Server/src/Middleware/authMiddleware.ts"
    click ValidMW "https://github.com/Jayd-H/UniSphere/blob/main/Server/src/Middleware/validationMiddleware.ts"
    click AuthRoutes "https://github.com/Jayd-H/UniSphere/blob/main/Server/src/Routes/authRoutes.ts"
    click APIRoutes "https://github.com/Jayd-H/UniSphere/tree/main/Server/src/Routes/"
    click DAL "https://github.com/Jayd-H/UniSphere/tree/main/Server/src/Data/"
    click SQL "https://github.com/Jayd-H/UniSphere/blob/main/Database/UniSphere.sql"
    click UserCtx "https://github.com/Jayd-H/UniSphere/blob/main/Client/src/UserContext.tsx"
    click TypeDefs "https://github.com/Jayd-H/UniSphere/tree/main/Client/src/types/"
    
    %% Styles
    classDef frontend fill:#2374ab
    classDef backend fill:#2a9d8f
    classDef security fill:#e63946
    classDef database fill:#f4a261
    
    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        Backend["Backend Service"]:::backend
        Security["Security Component"]:::security
        Database["Database Component"]:::database
    end
```
