# yashbitcode/react-blog-app architecture

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

- Interactive diagram: https://gitdiagram.com/yashbitcode/react-blog-app
- Repository: https://github.com/yashbitcode/react-blog-app

## Overview

##### Project Type & Purpose
- This is a client-heavy full-stack blogging platform built in React/TypeScript that delegates backend responsibilities (auth, database, storage) to Appwrite.
- Users sign up, verify their email, log in, and perform CRUD operations on blog posts via a rich-text editor.

##### File Structure Analysis
- src/appwrite: thin SDK wrapper modules (auth.ts, database.ts, storage.ts).
- src/components & src/pages: React UI components, organized by feature (Auth, Post, Protected, Header, Verification, RTE).
- src/store: Redux Toolkit slices for application state (authSlice.ts, store.ts).
- src/utils, src/types, src/conf: helper functions, type definitions, configuration constants.
- Root config: Vite (vite.config.ts), TS (tsconfig.json), ESLint, Tailwind.

##### Key Architecture Insights from README
- Tech stack: React + TypeScript + TailwindCSS + TinyMCE + htmlparser2 + Appwrite.
- Environment drives Appwrite endpoints and project/database/collection IDs.
- No custom backend code—Appwrite services provide serverless API surface.

a. Main Components
- Client Browser (React SPA)
- UI Layer
- Pages & Components (Login, Signup, Home, PostForm, RTE, Protected)
- State Management
- Redux Store (authSlice, postSlice if any)
- Appwrite SDK Layer
- Auth Service
- Database Service
- Storage Service
- External Services
- Appwrite Backend (Authentication, Database, Storage microservices)
- TinyMCE (Rich Text Editor API)

b. Relationships & Data Flows
- User interacts with UI → dispatches Redux actions → Appwrite SDK calls → HTTP requests to Appwrite Auth/DB/Storage → responses back to SDK → Redux state updates → UI re-renders.
- RTE component issues API calls to TinyMCE’s cloud editor (for plugin/license).
- htmlparser2 used client-side to parse/render HTML content.

c. Architectural Patterns & Principles
- Separation of concerns:
- Presentation (components/pages)
- State (Redux)
- Service abstraction (src/appwrite wrappers)
- Serverless backend: leverages Appwrite microservices instead of custom Node/Express.
- Component-driven UI: reusable custom-components folder.

- React + TypeScript (UI/logic)
- Redux Toolkit (state)
- TailwindCSS (styling)
- Appwrite (auth, db, storage)
- TinyMCE & htmlparser2 (rich text + parsing)

## Diagram (Mermaid)

```mermaid
flowchart TD
  subgraph "Client-side (Browser)"
    direction TB
    Entry["Client Browser\nindex.html\nsrc/main.tsx"]:::frontend
    App["Root App Component\nsrc/App.tsx"]:::frontend

    subgraph "UI Layer"
      direction TB
      Home["Home Page"]:::frontend
      AddPost["Add Post Page"]:::frontend
      EditPost["Edit Post Page"]:::frontend
      ViewPost["View Single Post Page"]:::frontend
      YourPosts["Your Posts Page"]:::frontend
      LoginPage["Login Page"]:::frontend
      SignUpPage["SignUp Page"]:::frontend
      VerifyPage["Email Verification Page"]:::frontend

      subgraph "Components"
        direction TB
        LoginForm["Login Form"]:::frontend
        SignUpForm["SignUp Form"]:::frontend
        AuthIndex["Auth Index Barrel"]:::frontend
        HeaderBar["Header Bar"]:::frontend
        LogoutBtn["Logout Button"]:::frontend
        PostCard["Post Card"]:::frontend
        PostFormCmp["PostForm (Create/Edit)"]:::frontend
        PostIndex["Post Index Barrel"]:::frontend
        Protected["Protected Route Wrapper"]:::frontend
        RTE["Rich Text Editor"]:::frontend
        VerificationComp["Email Verification UI"]:::frontend
        CustComp["Custom Reusable UI Components"]:::frontend
      end
    end

    subgraph "Client Logic Layer"
      direction TB
      Store["Redux Store\nsrc/store/store.ts"]:::state
      AuthSlice["Auth Slice\nsrc/store/authSlice.ts"]:::state
      AuthSDK["Appwrite Auth Service"]:::sdk
      DBSDK["Appwrite Database Service"]:::sdk
      StorageSDK["Appwrite Storage Service"]:::sdk
      Conf["Configuration\nsrc/conf/conf.ts"]:::config
      Helpers["Utilities\nsrc/utils/helpers.ts"]:::util
      Types["Type Definitions\nsrc/types/types.ts"]:::types
    end
  end

  subgraph "Backend & External Services"
    direction TB
    AppwriteAuth["Appwrite Auth Microservice"]:::backend
    AppwriteDB["Appwrite Database Microservice"]:::backend
    AppwriteStorage["Appwrite Storage Microservice"]:::backend
    TinyMCE["TinyMCE Cloud API"]:::external
  end

  %% Relationships
  Entry --> App
  App --> Home
  App --> AddPost
  App --> EditPost
  App --> ViewPost
  App --> YourPosts
  App --> LoginPage
  App --> SignUpPage
  App --> VerifyPage

  Home -->|renders| PostCard
  AddPost -->|uses| PostFormCmp
  EditPost -->|uses| PostFormCmp
  ViewPost -->|renders| PostCard
  LoginPage -->|uses| LoginForm
  SignUpPage -->|uses| SignUpForm
  VerifyPage -->|uses| VerificationComp

  HeaderBar --> LogoutBtn
  App --> HeaderBar

  LoginForm -->|dispatches actions| AuthSlice
  SignUpForm -->|dispatches actions| AuthSlice
  PostFormCmp -->|dispatches actions| Store
  PostCard -->|dispatches actions| Store

  AuthSlice -->|calls| AuthSDK
  Store -->|calls| DBSDK
  Store -->|calls| StorageSDK

  AuthSDK -->|HTTP| AppwriteAuth
  DBSDK -->|HTTP| AppwriteDB
  StorageSDK -->|HTTP| AppwriteStorage

  RTE -->|API calls| TinyMCE
  ViewPost -->|parses HTML| Helpers

  Conf --> AuthSDK
  Conf --> DBSDK
  Conf --> StorageSDK
  Types --> Store
  Types --> Helpers

  %% Click Events
  click Entry "https://github.com/yashbitcode/react-blog-app/blob/main/src/main.tsx"
  click App "https://github.com/yashbitcode/react-blog-app/blob/main/src/App.tsx"
  click Home "https://github.com/yashbitcode/react-blog-app/blob/main/src/pages/Home.tsx"
  click AddPost "https://github.com/yashbitcode/react-blog-app/blob/main/src/pages/AddPost.tsx"
  click EditPost "https://github.com/yashbitcode/react-blog-app/blob/main/src/pages/EditPost.tsx"
  click ViewPost "https://github.com/yashbitcode/react-blog-app/blob/main/src/pages/Post.tsx"
  click YourPosts "https://github.com/yashbitcode/react-blog-app/blob/main/src/pages/YourPosts.tsx"
  click LoginPage "https://github.com/yashbitcode/react-blog-app/blob/main/src/pages/Login.tsx"
  click SignUpPage "https://github.com/yashbitcode/react-blog-app/blob/main/src/pages/SignUp.tsx"
  click VerifyPage "https://github.com/yashbitcode/react-blog-app/blob/main/src/pages/Verify.tsx"
  click LoginForm "https://github.com/yashbitcode/react-blog-app/blob/main/src/components/Auth/Login/Login.tsx"
  click SignUpForm "https://github.com/yashbitcode/react-blog-app/blob/main/src/components/Auth/SignUp/SignUp.tsx"
  click AuthIndex "https://github.com/yashbitcode/react-blog-app/blob/main/src/components/Auth/index.ts"
  click HeaderBar "https://github.com/yashbitcode/react-blog-app/blob/main/src/components/Header/Header.tsx"
  click LogoutBtn "https://github.com/yashbitcode/react-blog-app/blob/main/src/components/Header/Logout.tsx"
  click PostCard "https://github.com/yashbitcode/react-blog-app/blob/main/src/components/Post/PostCard.tsx"
  click PostFormCmp "https://github.com/yashbitcode/react-blog-app/blob/main/src/components/Post/PostForm/PostForm.tsx"
  click PostIndex "https://github.com/yashbitcode/react-blog-app/blob/main/src/components/Post/index.ts"
  click Protected "https://github.com/yashbitcode/react-blog-app/blob/main/src/components/Protected/Protected.tsx"
  click RTE "https://github.com/yashbitcode/react-blog-app/blob/main/src/components/RTE/RTE.tsx"
  click VerificationComp "https://github.com/yashbitcode/react-blog-app/blob/main/src/components/Verification/VerificationComp.tsx"
  click CustComp "https://github.com/yashbitcode/react-blog-app/blob/main/src/custom-components/index.ts"
  click Store "https://github.com/yashbitcode/react-blog-app/blob/main/src/store/store.ts"
  click AuthSlice "https://github.com/yashbitcode/react-blog-app/blob/main/src/store/authSlice.ts"
  click AuthSDK "https://github.com/yashbitcode/react-blog-app/blob/main/src/appwrite/auth.ts"
  click DBSDK "https://github.com/yashbitcode/react-blog-app/blob/main/src/appwrite/database.ts"
  click StorageSDK "https://github.com/yashbitcode/react-blog-app/blob/main/src/appwrite/storage.ts"
  click Conf "https://github.com/yashbitcode/react-blog-app/blob/main/src/conf/conf.ts"
  click Helpers "https://github.com/yashbitcode/react-blog-app/blob/main/src/utils/helpers.ts"
  click Types "https://github.com/yashbitcode/react-blog-app/blob/main/src/types/types.ts"

  %% Styles
  classDef frontend fill:#E8F0FE,stroke:#4285F4,color:#1A73E8;
  classDef state fill:#E8F5E9,stroke:#34A853,color:#188038;
  classDef sdk fill:#FFF4E5,stroke:#FBBC04,color:#C27803;
  classDef config fill:#F3E5F5,stroke:#A142F4,color:#6A1B9A;
  classDef util fill:#FFF3E0,stroke:#FB8C00,color:#E65100;
  classDef types fill:#E0F7FA,stroke:#00ACC1,color:#006064;
  classDef backend fill:#FFEBEE,stroke:#EA4335,color:#C50F1F;
  classDef external fill:#F1F8E9,stroke:#0F9D58,color:#33691E;
```
