# yoarpit/socium architecture

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

- Interactive diagram: https://gitdiagram.com/yoarpit/socium
- Repository: https://github.com/yoarpit/socium

## Overview

##### Project Type and Purpose
- This is a full-stack social media application (“Socium”) with a React.js frontend (built with Vite) and a FastAPI backend.
- The frontend handles user interactions, routing, and state, while the backend exposes RESTful endpoints for authentication, posts, comments, likes, notifications, and user management.

##### File-Structure Analysis
- Top-level “frontend” and “backend” directories clearly separate the UI from the API.
- The backend follows a layered structure:
- app/main.py – the FastAPI app entrypoint
- app/api/v1 – versioned routers for each resource (auth, post, comment, likes, notification, users)
- app/services – business logic for each domain area
- app/db – database models/session setup (SQLAlchemy)
- app/schemas – Pydantic DTOs for request/response validation
- app/core, app/utils, app/configure – cross-cutting concerns (security, email, media handling)
- No obvious microservices—this is a monolithic API with clear logical separation of concerns.

##### README Insights
- Confirms the tech stack: FastAPI for backend APIs, React.js for frontend.
- Intended as a simple social media platform, so core components are user authentication, post management, interactions (likes/comments), and notifications.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client and Frontend
    Browser["Web Browser"]:::external
    subgraph "Frontend"
        VITE["vite.config.js"]:::frontend
        MAIN["main.jsx"]:::frontend
        APP["App.jsx"]:::frontend
    end
    Browser --> MAIN
    VITE --> MAIN
    MAIN --> APP
    APP -->|"HTTP JSON"| API

    %% Backend Layers
    subgraph "Backend"
        subgraph "API / Router Layer"
            API["api.py"]:::api
            AUTH_EP["auth.py"]:::api
            POST_EP["post.py"]:::api
            COMMENT_EP["comment.py"]:::api
            LIKES_EP["likes.py"]:::api
            NOTIF_EP["notification.py"]:::api
            USERS_EP["users.py"]:::api
        end

        subgraph "Service Layer"
            AuthService["AuthService"]:::service
            PostService["PostService"]:::service
            CommentService["CommentService"]:::service
            LikesService["LikesService"]:::service
            NotificationService["NotificationService"]:::service
            UserService["UserService"]:::service
        end

        subgraph "Data Layer"
            Models["base.py"]:::data
            Session["session.py"]:::data
            DB["Database (PostgreSQL)"]:::data
        end

        subgraph "Utilities"
            Security["security.py"]:::util
            EmailUtil["email_utility.py"]:::util
            MediaUtil["media_utils.py"]:::util
        end
    end

    %% API router to endpoints
    API --> AUTH_EP
    API --> POST_EP
    API --> COMMENT_EP
    API --> LIKES_EP
    API --> NOTIF_EP
    API --> USERS_EP

    %% Endpoint to Services
    AUTH_EP --> AuthService
    POST_EP --> PostService
    COMMENT_EP --> CommentService
    LIKES_EP --> LikesService
    NOTIF_EP --> NotificationService
    USERS_EP --> UserService

    %% Services to Data Layer
    AuthService --> Session
    AuthService --> Models
    PostService --> Session
    PostService --> Models
    CommentService --> Session
    CommentService --> Models
    LikesService --> Session
    LikesService --> Models
    NotificationService --> Session
    NotificationService --> Models
    UserService --> Session
    UserService --> Models

    %% Data Layer to Database
    Session --> DB

    %% Utilities Usage
    AUTH_EP --> Security
    PostService --> MediaUtil
    NotificationService --> EmailUtil
    EmailUtil -.->|"SMTP"| ExternalEmail

    %% External Services
    ExternalEmail["External Email Service"]:::external

    %% Click Events
    click VITE "https://github.com/yoarpit/socium/blob/main/frontend/vite.config.js"
    click MAIN "https://github.com/yoarpit/socium/blob/main/frontend/src/main.jsx"
    click APP "https://github.com/yoarpit/socium/blob/main/frontend/src/App.jsx"
    click API "https://github.com/yoarpit/socium/blob/main/backend/app/api/v1/api.py"
    click AUTH_EP "https://github.com/yoarpit/socium/blob/main/backend/app/api/v1/endpoints/auth.py"
    click POST_EP "https://github.com/yoarpit/socium/blob/main/backend/app/api/v1/endpoints/post.py"
    click COMMENT_EP "https://github.com/yoarpit/socium/blob/main/backend/app/api/v1/endpoints/comment.py"
    click LIKES_EP "https://github.com/yoarpit/socium/blob/main/backend/app/api/v1/endpoints/likes.py"
    click NOTIF_EP "https://github.com/yoarpit/socium/blob/main/backend/app/api/v1/endpoints/notification.py"
    click USERS_EP "https://github.com/yoarpit/socium/blob/main/backend/app/api/v1/endpoints/users.py"
    click AuthService "https://github.com/yoarpit/socium/blob/main/backend/app/services/user_servises.py"
    click PostService "https://github.com/yoarpit/socium/blob/main/backend/app/services/post_services.py"
    click NotificationService "https://github.com/yoarpit/socium/blob/main/backend/app/services/notification.py"
    click Models "https://github.com/yoarpit/socium/blob/main/backend/app/db/base.py"
    click Session "https://github.com/yoarpit/socium/blob/main/backend/app/db/session.py"
    click Security "https://github.com/yoarpit/socium/blob/main/backend/app/core/security.py"
    click EmailUtil "https://github.com/yoarpit/socium/blob/main/backend/app/configure/email_utility.py"
    click MediaUtil "https://github.com/yoarpit/socium/blob/main/backend/app/utils/media_utils.py"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#3399ff,color:#000;
    classDef api fill:#e6f7e6,stroke:#33cc33,color:#000;
    classDef service fill:#e6f7e6,stroke:#33cc33,color:#000;
    classDef data fill:#fff0e6,stroke:#ff9933,color:#000;
    classDef util fill:#f3e6ff,stroke:#9933ff,color:#000;
    classDef external fill:#f2f2f2,stroke:#999,color:#000;
```
