# rishi-269/blogweave architecture

> Architecture diagram of the GitHub repository rishi-269/blogweave, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rishi-269/blogweave
- Repository: https://github.com/rishi-269/blogweave

## Overview

1. This is a client-side React SPA built with Vite. The repository is frontend-only: `src/main.jsx` bootstraps the app, and the UI is composed from page components plus shared layout/controls.

2. The application is organized around route-level screens in `src/pages`: `Home`, `Login`, `Signup`, `Post`, `Profile`, `MyPosts`, `AddPost`, and `EditPost`. These are the main entry points for user flows and are what you would place as top-level boxes in an architecture diagram.

3. Authentication is handled through Appwrite, with a thin service boundary in `src/appwrite/auth.js`. The app uses `src/store/authSlice.js` and `src/store/store.js` as the local client-side auth state layer, so login/session state is not managed directly inside individual pages.

4. Content/data access is also abstracted behind Appwrite in `src/appwrite/db.js`. That file is the likely boundary for CRUD operations against the backend database, and the post-related pages depend on it rather than talking to Appwrite directly.

5. `src/conf/conf.js` centralizes environment-specific configuration, likely including Appwrite project/database identifiers loaded from `.env`. This is the repo’s main configuration boundary between local code and external services.

6. The post creation/editing workflow is concentrated in `src/components/PostForm/PostForm.jsx`, with `RTE.jsx` for rich-text input and `Select.jsx`/`Input.jsx` for form controls. `AddPost` and `EditPost` likely share this form component, which is an important reuse boundary in the UI.

7. App chrome is split into reusable layout components: `Header`, `Footer`, `Container`, `Logo`, `LogoutBtn`, and `AuthLayout`. `AuthLayout` is especially important because it likely wraps protected or auth-related screens and enforces the login/session boundary.

8. The component library in `src/components` also includes generic primitives like `Button`, `Card`, and `Input`. These keep styling and behavior consistent across pages and reduce direct markup duplication in the route screens.

9. The main data flow is: user interacts with a page → page calls Appwrite service helpers → backend state changes → Redux auth state updates where relevant → UI re-renders through route and layout components. For post views, the flow is similar but centered on database reads/writes rather than auth state.

10. The likely protected areas are `AddPost`, `EditPost`, `MyPosts`, and `Profile`, while `Home`, `Post`, `Login`, and `Signup` are more public-facing. In a diagram, separate “public routes” from “authenticated routes” and show `AuthLayout` as the guard.

11. Styling and build tooling are standard frontend infrastructure: Tailwind CSS with PostCSS, plus Vite and ESLint. `src/index.css` and `src/App.css` define the base/global styling layer, while `public` and `src/assets` hold static resources.

12. `src/pages/index.js` and `src/components/index.js` are barrel exports that simplify imports across the app. This is a small but useful structural detail: the codebase is organized for clean module boundaries rather than deep relative import chains.

Main entry points: [`src/App.jsx`](https://github.com/rishi-269/blogweave/blob/main/src/App.jsx) (App), [`src/appwrite/auth.js`](https://github.com/rishi-269/blogweave/blob/main/src/appwrite/auth.js) (Auth API), [`src/appwrite/db.js`](https://github.com/rishi-269/blogweave/blob/main/src/appwrite/db.js) (DB API), [`src/components/AuthLayout.jsx`](https://github.com/rishi-269/blogweave/blob/main/src/components/AuthLayout.jsx) (AuthLayout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_main["main.jsx<br/>entry<br/>[main.jsx]"]
  node_app["App<br/>router shell<br/>[App.jsx]"]
end

subgraph group_routes["Routes"]
  node_home["Home<br/>public page<br/>[Home.jsx]"]
  node_login["Login<br/>auth page<br/>[Login.jsx]"]
  node_signup["Signup<br/>auth page<br/>[Signup.jsx]"]
  node_post["Post<br/>content page<br/>[Post.jsx]"]
  node_profile["Profile<br/>account page<br/>[Profile.jsx]"]
  node_myposts["My Posts<br/>content page<br/>[MyPosts.jsx]"]
  node_addpost["Add Post<br/>editor page<br/>[AddPost.jsx]"]
  node_editpost["Edit Post<br/>editor page<br/>[EditPost.jsx]"]
end

subgraph group_services["Services"]
  node_authsvc["Auth API<br/>appwrite auth<br/>[auth.js]"]
  node_dbsvc["DB API<br/>appwrite db<br/>[db.js]"]
end

subgraph group_state["State"]
  node_authstate["Auth Slice<br/>redux slice<br/>[authSlice.js]"]
  node_store["Store<br/>[store.js]"]
end

subgraph group_ui["UI"]
  node_authlayout["AuthLayout<br/>route guard<br/>[AuthLayout.jsx]"]
  node_header["Header<br/>layout chrome<br/>[Header.jsx]"]
  node_footer["Footer<br/>layout chrome<br/>[Footer.jsx]"]
  node_container["Container<br/>layout wrapper<br/>[Container.jsx]"]
  node_postform["PostForm<br/>editor form<br/>[PostForm.jsx]"]
  node_rte["RTE<br/>rich text<br/>[RTE.jsx]"]
  node_controls["Controls<br/>form primitives<br/>[index.js]"]
end

subgraph group_config["Config"]
  node_conf["Config<br/>[conf.js]"]
end

subgraph group_style["Styling"]
  node_globalcss["Global CSS<br/>styles<br/>[index.css]"]
  node_appcss["App CSS<br/>styles<br/>[App.css]"]
end

node_main -->|"mounts"| node_app
node_app -->|"routes"| node_home
node_app -->|"routes"| node_login
node_app -->|"routes"| node_signup
node_app -->|"routes"| node_post
node_app -->|"routes"| node_profile
node_app -->|"routes"| node_myposts
node_app -->|"routes"| node_addpost
node_app -->|"routes"| node_editpost
node_addpost -->|"guarded by"| node_authlayout
node_editpost -->|"guarded by"| node_authlayout
node_myposts -->|"guarded by"| node_authlayout
node_profile -->|"guarded by"| node_authlayout
node_home -->|"uses"| node_header
node_home -->|"uses"| node_footer
node_login -->|"uses"| node_authlayout
node_signup -->|"uses"| node_authlayout
node_addpost -->|"uses"| node_postform
node_editpost -->|"uses"| node_postform
node_postform -->|"composes"| node_rte
node_postform -->|"composes"| node_controls
node_header -->|"composes"| node_controls
node_header -->|"session"| node_authsvc
node_authsvc -->|"config"| node_conf
node_dbsvc -->|"config"| node_conf
node_login -->|"auth"| node_authsvc
node_signup -->|"auth"| node_authsvc
node_profile -->|"session"| node_authsvc
node_myposts -->|"reads"| node_dbsvc
node_home -->|"reads"| node_dbsvc
node_post -->|"reads"| node_dbsvc
node_addpost -->|"writes"| node_dbsvc
node_editpost -->|"writes"| node_dbsvc
node_app -->|"wires"| node_store
node_store -->|"contains"| node_authstate
node_authsvc -->|"updates"| node_authstate
node_globalcss -->|"styles"| node_app
node_appcss -->|"styles"| node_app

click node_main "https://github.com/rishi-269/blogweave/blob/main/src/main.jsx"
click node_app "https://github.com/rishi-269/blogweave/blob/main/src/App.jsx"
click node_home "https://github.com/rishi-269/blogweave/blob/main/src/pages/Home.jsx"
click node_login "https://github.com/rishi-269/blogweave/blob/main/src/pages/Login.jsx"
click node_signup "https://github.com/rishi-269/blogweave/blob/main/src/pages/Signup.jsx"
click node_post "https://github.com/rishi-269/blogweave/blob/main/src/pages/Post.jsx"
click node_profile "https://github.com/rishi-269/blogweave/blob/main/src/pages/Profile.jsx"
click node_myposts "https://github.com/rishi-269/blogweave/blob/main/src/pages/MyPosts.jsx"
click node_addpost "https://github.com/rishi-269/blogweave/blob/main/src/pages/AddPost.jsx"
click node_editpost "https://github.com/rishi-269/blogweave/blob/main/src/pages/EditPost.jsx"
click node_authlayout "https://github.com/rishi-269/blogweave/blob/main/src/components/AuthLayout.jsx"
click node_header "https://github.com/rishi-269/blogweave/blob/main/src/components/Header/Header.jsx"
click node_footer "https://github.com/rishi-269/blogweave/blob/main/src/components/Footer/Footer.jsx"
click node_container "https://github.com/rishi-269/blogweave/blob/main/src/components/Container/Container.jsx"
click node_postform "https://github.com/rishi-269/blogweave/blob/main/src/components/PostForm/PostForm.jsx"
click node_rte "https://github.com/rishi-269/blogweave/blob/main/src/components/RTE.jsx"
click node_controls "https://github.com/rishi-269/blogweave/blob/main/src/components/index.js"
click node_authsvc "https://github.com/rishi-269/blogweave/blob/main/src/appwrite/auth.js"
click node_dbsvc "https://github.com/rishi-269/blogweave/blob/main/src/appwrite/db.js"
click node_authstate "https://github.com/rishi-269/blogweave/blob/main/src/store/authSlice.js"
click node_store "https://github.com/rishi-269/blogweave/blob/main/src/store/store.js"
click node_conf "https://github.com/rishi-269/blogweave/blob/main/src/conf/conf.js"
click node_globalcss "https://github.com/rishi-269/blogweave/blob/main/src/index.css"
click node_appcss "https://github.com/rishi-269/blogweave/blob/main/src/App.css"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_app,node_globalcss,node_appcss toneBlue
class node_home,node_login,node_signup,node_post,node_profile,node_myposts,node_addpost,node_editpost toneAmber
class node_authsvc,node_dbsvc toneMint
class node_authstate,node_store toneRose
class node_authlayout,node_header,node_footer,node_container,node_postform,node_rte,node_controls toneIndigo
class node_conf toneTeal
```

## Components

### Runtime

Frontend bootstrap and app shell

- [main.jsx](https://github.com/rishi-269/blogweave/blob/main/src/main.jsx): entry · Bootstraps the React app · `src/main.jsx`
- [App](https://github.com/rishi-269/blogweave/blob/main/src/App.jsx): router shell · Top-level app composition and routing · `src/App.jsx`

### Routes

Top-level screens and route-level flows

- [Home](https://github.com/rishi-269/blogweave/blob/main/src/pages/Home.jsx): public page · Landing and feed entry point · `src/pages/Home.jsx`
- [Login](https://github.com/rishi-269/blogweave/blob/main/src/pages/Login.jsx): auth page · Sign-in flow · `src/pages/Login.jsx`
- [Signup](https://github.com/rishi-269/blogweave/blob/main/src/pages/Signup.jsx): auth page · Account creation flow · `src/pages/Signup.jsx`
- [Post](https://github.com/rishi-269/blogweave/blob/main/src/pages/Post.jsx): content page · Single post view · `src/pages/Post.jsx`
- [Profile](https://github.com/rishi-269/blogweave/blob/main/src/pages/Profile.jsx): account page · User profile and account view · `src/pages/Profile.jsx`
- [My Posts](https://github.com/rishi-269/blogweave/blob/main/src/pages/MyPosts.jsx): content page · User-owned posts listing · `src/pages/MyPosts.jsx`
- [Add Post](https://github.com/rishi-269/blogweave/blob/main/src/pages/AddPost.jsx): editor page · Create-post flow · `src/pages/AddPost.jsx`
- [Edit Post](https://github.com/rishi-269/blogweave/blob/main/src/pages/EditPost.jsx): editor page · Update-post flow · `src/pages/EditPost.jsx`

### Services

Appwrite-backed data and auth boundaries

- [Auth API](https://github.com/rishi-269/blogweave/blob/main/src/appwrite/auth.js): appwrite auth · Authentication and session helpers · `src/appwrite/auth.js`
- [DB API](https://github.com/rishi-269/blogweave/blob/main/src/appwrite/db.js): appwrite db · Post and content CRUD helpers · `src/appwrite/db.js`

### State

Client-side auth state management

- [Auth Slice](https://github.com/rishi-269/blogweave/blob/main/src/store/authSlice.js): redux slice · Client-side auth/session state · `src/store/authSlice.js`
- [Store](https://github.com/rishi-269/blogweave/blob/main/src/store/store.js): redux store · Redux store wiring · `src/store/store.js`

### UI

Reusable layout and form components

- [AuthLayout](https://github.com/rishi-269/blogweave/blob/main/src/components/AuthLayout.jsx): route guard · Wraps protected or auth-related screens · `src/components/AuthLayout.jsx`
- [Header](https://github.com/rishi-269/blogweave/blob/main/src/components/Header/Header.jsx): layout chrome · Top navigation and session actions · `src/components/Header/Header.jsx`
- [Footer](https://github.com/rishi-269/blogweave/blob/main/src/components/Footer/Footer.jsx): layout chrome · App footer · `src/components/Footer/Footer.jsx`
- [Container](https://github.com/rishi-269/blogweave/blob/main/src/components/Container/Container.jsx): layout wrapper · Shared page width and spacing wrapper · `src/components/Container/Container.jsx`
- [PostForm](https://github.com/rishi-269/blogweave/blob/main/src/components/PostForm/PostForm.jsx): editor form · Shared create/edit post form · `src/components/PostForm/PostForm.jsx`
- [RTE](https://github.com/rishi-269/blogweave/blob/main/src/components/RTE.jsx): rich text · Rich-text editor field · `src/components/RTE.jsx`
- [Controls](https://github.com/rishi-269/blogweave/blob/main/src/components/index.js): form primitives · Shared buttons, inputs, selects, and card UI · `src/components/index.js`

### Config

Environment and app configuration

- [Config](https://github.com/rishi-269/blogweave/blob/main/src/conf/conf.js): env config · Environment and Appwrite configuration · `src/conf/conf.js`

### Styling

Global styles and build-time CSS setup

- [Global CSS](https://github.com/rishi-269/blogweave/blob/main/src/index.css): styles · Base application styling · `src/index.css`
- [App CSS](https://github.com/rishi-269/blogweave/blob/main/src/App.css): styles · App-level styling overrides · `src/App.css`

## Connections

- main.jsx → App: mounts · Entry point renders the application
- App → Home: routes · Defines the public landing route
- App → Login: routes · Defines the login route
- App → Signup: routes · Defines the signup route
- App → Post: routes · Defines the single post route
- App → Profile: routes · Defines the profile route
- App → My Posts: routes · Defines the user posts route
- App → Add Post: routes · Defines the create post route
- App → Edit Post: routes · Defines the edit post route
- Add Post → AuthLayout: guarded by · Create flow is protected
- Edit Post → AuthLayout: guarded by · Edit flow is protected
- My Posts → AuthLayout: guarded by · User posts view is protected
- Profile → AuthLayout: guarded by · Profile view is protected
- Home → Header: uses · Shares global chrome
- Home → Footer: uses · Shares global chrome
- Login → AuthLayout: uses · Uses auth-specific layout
- Signup → AuthLayout: uses · Uses auth-specific layout
- Add Post → PostForm: uses · Create flow reuses post form
- Edit Post → PostForm: uses · Edit flow reuses post form
- PostForm → RTE: composes · Embeds rich-text editor
- PostForm → Controls: composes · Uses shared form primitives
- Header → Controls: composes · Uses shared UI primitives
- Header → Auth API: session · Supports login/logout actions
- Auth API → Config: config · Reads Appwrite environment settings
- DB API → Config: config · Reads Appwrite environment settings
- Login → Auth API: auth · Authenticates users
- Signup → Auth API: auth · Registers users
- Profile → Auth API: session · Reads current session context
- My Posts → DB API: reads · Loads user posts
- Home → DB API: reads · Loads post data
- Post → DB API: reads · Loads a single post
- Add Post → DB API: writes · Creates posts
- Edit Post → DB API: writes · Updates posts
- App → Store: wires · Connects app to client state
- Store → Auth Slice: contains · Registers auth slice
- Auth API → Auth Slice: updates · Auth actions feed local state
- Global CSS → App: styles · Global base styles apply to app shell
- App CSS → App: styles · App-level styles apply to app shell
