# hiteshchoudhary/appwriteblog architecture

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

- Interactive diagram: https://gitdiagram.com/hiteshchoudhary/appwriteblog
- Repository: https://github.com/hiteshchoudhary/appwriteblog

## Overview

##### Project type and purpose
- This is a client-side Single Page Application (SPA) built with React and Vite.
- It uses Appwrite as a backend-as-a-service (BaaS) for authentication and data storage.
- Tailwind CSS/PostCSS provide styling; Redux (via `@reduxjs/toolkit`) manages client state.

##### File structure
- Top level
- index.html, package.json, vite.config.js, tailwind.config.js → build & tooling
- public/ → static assets
- src/
- src/main.jsx → bootstrap & render React app
- src/App.jsx / App.css → root component & global styles
- src/appwrite/ → Appwrite SDK config & auth wrapper
- src/store/ → Redux store & slices (authSlice)
- src/components/ → reusable UI components (buttons, inputs, layouts)
- src/pages/ → page-level views (Home, Login, Signup, Post CRUD)
- src/conf/ → application constants (API endpoints, feature flags)

##### Pulling in README insights
- Vite for fast dev & HMR
- ESLint rules defined in .eslintrc.cjs
- Two official React plugins available, but this template uses `@vitejs/plugin-react`

a. Main components
- Browser/Client
– Vite-built React SPA
– UI Layer (Pages & Components)
– State Layer (Redux store & slices)
– Service Layer (Appwrite SDK wrapper)
- Appwrite Backend
– Auth Service (sessions, JWT)
– Database Service (collections, documents)
– Storage Service (if used)
– Functions/Webhooks (optional)
- Static Hosting / CDN (e.g., Netlify, Vercel, AWS S3 + CloudFront)

b. Relationships & interactions
– User interacts with UI → React components dispatch Redux actions → Appwrite SDK calls (REST/SDK) → Appwrite services respond → Redux store updates → UI re-renders
– Vite dev server serves index.html and static assets; production bundle deployed to CDN

c. Architectural patterns & principles
– Component-based UI (separation of concerns)
– Unidirectional data flow (React + Redux)
– BaaS integration abstracted behind a service module (`src/appwrite/*`)
– Environment configuration injection via `.env.sample` and `src/conf/conf.js`

d. Key technologies/frameworks/libraries
– React + JSX
– Vite (build & dev server)
– Redux Toolkit (`authSlice.js`, `store.js`)
– Appwrite JavaScript SDK (`auth.js`, `config.js`)
– Tailwind CSS & PostCSS
– ESLint for code quality

## Diagram (Mermaid)

```mermaid
flowchart TD
    User["User"]:::client

    subgraph "Static Hosting / CDN"
        CDN["Static CDN/Host"]:::cloud
    end

    subgraph "Appwrite Backend"
        Auth["Appwrite Auth Service"]:::service
        DB["Appwrite Database Service"]:::service
        Storage["Appwrite Storage Service"]:::service
    end

    subgraph "Frontend Client"
        subgraph "Bootstrap & Root"
            Index["index.html"]:::client
            Main["src/main.jsx"]:::client
            App["src/App.jsx"]:::client
        end

        subgraph "UI Layer"
            subgraph Pages
                Home["Home.jsx"]:::ui
                LoginP["Login.jsx"]:::ui
                SignupP["Signup.jsx"]:::ui
                AddPost["AddPost.jsx"]:::ui
                AllPosts["AllPosts.jsx"]:::ui
                EditPost["EditPost.jsx"]:::ui
                PostPage["Post.jsx"]:::ui
            end
            subgraph Components
                AuthLayout["AuthLayout.jsx"]:::ui
                Button["Button.jsx"]:::ui
                Input["Input.jsx"]:::ui
                Logo["Logo.jsx"]:::ui
                PostCard["PostCard.jsx"]:::ui
                RTE["RTE.jsx"]:::ui
                Select["Select.jsx"]:::ui
                LoginC["Login.jsx"]:::ui
                SignupC["Signup.jsx"]:::ui
                ContainerCmp["Container.jsx"]:::ui
                PostForm["PostForm.jsx"]:::ui
                Header["Header.jsx"]:::ui
                LogoutBtn["LogoutBtn.jsx"]:::ui
                Footer["Footer.jsx"]:::ui
                ComponentsIndex["index.js"]:::ui
            end
        end

        subgraph "State Layer (Redux)"
            Store["store.js"]:::state
            AuthSlice["authSlice.js"]:::state
        end

        subgraph "Service Layer (Appwrite SDK)"
            Config["config.js"]:::service
            AuthSDK["auth.js"]:::service
        end
    end

    User -->|"interacts with"| App
    App -->|"renders UI"| Home
    Home -->|"dispatches actions"| Store
    Store -->|"calls"| AuthSDK
    AuthSDK -->|"requests auth"| Auth
    AuthSDK -->|"reads/writes"| DB
    AuthSDK -->|"stores files"| Storage
    Auth -->|"response"| Store
    DB -->|"response"| Store
    Storage -->|"response"| Store
    Store -->|"updates UI"| Home

    CDN -->|"serves"| Index
    Index --> Main
    Main --> App

    Config -->|"provides endpoints"| AuthSDK

    classDef client fill:#BBDEFB,stroke:#0D47A1
    classDef ui fill:#90CAF9,stroke:#1565C0
    classDef state fill:#FFE082,stroke:#FF8F00
    classDef service fill:#A5D6A7,stroke:#2E7D32
    classDef cloud fill:#CFD8DC,stroke:#37474F

    click Index "https://github.com/hiteshchoudhary/appwriteblog/blob/main/index.html"
    click Main "https://github.com/hiteshchoudhary/appwriteblog/blob/main/src/main.jsx"
    click App "https://github.com/hiteshchoudhary/appwriteblog/blob/main/src/App.jsx"
    click AuthLayout "https://github.com/hiteshchoudhary/appwriteblog/blob/main/src/components/AuthLayout.jsx"
    click Button "https://github.com/hiteshchoudhary/appwriteblog/blob/main/src/components/Button.jsx"
    click Input "https://github.com/hiteshchoudhary/appwriteblog/blob/main/src/components/Input.jsx"
    click Logo "https://github.com/hiteshchoudhary/appwriteblog/blob/main/src/components/Logo.jsx"
    click PostCard "https://github.com/hiteshchoudhary/appwriteblog/blob/main/src/components/PostCard.jsx"
    click RTE "https://github.com/hiteshchoudhary/appwriteblog/blob/main/src/components/RTE.jsx"
    click Select "https://github.com/hiteshchoudhary/appwriteblog/blob/main/src/components/Select.jsx"
    click LoginC "https://github.com/hiteshchoudhary/appwriteblog/blob/main/src/components/Login.jsx"
    click SignupC "https://github.com/hiteshchoudhary/appwriteblog/blob/main/src/components/Signup.jsx"
    click ContainerCmp "https://github.com/hiteshchoudhary/appwriteblog/blob/main/src/components/container/Container.jsx"
    click PostForm "https://github.com/hiteshchoudhary/appwriteblog/blob/main/src/components/post-form/PostForm.jsx"
    click Header "https://github.com/hiteshchoudhary/appwriteblog/blob/main/src/components/Header/Header.jsx"
    click LogoutBtn "https://github.com/hiteshchoudhary/appwriteblog/blob/main/src/components/Header/LogoutBtn.jsx"
    click Footer "https://github.com/hiteshchoudhary/appwriteblog/blob/main/src/components/Footer/Footer.jsx"
    click ComponentsIndex "https://github.com/hiteshchoudhary/appwriteblog/blob/main/src/components/index.js"
    click Home "https://github.com/hiteshchoudhary/appwriteblog/blob/main/src/pages/Home.jsx"
    click LoginP "https://github.com/hiteshchoudhary/appwriteblog/blob/main/src/pages/Login.jsx"
    click SignupP "https://github.com/hiteshchoudhary/appwriteblog/blob/main/src/pages/Signup.jsx"
    click AddPost "https://github.com/hiteshchoudhary/appwriteblog/blob/main/src/pages/AddPost.jsx"
    click AllPosts "https://github.com/hiteshchoudhary/appwriteblog/blob/main/src/pages/AllPosts.jsx"
    click EditPost "https://github.com/hiteshchoudhary/appwriteblog/blob/main/src/pages/EditPost.jsx"
    click PostPage "https://github.com/hiteshchoudhary/appwriteblog/blob/main/src/pages/Post.jsx"
    click Store "https://github.com/hiteshchoudhary/appwriteblog/blob/main/src/store/store.js"
    click AuthSlice "https://github.com/hiteshchoudhary/appwriteblog/blob/main/src/store/authSlice.js"
    click Config "https://github.com/hiteshchoudhary/appwriteblog/blob/main/src/appwrite/config.js"
    click AuthSDK "https://github.com/hiteshchoudhary/appwriteblog/blob/main/src/appwrite/auth.js"
    click EnvSample "https://github.com/hiteshchoudhary/appwriteblog/blob/main/.env.sample"
    click Conf "https://github.com/hiteshchoudhary/appwriteblog/blob/main/src/conf/conf.js"
    click Tailwind "https://github.com/hiteshchoudhary/appwriteblog/blob/main/tailwind.config.js"
    click PostCSS "https://github.com/hiteshchoudhary/appwriteblog/blob/main/postcss.config.js"
    click Vite "https://github.com/hiteshchoudhary/appwriteblog/blob/main/vite.config.js"
    click ESLint "https://github.com/hiteshchoudhary/appwriteblog/blob/main/.eslintrc.cjs"
```
