# gouravindoriya/blog architecture

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

- Interactive diagram: https://gitdiagram.com/gouravindoriya/blog
- Repository: https://github.com/gouravindoriya/blog

## Overview

##### Project type and purpose
- This is a single-page full-stack application built with React and Vite on the front end, using Appwrite as a Backend-as-a-Service (BaaS) provider for authentication and data storage.
- The goal, per the README, is to display user-specific blogs on the home page while allowing all users to see all active posts from any user.

##### File structure
- Top-level files and folders:
- index.html, public/ — the static shell that Vite serves.
- src/main.jsx, src/App.jsx — the React app entry points.
- src/components/ — UI components organized by feature (AuthLayout, Login, Signup, PostCard, PostForm, RTE, etc.).
- src/appwrite/ — Appwrite integration (auth.js, config.js).
- src/store/ — Redux Toolkit store (authSlice.js, store.js).
- config files: vite.config.js, tailwind.config.js, postcss.config.js, eslint.config.js.
- vercel.json — deployment config for hosting on Vercel.
- Architectural patterns:
- Component-based UI (React)
- Global state via Redux Toolkit
- Services layer for BaaS (Appwrite)
- CSS utility framework (Tailwind)

##### Extract insights from the README
- Uses Vite for dev server and plugin-react for HMR.
- A home page showing only the current user’s blogs, with global visibility of active posts.
- Task assignment and date indicate ongoing feature work around blog visibility rules.

##### Main components and interactions
a. Components:
- User’s Web Browser (Client)
- Vercel-hosted React+Vite App
- React component tree (App.jsx → pages → feature components)
- Appwrite service module (auth.js, config.js)
- Appwrite Cloud Services
- Authentication (JWT, sessions)
- Database (collections for users, posts)
- Storage (if media attachments)

b. Relationships / Data flow:
1. User ➞ Browser UI: click login/signup/post controls
2. UI dispatches Redux actions ➞ Auth / Posts services
3. Appwrite SDK (auth.js) makes REST or SDK calls to Appwrite Auth API
4. Appwrite returns session tokens & user data ➞ stored in Redux
5. UI requests posts: Appwrite Database query ➞ returns post list ➞ displayed
6. Vercel hosts the static build; user fetches index.html + JS bundle

c. Architectural patterns / design principles
- Separation of concerns: UI components vs. state management vs. service modules.
- Feature-based folder structure for maintainability.
- BaaS offloads auth & data persistence.
- HMR via Vite for rapid front-end feedback.

d. Key technologies & libraries
- React + JSX, Vite + plugin-react
- Tailwind CSS, PostCSS
- Redux Toolkit (store, authSlice)
- Appwrite JS SDK (auth.js, config.js)
- Deployment: Vercel

##### Detailed call-outs to capture essentials
- Entry point (src/main.jsx → App.jsx).
- Appwrite config & auth flow (src/appwrite/config.js → auth.js).
- Data-driven pages (AddPost, AllPosts, EditPost) and how they query Appwrite.
- Redux persisting user session and providing auth tokens to API calls.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Infra & Deployment
    GitRepo["Git Repository"]:::infra
    VercelCI["Vercel CI/CD"]:::infra
    CDN["Vercel CDN"]:::infra
    Browser["User Web Browser"]:::external

    GitRepo -->|push code| VercelCI
    VercelCI -->|deploy static assets| CDN
    CDN -->|serve| Browser

    %% Frontend Application
    subgraph "Frontend Layer"
        direction TB

        Browser -->|load index.html & JS bundle| ReactApp["React + Vite App"]:::frontend

        subgraph "Entry Points"
            direction TB
            Main["src/main.jsx"]:::frontend
            AppComp["src/App.jsx"]:::frontend
        end

        ReactApp --> Main
        Main --> AppComp

        subgraph "UI Components"
            direction TB
            AuthLayout["AuthLayout.jsx"]:::ui
            LoginComp["Login/Login.jsx"]:::ui
            SignupComp["Signup/Signup.jsx"]:::ui
            HeaderComp["Header/Header.jsx"]:::ui
            LogoutComp["Header/Logout.jsx"]:::ui
            FooterComp["Footer/Footer.jsx"]:::ui
            LogoComp["Logo/Logo.jsx"]:::ui
            PostCard["PostCard/PostCard.jsx"]:::ui
            PostForm["PostForm/Postform.jsx"]:::ui
            RTE["RTE/RTE.jsx"]:::ui
            HomePage["pages/Home.jsx"]:::ui
            HomeComp["pages/Homecomponent.jsx"]:::ui
            AddPostPage["pages/Addpostcomponent.jsx"]:::ui
            AllPostsPage["pages/AllPostcomponent.jsx"]:::ui
            EditPostPage["pages/Editpostcomponent.jsx"]:::ui
            PostPage["pages/Postcomponent.jsx"]:::ui
            LoginPage["pages/Logincomponent.jsx"]:::ui
            SignupPage["pages/Signupcomponent.jsx"]:::ui
            ButtonComp["Button/Button.jsx"]:::ui
            InputComp["Input/Input.jsx"]:::ui
            SelectComp["Select/Select.jsx"]:::ui
            LoaderComp["Loading/Loader.jsx"]:::ui
            AnimateComp["Animate/threejsCubeEffect.jsx"]:::ui
            ContainerComp["container/Container.jsx"]:::ui
        end

        AppComp --> AuthLayout
        AuthLayout --> LoginComp
        AuthLayout --> SignupComp
        AppComp --> HeaderComp
        HeaderComp --> LogoComp
        HeaderComp --> LogoutComp
        AppComp --> FooterComp

        AppComp --> HomePage
        AppComp --> AddPostPage
        AppComp --> AllPostsPage
        AppComp --> EditPostPage
        AppComp --> PostPage
        AppComp --> LoginPage
        AppComp --> SignupPage

        HomePage --> HomeComp
        AddPostPage --> PostForm
        AllPostsPage --> PostCard
        EditPostPage --> PostForm
        PostPage --> PostCard

        %% Generic UI utils
        AppComp --> ButtonComp
        AppComp --> InputComp
        AppComp --> SelectComp
        AppComp --> LoaderComp
        AppComp --> AnimateComp
        AppComp --> ContainerComp

        subgraph "State Management (Redux)"
            direction TB
            Store["src/store/store.js"]:::state
            AuthSlice["src/store/authSlice.js"]:::state
        end

        AppComp --> Store
        Store --> AuthSlice

        subgraph "Service Layer (Appwrite SDK)"
            direction TB
            Config["src/appwrite/config.js"]:::service
            AuthService["src/appwrite/auth.js"]:::service
        end

        Store --> AuthService
        AuthService --> Config

        %% Data flow
        Browser -->|dispatch actions| Store
        Store -->|calls| AuthService
        AuthService -->|API calls| AppwriteAuth
        AuthService -->|DB queries| AppwriteDB

        UI["UI Components"] -->|read/write| Store
    end

    %% Appwrite Backend
    subgraph "Appwrite BaaS"
        direction TB
        AppwriteAuth["Appwrite Auth Service"]:::backend
        AppwriteDB["Appwrite Database"]:::database
        AppwriteStorage["Appwrite Storage"]:::backend
    end

    AppwriteAuth --> AppwriteDB
    AppwriteAuth --> AppwriteStorage

    %% Static & Config Files
    subgraph "Static & Config"
        direction TB
        IndexHTML["index.html"]:::infra
        Public["public/"]:::infra
        CSS["src/index.css"]:::infra
        ViteConfig["vite.config.js"]:::infra
        TailwindConfig["tailwind.config.js"]:::infra
        PostCSSConfig["postcss.config.js"]:::infra
        ESLint["eslint.config.js"]:::infra
        VercelJSON["vercel.json"]:::infra
        README["README.md"]:::infra
        PackageJSON["package.json"]:::infra
        GitIgnore[".gitignore"]:::infra
    end

    %% Click Events
    click Main "https://github.com/gouravindoriya/blog/blob/main/src/main.jsx"
    click AppComp "https://github.com/gouravindoriya/blog/blob/main/src/App.jsx"
    click AuthLayout "https://github.com/gouravindoriya/blog/blob/main/src/components/AuthLayout.jsx"
    click LoginComp "https://github.com/gouravindoriya/blog/blob/main/src/components/Login/Login.jsx"
    click SignupComp "https://github.com/gouravindoriya/blog/blob/main/src/components/Signup/Signup.jsx"
    click HeaderComp "https://github.com/gouravindoriya/blog/blob/main/src/components/Header/Header.jsx"
    click LogoutComp "https://github.com/gouravindoriya/blog/blob/main/src/components/Header/Logout.jsx"
    click FooterComp "https://github.com/gouravindoriya/blog/blob/main/src/components/Footer/Footer.jsx"
    click LogoComp "https://github.com/gouravindoriya/blog/blob/main/src/components/Logo/Logo.jsx"
    click PostCard "https://github.com/gouravindoriya/blog/blob/main/src/components/PostCard/PostCard.jsx"
    click PostForm "https://github.com/gouravindoriya/blog/blob/main/src/components/PostForm/Postform.jsx"
    click RTE "https://github.com/gouravindoriya/blog/blob/main/src/components/RTE/RTE.jsx"
    click HomePage "https://github.com/gouravindoriya/blog/blob/main/src/components/pages/Home.jsx"
    click HomeComp "https://github.com/gouravindoriya/blog/blob/main/src/components/pages/Homecomponent.jsx"
    click AddPostPage "https://github.com/gouravindoriya/blog/blob/main/src/components/pages/Addpostcomponent.jsx"
    click AllPostsPage "https://github.com/gouravindoriya/blog/blob/main/src/components/pages/AllPostcomponent.jsx"
    click EditPostPage "https://github.com/gouravindoriya/blog/blob/main/src/components/pages/Editpostcomponent.jsx"
    click PostPage "https://github.com/gouravindoriya/blog/blob/main/src/components/pages/Postcomponent.jsx"
    click LoginPage "https://github.com/gouravindoriya/blog/blob/main/src/components/pages/Logincomponent.jsx"
    click SignupPage "https://github.com/gouravindoriya/blog/blob/main/src/components/pages/Signupcomponent.jsx"
    click ButtonComp "https://github.com/gouravindoriya/blog/blob/main/src/components/Button/Button.jsx"
    click InputComp "https://github.com/gouravindoriya/blog/blob/main/src/components/Input/Input.jsx"
    click SelectComp "https://github.com/gouravindoriya/blog/blob/main/src/components/Select/Select.jsx"
    click LoaderComp "https://github.com/gouravindoriya/blog/blob/main/src/components/Loading/Loader.jsx"
    click AnimateComp "https://github.com/gouravindoriya/blog/blob/main/src/components/Animate/threejsCubeEffect.jsx"
    click ContainerComp "https://github.com/gouravindoriya/blog/blob/main/src/components/container/Container.jsx"
    click Config "https://github.com/gouravindoriya/blog/blob/main/src/appwrite/config.js"
    click AuthService "https://github.com/gouravindoriya/blog/blob/main/src/appwrite/auth.js"
    click Store "https://github.com/gouravindoriya/blog/blob/main/src/store/store.js"
    click AuthSlice "https://github.com/gouravindoriya/blog/blob/main/src/store/authSlice.js"
    click IndexHTML "https://github.com/gouravindoriya/blog/blob/main/index.html"
    click Public "https://github.com/gouravindoriya/blog/tree/main/public/"
    click CSS "https://github.com/gouravindoriya/blog/blob/main/src/index.css"
    click ViteConfig "https://github.com/gouravindoriya/blog/blob/main/vite.config.js"
    click TailwindConfig "https://github.com/gouravindoriya/blog/blob/main/tailwind.config.js"
    click PostCSSConfig "https://github.com/gouravindoriya/blog/blob/main/postcss.config.js"
    click ESLint "https://github.com/gouravindoriya/blog/blob/main/eslint.config.js"
    click VercelJSON "https://github.com/gouravindoriya/blog/blob/main/vercel.json"
    click README "https://github.com/gouravindoriya/blog/blob/main/README.md"
    click PackageJSON "https://github.com/gouravindoriya/blog/blob/main/package.json"
    click GitIgnore "https://github.com/gouravindoriya/blog/blob/main/.gitignore"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0288D1,stroke-width:2px
    classDef ui fill:#E3F2FD,stroke:#90CAF9,stroke-width:1px
    classDef state fill:#FFF3E0,stroke:#FFB74D,stroke-width:2px
    classDef service fill:#E8F5E9,stroke:#66BB6A,stroke-width:2px
    classDef backend fill:#F3E5F5,stroke:#AB47BC,stroke-width:2px
    classDef database fill:#EFEBE9,stroke:#8D6E63,stroke-width:2px,stroke-dasharray: 5 5
    classDef infra fill:#ECEFF1,stroke:#78909C,stroke-width:1px
    classDef external fill:#FFFFFF,stroke:#B0BEC5,stroke-width:1px,stroke-dasharray: 2 2
```
