# therealbill91/social_media_app architecture

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

- Interactive diagram: https://gitdiagram.com/therealbill91/social_media_app
- Repository: https://github.com/therealbill91/social_media_app

## Overview

##### Main Components

A. Frontend Layer:
- Client Application (Remix + TypeScript)
- UI Components
- Route Handlers
- Authentication Flow
- State Management
- API Integration

B. Backend Layer:
- ASP.NET Core API
- Controllers
- Services
- Data Access Layer
- Authentication/Authorization
- Email Service

C. External Services:
- Cloudflare Pages (Hosting/CDN)
- Email Service Provider
- External Authentication Providers

**┌─ Frontend (Remix + TypeScript) ─────────────────┐**
- UI Components (TailwindCSS)                  │
- Route Handlers                               │
- Authentication Flow                          │
- Form Handling (Conform)                      │
- ┘

**┌─ Backend (ASP.NET Core) ──────────────────────┐**
- Controllers                                │
- Auth                                    │
- Posts                                   │
- Comments                                │
- Friends                                 │
- Profiles                                │

- Services                                   │
- Authentication                          │
- Email                                   │
- User Management                         │
- Content Management                      │

- Middleware                                 │
- Rate Limiting                           │
- ┘

**┌─ Data Layer ────────────────────────────────┐**
- Entity Framework Core                    │
- Models                                   │
- Member                                │
- Post                                  │
- Comment                               │
- Friendship                            │
- Profile                               │
- Migrations                               │
- ┘

##### Connection Flows

- User requests → Frontend → Backend API
- API → Services → Data Layer
- Authentication flows
- External service interactions

##### Notes for Implementation

- Clear separation between frontend routes and backend controllers
- Security boundaries around authentication
- Where rate limiting occurs
- Email service integration points
- Demonstrate the social features (friends, posts, comments) flow

##### Deployment View

- Cloudflare Pages hosting
- API hosting
- Database hosting
- CDN distribution

Remember to maintain a balance between detail and clarity, focusing on the unique aspects of this social media platform, particularly its anti-doom scrolling features and social interaction components.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        FE[Frontend Application]
        UI[UI Components]
        RH[Route Handlers]
        AF[Authentication Flow]
        FH[Form Handling]
        
        FE --> UI
        FE --> RH
        FE --> AF
        FE --> FH
    end

    subgraph API
        direction TB
        BC[Backend Controllers]
        BS[Backend Services]
        RL[Rate Limiting]
        
        subgraph Controllers
            AC[Auth Controller]
            PC[Posts Controller]
            CC[Comments Controller]
            FC[Friends Controller]
            PRC[Profiles Controller]
        end
        
        subgraph Services
            AS[Auth Service]
            ES[Email Service]
            US[User Management]
            CS[Content Management]
        end
        
        BC --> BS
        RL --> BC
    end

    subgraph Data
        EF[Entity Framework Core]
        
        subgraph Models
            MM[Member Model]
            PM[Post Model]
            CM[Comment Model]
            FM[Friendship Model]
            PFM[Profile Model]
        end
        
        MG[Migrations]
        
        EF --> Models
        EF --> MG
    end

    subgraph External
        CFP[Cloudflare Pages]
        ESP[Email Provider]
        EAP[External Auth Providers]
    end

    %% Main Flow Connections
    Client --> API
    API --> Data
    API --> External

    %% Component Mappings
    click FE "https://github.com/TheRealBill91/social_media_app/tree/main/frontend/app/*"
    click UI "https://github.com/TheRealBill91/social_media_app/tree/main/frontend/app/components/ui/*"
    click RH "https://github.com/TheRealBill91/social_media_app/tree/main/frontend/app/routes/*"
    click AF "https://github.com/TheRealBill91/social_media_app/blob/main/frontend/app/utils/auth.server.ts"
    click FH "https://github.com/TheRealBill91/social_media_app/blob/main/frontend/app/components/Forms.tsx"
    click BC "https://github.com/TheRealBill91/social_media_app/tree/main/backend/Api/Controllers/*"
    click BS "https://github.com/TheRealBill91/social_media_app/tree/main/backend/Api/Services/*"
    click EF "https://github.com/TheRealBill91/social_media_app/blob/main/backend/Api/Data/dbContext.cs"
    click MG "https://github.com/TheRealBill91/social_media_app/tree/main/backend/Api/Data/Migrations/*"
    click Models "https://github.com/TheRealBill91/social_media_app/tree/main/backend/Api/Models/*"
    click ES "https://github.com/TheRealBill91/social_media_app/blob/main/backend/Api/Services/EmailSender.cs"
    click RL "https://github.com/TheRealBill91/social_media_app/tree/main/backend/Api/Middleware/RateLimiting/*"
    click AC "https://github.com/TheRealBill91/social_media_app/blob/main/backend/Api/Controllers/AuthController.cs"
    click AS "https://github.com/TheRealBill91/social_media_app/blob/main/backend/Api/Services/AuthService.cs"

    %% Styling
    classDef frontend fill:#a8d1ff
    classDef backend fill:#90EE90
    classDef data fill:#FFE5B4
    classDef external fill:#D3D3D3
    classDef security fill:#FFB6C1

    class FE,UI,RH,AF,FH frontend
    class BC,BS,RL,AC,PC,CC,FC,PRC,AS,ES,US,CS backend
    class EF,MM,PM,CM,FM,PFM,MG data
    class CFP,ESP,EAP external
    class AF,AS,RL security
```
