# kunaal438/mern-blogging-website architecture

> Architecture diagram of the GitHub repository kunaal438/mern-blogging-website, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kunaal438/mern-blogging-website
- Repository: https://github.com/kunaal438/mern-blogging-website

## Overview

##### Project type and purpose
- This is a Full-Stack MERN Blogging Website (MongoDB, Express, React, Node.js).
- Purpose: allow users to register/log in (Google Auth), write and publish blog posts (with EditorJS), comment, like, receive notifications, edit their profile, search content, and manage drafts via a dashboard.

##### File structure
- Top-level: two folders—“blogging website - frontend” and “server”.
- Frontend:
- Built with React (Vite) + TailwindCSS.
- src/common: utility wrappers for AWS, Firebase, date formatting, pagination, session, animations.
- src/components: reusable UI components (navbar, blog-card, comment card, loader, etc.).
- src/pages: route-level pages (home, blog page, editor, dashboard, profile, login, 404, etc.).
- Configuration: package.json, postcss.config.js, tailwind.config.js, vite.config.js.
- Server:
- server.js: Express app + route handlers.
- /Schema: Mongoose models (User, Blog, Comment, Notification).
- requests.rest: Postman-like definitions of all REST endpoints.
- package.json: dependencies (express, mongoose, cors, etc.).

##### README for additional insights
- Features: Google Authentication, EditorJS, dynamic routes, search, nested comments, notifications, mobile-responsive animations.

##### Final recommendations
- Sequence flow for key user journeys (e.g., “Create Post” path).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Frontend Layer
    subgraph "Frontend (React SPA)" 
        ReactSPA["React SPA"]:::frontend
        MainEntry["main.jsx"]:::frontend
        AppComp["App.jsx (Router)"]:::frontend

        subgraph "Utilities"
            AWSWrapper["common/aws.jsx"]:::frontend
            FirebaseWrapper["common/firebase.jsx"]:::frontend
            DateWrapper["common/date.jsx"]:::frontend
            PaginationWrapper["common/filter-pagination-data.jsx"]:::frontend
            SessionWrapper["common/session.jsx"]:::frontend
            AnimationWrapper["common/page-animation.jsx"]:::frontend
        end

        subgraph "UI Components"
            Navbar["navbar.component.jsx"]:::frontend
            BlogCard["blog-post.component.jsx"]:::frontend
            CommentCard["comment-card.component.jsx"]:::frontend
            Loader["loader.component.jsx"]:::frontend
            NotificationCard["notification-card.component.jsx"]:::frontend
            EditorComponent["blog-editor.component.jsx"]:::frontend
        end

        subgraph "Pages (Routes)"
            HomePage["home.page.jsx"]:::frontend
            BlogPage["blog.page.jsx"]:::frontend
            EditorPage["editor.pages.jsx"]:::frontend
            DashboardPage["dashboard.page.jsx"]:::frontend
            ManageBlogsPage["manage-blogs.page.jsx"]:::frontend
            ProfilePage["profile.page.jsx"]:::frontend
            ChangePasswordPage["change-password.page.jsx"]:::frontend
            EditProfilePage["edit-profile.page.jsx"]:::frontend
            NotificationsPage["notifications.page.jsx"]:::frontend
            SearchPage["search.page.jsx"]:::frontend
            AuthPage["userAuthForm.page.jsx"]:::frontend
            NotFoundPage["404.page.jsx"]:::frontend
        end

        subgraph "Config"
            ViteConfig["vite.config.js"]:::config
            TailwindConfig["tailwind.config.js & postcss.config.js"]:::config
            FrontendPackage["package.json"]:::config
        end
    end

    %% Backend Layer
    subgraph "Backend (Node/Express)" 
        ExpressAPI["server.js"]:::backend
        APIDefinitions["requests.rest"]:::backend

        subgraph "Models (Mongoose)"
            UserModel["User.js"]:::backend
            BlogModel["Blog.js"]:::backend
            CommentModel["Comment.js"]:::backend
            NotificationModel["Notification.js"]:::backend
        end

        ServerPackage["package.json"]:::config
    end

    %% Database
    subgraph "Database (MongoDB Cluster)"
        MongoDB["MongoDB"]:::db
    end

    %% External Services
    subgraph "External Services"
        GoogleOAuth["Google OAuth"]:::external
        FirebaseService["Firebase Auth/Realtime"]:::external
        AWS_S3["AWS S3"]:::external
        CDN["CDN / Static Hosting"]:::external
    end

    %% Connections
    ReactSPA -->|"uses entry point"| MainEntry
    MainEntry -->|"renders"| AppComp
    AppComp -->|"renders pages"| HomePage
    AppComp --> BlogPage
    AppComp --> EditorPage
    AppComp --> DashboardPage
    AppComp --> ManageBlogsPage
    AppComp --> ProfilePage
    AppComp --> ChangePasswordPage
    AppComp --> EditProfilePage
    AppComp --> NotificationsPage
    AppComp --> SearchPage
    AppComp --> AuthPage
    AppComp --> NotFoundPage

    AppComp -->|"calls utils"| AWSWrapper
    AppComp --> FirebaseWrapper
    AWSWrapper -->|"upload images"| AWS_S3
    FirebaseWrapper -->|"auth & realtime"| FirebaseService

    AppComp -->|"HTTP REST"| ExpressAPI
    ExpressAPI -->|"uses definitions"| APIDefinitions
    ExpressAPI -->|"CRUD"| UserModel
    ExpressAPI --> BlogModel
    ExpressAPI --> CommentModel
    ExpressAPI --> NotificationModel

    UserModel --> MongoDB
    BlogModel --> MongoDB
    CommentModel --> MongoDB
    NotificationModel --> MongoDB

    ReactSPA -->|"served from"| CDN

    %% Click Events
    click ReactSPA "https://github.com/kunaal438/mern-blogging-website/tree/master/blogging website - frontend/src"
    click MainEntry "https://github.com/kunaal438/mern-blogging-website/blob/master/blogging website - frontend/src/main.jsx"
    click AppComp "https://github.com/kunaal438/mern-blogging-website/blob/master/blogging website - frontend/src/App.jsx"
    click AWSWrapper "https://github.com/kunaal438/mern-blogging-website/blob/master/blogging website - frontend/src/common/aws.jsx"
    click FirebaseWrapper "https://github.com/kunaal438/mern-blogging-website/blob/master/blogging website - frontend/src/common/firebase.jsx"
    click DateWrapper "https://github.com/kunaal438/mern-blogging-website/blob/master/blogging website - frontend/src/common/date.jsx"
    click PaginationWrapper "https://github.com/kunaal438/mern-blogging-website/blob/master/blogging website - frontend/src/common/filter-pagination-data.jsx"
    click SessionWrapper "https://github.com/kunaal438/mern-blogging-website/blob/master/blogging website - frontend/src/common/session.jsx"
    click AnimationWrapper "https://github.com/kunaal438/mern-blogging-website/blob/master/blogging website - frontend/src/common/page-animation.jsx"
    click Navbar "https://github.com/kunaal438/mern-blogging-website/blob/master/blogging website - frontend/src/components/navbar.component.jsx"
    click BlogCard "https://github.com/kunaal438/mern-blogging-website/blob/master/blogging website - frontend/src/components/blog-post.component.jsx"
    click CommentCard "https://github.com/kunaal438/mern-blogging-website/blob/master/blogging website - frontend/src/components/comment-card.component.jsx"
    click Loader "https://github.com/kunaal438/mern-blogging-website/blob/master/blogging website - frontend/src/components/loader.component.jsx"
    click NotificationCard "https://github.com/kunaal438/mern-blogging-website/blob/master/blogging website - frontend/src/components/notification-card.component.jsx"
    click EditorComponent "https://github.com/kunaal438/mern-blogging-website/blob/master/blogging website - frontend/src/components/blog-editor.component.jsx"
    click HomePage "https://github.com/kunaal438/mern-blogging-website/blob/master/blogging website - frontend/src/pages/home.page.jsx"
    click BlogPage "https://github.com/kunaal438/mern-blogging-website/blob/master/blogging website - frontend/src/pages/blog.page.jsx"
    click EditorPage "https://github.com/kunaal438/mern-blogging-website/blob/master/blogging website - frontend/src/pages/editor.pages.jsx"
    click DashboardPage "https://github.com/kunaal438/mern-blogging-website/blob/master/blogging website - frontend/src/pages/dashboard.page.jsx"
    click ManageBlogsPage "https://github.com/kunaal438/mern-blogging-website/blob/master/blogging website - frontend/src/pages/manage-blogs.page.jsx"
    click ProfilePage "https://github.com/kunaal438/mern-blogging-website/blob/master/blogging website - frontend/src/pages/profile.page.jsx"
    click ChangePasswordPage "https://github.com/kunaal438/mern-blogging-website/blob/master/blogging website - frontend/src/pages/change-password.page.jsx"
    click EditProfilePage "https://github.com/kunaal438/mern-blogging-website/blob/master/blogging website - frontend/src/pages/edit-profile.page.jsx"
    click NotificationsPage "https://github.com/kunaal438/mern-blogging-website/blob/master/blogging website - frontend/src/pages/notifications.page.jsx"
    click SearchPage "https://github.com/kunaal438/mern-blogging-website/blob/master/blogging website - frontend/src/pages/search.page.jsx"
    click AuthPage "https://github.com/kunaal438/mern-blogging-website/blob/master/blogging website - frontend/src/pages/userAuthForm.page.jsx"
    click NotFoundPage "https://github.com/kunaal438/mern-blogging-website/blob/master/blogging website - frontend/src/pages/404.page.jsx"
    click ViteConfig "https://github.com/kunaal438/mern-blogging-website/blob/master/blogging website - frontend/vite.config.js"
    click TailwindConfig "https://github.com/kunaal438/mern-blogging-website/blob/master/blogging website - frontend/tailwind.config.js"
    click FrontendPackage "https://github.com/kunaal438/mern-blogging-website/blob/master/blogging website - frontend/package.json"
    click ExpressAPI "https://github.com/kunaal438/mern-blogging-website/blob/master/server/server.js"
    click APIDefinitions "https://github.com/kunaal438/mern-blogging-website/blob/master/server/requests.rest"
    click UserModel "https://github.com/kunaal438/mern-blogging-website/blob/master/server/Schema/User.js"
    click BlogModel "https://github.com/kunaal438/mern-blogging-website/blob/master/server/Schema/Blog.js"
    click CommentModel "https://github.com/kunaal438/mern-blogging-website/blob/master/server/Schema/Comment.js"
    click NotificationModel "https://github.com/kunaal438/mern-blogging-website/blob/master/server/Schema/Notification.js"
    click ServerPackage "https://github.com/kunaal438/mern-blogging-website/blob/master/server/package.json"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#333,stroke-width:1px
    classDef backend fill:#D0FFD6,stroke:#333,stroke-width:1px
    classDef db fill:#FFE4B3,stroke:#333,stroke-width:1px
    classDef external fill:#EAC7F3,stroke:#333,stroke-width:1px
    classDef config fill:#CCCCCC,stroke:#333,stroke-width:1px
```
