# nikhilpatel9/blogosphere architecture

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

- Interactive diagram: https://gitdiagram.com/nikhilpatel9/blogosphere
- Repository: https://github.com/nikhilpatel9/blogosphere

## Overview

##### Project type and purpose
- This is a full-stack blogging platform (“BlogoSphare”) with a Node/Express/MongoDB backend and a React-based frontend.
- Users can sign up, log in (with OAuth via Firebase), create and consume posts, comment, contact, and receive notifications. An admin dashboard provides management endpoints.

##### File structure
- Top-level folders:
- api/ – Express app organized in MVC style (controllers, models, routes, utils)
- clint/ – React client app (JSX/Vite) plus a nested “BlogoSphare” folder (TypeScript CRA)
- api/ highlights:
- api/index.js – Express entrypoint
- api/models/*.model.js – Mongoose schemas (User, Post, Comment, Contact, Notification, Count)
- api/controllers/*.controller.js – Request handlers
- api/routes/*.route.js – Route definitions
- api/utils – Error handling, user verification middleware
- clint/ highlights:
- src/ – React components, pages, Redux store, firebase.js integration
- components/ – Reusable UI: PostCard, CommentSection, Dashboard widgets, PrivateRoute, ThemeProvider
- pages/ – Route targets (Home, SignIn, SignUp, Dashboard, CreatePost, etc.)
- redux/ – Global state slices for user and theme
- public/index.html – Single-page container
- tailwind.config.js, postcss.config.js – Styling

##### README
- Confirms the platform’s purpose (create/share/discover content).
- Shows user and admin dashboard screenshots.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Side
    subgraph "Client / React SPA"
        direction TB
        CR["/ (Browser UI)"]:::frontend
        PR["Pages & Routes\n(clint/src/pages/)"]:::frontend
        SC["Shared Components\n(clint/src/components/)"]:::frontend
        SM["State Management\n(clint/src/redux/store.js)"]:::frontend
        US["UserSlice\n(clint/src/redux/user/userSlice.js)"]:::frontend
        TS["ThemeSlice\n(clint/src/redux/theme/themeSlice.js)"]:::frontend
        PRC["PrivateRoute.jsx"]:::frontend
        OARC["OnlyAdminPrivateRoute.jsx"]:::frontend
        OAU["OAuth.jsx"]:::frontend
        FIB["firebase.js"]:::frontend
        TC["tailwind.config.js"]:::config
        PC["postcss.config.js"]:::config

        CR -->|navigates to| PR
        PR -->|uses| SC
        SC -->|dispatches actions to| SM
        SM --> US
        SM --> TS
        PR --> PRC
        PR --> OARC
        SC --> OAU
        SC --> FIB
    end

    %% Server Side
    subgraph "Server / Express API"
        direction TB
        EP["Express Entrypoint\n(api/index.js)"]:::backend
        MWAuth["verifyUser Middleware\n(api/utills/verifyUser.js)"]:::backend
        MWErr["Error Middleware\n(api/utills/error.js)"]:::backend
        AR["Routes\n(api/routes/)"]:::backend
        CT["Controllers\n(api/controllers/)"]:::backend
        MD["Models\n(api/models/)"]:::backend
        EP --> MWAuth
        EP --> MWErr
        MWAuth --> AR
        MWErr --> AR
        AR --> CT
        CT --> MD
    end

    %% External Services & DB
    FirebaseAuth[("Firebase Auth")]:::external
    MongoDB[(MongoDB)]:::database

    %% Interactions
    CR -->|"API calls (fetch/Axios)"| EP
    FIB -->|"OAuth tokens"| FirebaseAuth
    MWAuth -->|"verify token"| FirebaseAuth
    MD -->|"queries"| MongoDB

    %% Click Events
    click PR "https://github.com/nikhilpatel9/blogosphere/tree/main/clint/src/pages/"
    click SC "https://github.com/nikhilpatel9/blogosphere/tree/main/clint/src/components/"
    click SM "https://github.com/nikhilpatel9/blogosphere/blob/main/clint/src/redux/store.js"
    click US "https://github.com/nikhilpatel9/blogosphere/blob/main/clint/src/redux/user/userSlice.js"
    click TS "https://github.com/nikhilpatel9/blogosphere/blob/main/clint/src/redux/theme/themeSlice.js"
    click PRC "https://github.com/nikhilpatel9/blogosphere/blob/main/clint/src/components/PrivateRoute.jsx"
    click OARC "https://github.com/nikhilpatel9/blogosphere/blob/main/clint/src/components/OnlyAdminPrivateRoute.jsx"
    click OAU "https://github.com/nikhilpatel9/blogosphere/blob/main/clint/src/components/OAuth.jsx"
    click FIB "https://github.com/nikhilpatel9/blogosphere/blob/main/clint/src/firebase.js"
    click TC "https://github.com/nikhilpatel9/blogosphere/blob/main/clint/tailwind.config.js"
    click PC "https://github.com/nikhilpatel9/blogosphere/blob/main/clint/postcss.config.js"
    click EP "https://github.com/nikhilpatel9/blogosphere/blob/main/api/index.js"
    click AR "https://github.com/nikhilpatel9/blogosphere/tree/main/api/routes/"
    click CT "https://github.com/nikhilpatel9/blogosphere/tree/main/api/controllers/"
    click MD "https://github.com/nikhilpatel9/blogosphere/tree/main/api/models/"
    click MWAuth "https://github.com/nikhilpatel9/blogosphere/blob/main/api/utills/verifyUser.js"
    click MWErr "https://github.com/nikhilpatel9/blogosphere/blob/main/api/utills/error.js"

    %% Styles
    classDef frontend fill:#D6EAF8,stroke:#1B4F72,color:#1B2631
    classDef backend fill:#FCF3CF,stroke:#7D6608,color:#784212
    classDef database fill:#ABEBC6,stroke:#196F3D,color:#0B5345
    classDef external fill:#F5B7B1,stroke:#922B21,color:#641E16
    classDef config fill:#E8DAEF,stroke:#633974,color:#4A235A
```
