# pkushal05/blogify architecture

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

- Interactive diagram: https://gitdiagram.com/pkushal05/blogify
- Repository: https://github.com/pkushal05/blogify

## Overview

##### Project type and purpose
- This is Blogify, a full-stack MERN blogging platform.
- Frontend: React + Vite + Tailwind CSS / DaisyUI / Framer Motion, with Redux Toolkit for state management.
- Backend: Node.js + Express.js REST API, MongoDB via Mongoose, JWT auth, file uploads via Multer + Cloudinary.

##### File structure
- client/
- src/pages, layouts, components → React view layer (routing via React Router implicit in pages).
- src/features/slices, thunks, store → Redux Toolkit (slices + async thunks).
- src/api/*.js → Axios-based API clients for auth, blogs, comments, users.
- server/
- app.js → Express app configuration (attach middlewares, routers).
- routes/ → HTTP routes per resource (auth, blog, comment, user).
- controllers/ → MVC controllers implementing business logic.
- models/ → Mongoose schemas for User, Blog, Comment.
- middlewares/ → auth (JWT verify), multer (file upload).
- db/database.js → MongoDB connection.
- utils/cloudinary.js → external image storage integration.

##### Key insights from README
- JWT-based authentication, RESTful endpoints, image uploads to Cloudinary.
- Responsive UI, search/filter features, author profile pages.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Frontend Zone
    subgraph "Frontend" 
        direction TB
        UIComponents["UI Components"]:::frontend
        Pages["React Pages"]:::frontend
        Layouts["Layout Components"]:::frontend
        TailwindConfig["Vite & Tailwind Config"]:::frontend
        subgraph "Redux Layer"
            direction TB
            Store["Redux Store"]:::frontend
            subgraph "Slices"
                direction TB
                AuthSlice["Auth Slice"]:::frontend
                BlogSlice["Blog Slice"]:::frontend
                UserSlice["User Slice"]:::frontend
            end
            subgraph "Thunks"
                direction TB
                AuthThunk["Auth Thunks"]:::frontend
                BlogThunk["Blog Thunks"]:::frontend
                UserThunk["User Thunks"]:::frontend
            end
        end
        subgraph "API Client Layer"
            direction TB
            AuthAPI["authApi.js"]:::frontend
            BlogAPI["blogApi.js"]:::frontend
            CommentAPI["commentApi.js"]:::frontend
            UserAPI["userApi.js"]:::frontend
        end
    end

    %% Backend Zone
    subgraph "Backend"
        direction TB
        ExpressApp["Express App"]:::backend
        subgraph "Routes"
            direction TB
            AuthRoutes["authRoutes.js"]:::backend
            BlogRoutes["blogRoutes.js"]:::backend
            CommentRoutes["commentRoutes.js"]:::backend
            UserRoutes["userRoutes.js"]:::backend
        end
        subgraph "Middlewares"
            direction TB
            AuthMiddleware["JWT Auth Middleware"]:::backend
            MulterMiddleware["Multer File Upload"]:::backend
        end
        subgraph "Controllers"
            direction TB
            UserController["userController.js"]:::backend
            BlogController["blogController.js"]:::backend
            CommentController["commentController.js"]:::backend
        end
        subgraph "Models"
            direction TB
            UserModel["userModel.js"]:::database
            BlogModel["blogModel.js"]:::database
            CommentModel["commentModel.js"]:::database
        end
        Database["MongoDB Connection"]:::database
        Cloudinary["Cloudinary Service"]:::external
    end

    %% Flows
    UIComponents -->|uses| Pages
    Pages -->|renders in| Layouts
    Layouts -->|dispatch| Store
    UIComponents -->|dispatch| Store
    Store -->|updates| AuthSlice
    Store -->|updates| BlogSlice
    Store -->|updates| UserSlice
    AuthSlice -->|via| AuthThunk
    BlogSlice -->|via| BlogThunk
    UserSlice -->|via| UserThunk
    AuthThunk -->|calls| AuthAPI
    BlogThunk -->|calls| BlogAPI
    UserThunk -->|calls| UserAPI
    CommentAPI -->|calls| ExpressApp
    AuthAPI -->|HTTP request| ExpressApp
    BlogAPI -->|HTTP request| ExpressApp
    UserAPI -->|HTTP request| ExpressApp

    ExpressApp -->|routes to| AuthRoutes
    ExpressApp -->|routes to| BlogRoutes
    ExpressApp -->|routes to| CommentRoutes
    ExpressApp -->|routes to| UserRoutes
    AuthRoutes -->|use| AuthMiddleware
    BlogRoutes -->|use| AuthMiddleware
    CommentRoutes -->|use| AuthMiddleware
    UserRoutes -->|use| AuthMiddleware
    BlogRoutes -->|use| MulterMiddleware
    CommentRoutes -->|use| MulterMiddleware
    AuthRoutes -->|calls| UserController
    BlogRoutes -->|calls| BlogController
    CommentRoutes -->|calls| CommentController
    UserController -->|CRUD| UserModel
    BlogController -->|CRUD| BlogModel
    CommentController -->|CRUD| CommentModel
    BlogController -->|uploads| Cloudinary
    Database -->|stores| UserModel
    Database -->|stores| BlogModel
    Database -->|stores| CommentModel
    ExpressApp -->|connects to| Database

    %% Click Events
    click UIComponents "https://github.com/pkushal05/blogify/tree/main/client/src/components"
    click Pages "https://github.com/pkushal05/blogify/tree/main/client/src/pages"
    click Layouts "https://github.com/pkushal05/blogify/tree/main/client/src/pages/layouts"
    click TailwindConfig "https://github.com/pkushal05/blogify/blob/main/client/vite.config.js"
    click TailwindConfig "https://github.com/pkushal05/blogify/blob/main/client/index.html"
    click TailwindConfig "https://github.com/pkushal05/blogify/blob/main/client/src/index.css"
    click Store "https://github.com/pkushal05/blogify/blob/main/client/src/features/store/store.js"
    click AuthSlice "https://github.com/pkushal05/blogify/blob/main/client/src/features/slices/authSlice.js"
    click BlogSlice "https://github.com/pkushal05/blogify/blob/main/client/src/features/slices/blogSlice.js"
    click UserSlice "https://github.com/pkushal05/blogify/blob/main/client/src/features/slices/userSlice.js"
    click AuthThunk "https://github.com/pkushal05/blogify/blob/main/client/src/features/thunks/authThunks.js"
    click BlogThunk "https://github.com/pkushal05/blogify/blob/main/client/src/features/thunks/blogThunks.js"
    click UserThunk "https://github.com/pkushal05/blogify/blob/main/client/src/features/thunks/userThunks.js"
    click AuthAPI "https://github.com/pkushal05/blogify/blob/main/client/src/api/authApi.js"
    click BlogAPI "https://github.com/pkushal05/blogify/blob/main/client/src/api/blogApi.js"
    click CommentAPI "https://github.com/pkushal05/blogify/blob/main/client/src/api/commentApi.js"
    click UserAPI "https://github.com/pkushal05/blogify/blob/main/client/src/api/userApi.js"
    click ExpressApp "https://github.com/pkushal05/blogify/blob/main/server/app.js"
    click AuthRoutes "https://github.com/pkushal05/blogify/blob/main/server/routes/authRoutes.js"
    click BlogRoutes "https://github.com/pkushal05/blogify/blob/main/server/routes/blogRoutes.js"
    click CommentRoutes "https://github.com/pkushal05/blogify/blob/main/server/routes/commentRoutes.js"
    click UserRoutes "https://github.com/pkushal05/blogify/blob/main/server/routes/userRoutes.js"
    click UserController "https://github.com/pkushal05/blogify/blob/main/server/controllers/userController.js"
    click BlogController "https://github.com/pkushal05/blogify/blob/main/server/controllers/blogController.js"
    click CommentController "https://github.com/pkushal05/blogify/blob/main/server/controllers/commentController.js"
    click UserModel "https://github.com/pkushal05/blogify/blob/main/server/models/userModel.js"
    click BlogModel "https://github.com/pkushal05/blogify/blob/main/server/models/blogModel.js"
    click CommentModel "https://github.com/pkushal05/blogify/blob/main/server/models/commentModel.js"
    click AuthMiddleware "https://github.com/pkushal05/blogify/blob/main/server/middlewares/authMiddleware.js"
    click MulterMiddleware "https://github.com/pkushal05/blogify/blob/main/server/middlewares/multerMiddleware.js"
    click Database "https://github.com/pkushal05/blogify/blob/main/server/db/database.js"
    click Cloudinary "https://github.com/pkushal05/blogify/blob/main/server/utils/cloudinary.js"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef backend fill:#90EE90,stroke:#333,stroke-width:1px
    classDef database fill:#FFA500,stroke:#333,stroke-width:1px
    classDef external fill:#DDA0DD,stroke:#333,stroke-width:1px
```
