# mahi-rejone/bloodflow architecture

> Architecture diagram of the GitHub repository mahi-rejone/bloodflow, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mahi-rejone/bloodflow
- Repository: https://github.com/mahi-rejone/bloodflow

## Overview

BloodFlow is a blood-donation coordination web app: users authenticate, discover donors and blood requests, and can notify nearby donors; role-based areas also support profiles, donations, and administration. The sampled code shows login/session state and nearby-donor alerting, while the file tree identifies broader request, donation, event, blog, and user-management areas. Connections to unsampled pages are omitted where the index does not establish their runtime calls.

Main entry points: [`src/redux/api/baseApi.tsx`](https://github.com/mahi-rejone/bloodflow/blob/main/src/redux/api/baseApi.tsx) (API Base Query), [`src/redux/feature/user/userApi.ts`](https://github.com/mahi-rejone/bloodflow/blob/main/src/redux/feature/user/userApi.ts) (User Management), [`src/app/(AuthPage)/login/page.tsx`](https://github.com/mahi-rejone/bloodflow/blob/main/src/app/(AuthPage)/login/page.tsx) (Sign In), [`src/redux/feature/notification/notificationApi.ts`](https://github.com/mahi-rejone/bloodflow/blob/main/src/redux/feature/notification/notificationApi.ts) (Notification API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_auth["Authentication"]
  node_login["Sign In<br/>[page.tsx]"]
  node_register["Registration<br/>[page.tsx]"]
  node_verification["Email Verification<br/>[page.tsx]"]
  node_session["Session Route<br/>[route.ts]"]
end

subgraph group_coordination["Donor Coordination"]
  node_home["Home and Donor Discovery<br/>[heroBanner.tsx]"]
  node_requests["Blood Requests<br/>[page.tsx]"]
  node_nearby["Nearby Alerts<br/>[useNotifyNearby.ts]"]
  node_donors["Donor Profiles<br/>[page.tsx]"]
  node_notifications["Notification Panel"]
end

subgraph group_engagement["Donations and Content"]
  node_donation["Donation Flows<br/>[page.tsx]"]
  node_donation_api["Donation API<br/>[donationApi.ts]"]
  node_blogs["Blog Pages<br/>[page.tsx]"]
  node_blog_api["Blog API<br/>[blogApi.ts]"]
  node_events["Event Pages<br/>[page.tsx]"]
  node_event_api["Event API<br/>[eventApi.ts]"]
end

subgraph group_admin["Role Administration"]
  node_admin["Admin Workspace<br/>[page.tsx]"]
  node_users["User Management<br/>[userApi.ts]"]
  node_routes["Role Route Generator"]
  node_sidebar["Sidebar UI<br/>[sidebar.tsx]"]
end

subgraph group_state["Client State and API"]
  node_auth_api["Authentication API<br/>[authApi.ts]"]
  node_blood_api["Blood Request API<br/>[bloodRequestApi.ts]"]
  node_notification_api["Notification API<br/>[notificationApi.ts]"]
  node_base_api["API Base Query<br/>[baseApi.tsx]"]
  node_auth_state["Auth State<br/>[authSlice.ts]"]
  node_store["Redux Store<br/>[store.ts]"]
end

node_user(("User"))

node_user -->|"submits credentials"| node_login
node_login -->|"requests login"| node_auth_api
node_login -->|"creates session"| node_session
node_login -->|"sets credentials"| node_auth_state
node_register -->|"registers user"| node_users
node_verification -->|"verifies user"| node_users
node_auth_api -->|"injects endpoints"| node_base_api
node_blood_api -->|"uses base query"| node_base_api
node_notification_api -->|"injects endpoints"| node_base_api
node_users -->|"injects endpoints"| node_base_api
node_base_api -->|"refreshes credentials"| node_auth_state
node_store -->|"combines reducer"| node_auth_state
node_store -->|"registers API middleware"| node_base_api
node_home -->|"queries requests"| node_blood_api
node_home -->|"queries donors"| node_users
node_requests -->|"loads requests"| node_blood_api
node_requests -->|"loads users"| node_users
node_requests -->|"uses notifications"| node_notification_api
node_nearby -->|"sends nearby alert"| node_notification_api
node_notifications -->|"loads notifications"| node_notification_api
node_blogs -->|"loads blog posts"| node_blog_api
node_routes -->|"renders sidebar items"| node_sidebar

click node_login "https://github.com/mahi-rejone/bloodflow/blob/main/src/app/(AuthPage)/login/page.tsx"
click node_register "https://github.com/mahi-rejone/bloodflow/blob/main/src/app/(AuthPage)/register/page.tsx"
click node_verification "https://github.com/mahi-rejone/bloodflow/blob/main/src/app/(AuthPage)/verify/page.tsx"
click node_session "https://github.com/mahi-rejone/bloodflow/blob/main/src/app/(AuthPage)/api/auth/session/route.ts"
click node_home "https://github.com/mahi-rejone/bloodflow/blob/main/src/components/home/heroBanner.tsx"
click node_requests "https://github.com/mahi-rejone/bloodflow/blob/main/src/app/(MainPage)/(withnav)/requests/page.tsx"
click node_nearby "https://github.com/mahi-rejone/bloodflow/blob/main/src/hooks/useNotifyNearby.ts"
click node_donors "https://github.com/mahi-rejone/bloodflow/blob/main/src/app/(MainPage)/(withnav)/(Authorized)/donors/%5Bid%5D/page.tsx"
click node_donation "https://github.com/mahi-rejone/bloodflow/blob/main/src/app/(MainPage)/(withnav)/(Authorized)/donate/page.tsx"
click node_donation_api "https://github.com/mahi-rejone/bloodflow/blob/main/src/redux/feature/donation/donationApi.ts"
click node_blogs "https://github.com/mahi-rejone/bloodflow/blob/main/src/app/(MainPage)/(withnav)/blogs/page.tsx"
click node_blog_api "https://github.com/mahi-rejone/bloodflow/blob/main/src/redux/feature/blog/blogApi.ts"
click node_events "https://github.com/mahi-rejone/bloodflow/blob/main/src/app/(MainPage)/(withnav)/events/%5Bid%5D/page.tsx"
click node_event_api "https://github.com/mahi-rejone/bloodflow/blob/main/src/redux/feature/event/eventApi.ts"
click node_admin "https://github.com/mahi-rejone/bloodflow/blob/main/src/app/(MainPage)/(withoutnav)/(Authorized)/%5Brole%5D/(sidebar_pages)/dashboard/page.tsx"
click node_users "https://github.com/mahi-rejone/bloodflow/blob/main/src/redux/feature/user/userApi.ts"
click node_notifications "https://github.com/mahi-rejone/bloodflow/blob/main/src/components/NotificationsPanel.tsx"
click node_auth_api "https://github.com/mahi-rejone/bloodflow/blob/main/src/redux/feature/auth/authApi.ts"
click node_blood_api "https://github.com/mahi-rejone/bloodflow/blob/main/src/redux/feature/blood/bloodRequestApi.ts"
click node_notification_api "https://github.com/mahi-rejone/bloodflow/blob/main/src/redux/feature/notification/notificationApi.ts"
click node_base_api "https://github.com/mahi-rejone/bloodflow/blob/main/src/redux/api/baseApi.tsx"
click node_auth_state "https://github.com/mahi-rejone/bloodflow/blob/main/src/redux/feature/authSlice.ts"
click node_store "https://github.com/mahi-rejone/bloodflow/blob/main/src/redux/store/store.ts"
click node_routes "https://github.com/mahi-rejone/bloodflow/blob/main/src/utils/RouteGeneratior.tsx"
click node_sidebar "https://github.com/mahi-rejone/bloodflow/blob/main/src/components/ui/sidebar.tsx"

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_login,node_register,node_verification,node_session,node_user toneBlue
class node_home,node_requests,node_nearby,node_donors,node_notifications toneAmber
class node_donation,node_donation_api,node_blogs,node_blog_api,node_events,node_event_api toneMint
class node_admin,node_users,node_routes,node_sidebar toneRose
class node_auth_api,node_blood_api,node_notification_api,node_base_api,node_auth_state,node_store toneIndigo
```

## Components

### Authentication

- [Sign In](https://github.com/mahi-rejone/bloodflow/blob/main/src/app/(AuthPage)/login/page.tsx): `src/app/(AuthPage)/login/page.tsx`
- [Registration](https://github.com/mahi-rejone/bloodflow/blob/main/src/app/(AuthPage)/register/page.tsx): `src/app/(AuthPage)/register/page.tsx`
- [Email Verification](https://github.com/mahi-rejone/bloodflow/blob/main/src/app/(AuthPage)/verify/page.tsx): `src/app/(AuthPage)/verify/page.tsx`
- [Session Route](https://github.com/mahi-rejone/bloodflow/blob/main/src/app/(AuthPage)/api/auth/session/route.ts): `src/app/(AuthPage)/api/auth/session/route.ts`

### Donor Coordination

- [Home and Donor Discovery](https://github.com/mahi-rejone/bloodflow/blob/main/src/components/home/heroBanner.tsx): `src/components/home/heroBanner.tsx`
- [Blood Requests](https://github.com/mahi-rejone/bloodflow/blob/main/src/app/(MainPage)/(withnav)/requests/page.tsx): `src/app/(MainPage)/(withnav)/requests/page.tsx`
- [Nearby Alerts](https://github.com/mahi-rejone/bloodflow/blob/main/src/hooks/useNotifyNearby.ts): `src/hooks/useNotifyNearby.ts`
- [Donor Profiles](https://github.com/mahi-rejone/bloodflow/blob/main/src/app/(MainPage)/(withnav)/(Authorized)/donors/%5Bid%5D/page.tsx): `src/app/(MainPage)/(withnav)/(Authorized)/donors/[id]/page.tsx`
- [Notification Panel](https://github.com/mahi-rejone/bloodflow/blob/main/src/components/NotificationsPanel.tsx): `src/components/NotificationsPanel.tsx`

### Donations and Content

- [Donation Flows](https://github.com/mahi-rejone/bloodflow/blob/main/src/app/(MainPage)/(withnav)/(Authorized)/donate/page.tsx): `src/app/(MainPage)/(withnav)/(Authorized)/donate/page.tsx`
- [Donation API](https://github.com/mahi-rejone/bloodflow/blob/main/src/redux/feature/donation/donationApi.ts): `src/redux/feature/donation/donationApi.ts`
- [Blog Pages](https://github.com/mahi-rejone/bloodflow/blob/main/src/app/(MainPage)/(withnav)/blogs/page.tsx): `src/app/(MainPage)/(withnav)/blogs/page.tsx`
- [Blog API](https://github.com/mahi-rejone/bloodflow/blob/main/src/redux/feature/blog/blogApi.ts): `src/redux/feature/blog/blogApi.ts`
- [Event Pages](https://github.com/mahi-rejone/bloodflow/blob/main/src/app/(MainPage)/(withnav)/events/%5Bid%5D/page.tsx): `src/app/(MainPage)/(withnav)/events/[id]/page.tsx`
- [Event API](https://github.com/mahi-rejone/bloodflow/blob/main/src/redux/feature/event/eventApi.ts): `src/redux/feature/event/eventApi.ts`

### Role Administration

- [Admin Workspace](https://github.com/mahi-rejone/bloodflow/blob/main/src/app/(MainPage)/(withoutnav)/(Authorized)/%5Brole%5D/(sidebar_pages)/dashboard/page.tsx): `src/app/(MainPage)/(withoutnav)/(Authorized)/[role]/(sidebar_pages)/dashboard/page.tsx`
- [User Management](https://github.com/mahi-rejone/bloodflow/blob/main/src/redux/feature/user/userApi.ts): `src/redux/feature/user/userApi.ts`
- [Role Route Generator](https://github.com/mahi-rejone/bloodflow/blob/main/src/utils/RouteGeneratior.tsx): `src/utils/RouteGeneratior.tsx`
- [Sidebar UI](https://github.com/mahi-rejone/bloodflow/blob/main/src/components/ui/sidebar.tsx): `src/components/ui/sidebar.tsx`

### Client State and API

- [Authentication API](https://github.com/mahi-rejone/bloodflow/blob/main/src/redux/feature/auth/authApi.ts): `src/redux/feature/auth/authApi.ts`
- [Blood Request API](https://github.com/mahi-rejone/bloodflow/blob/main/src/redux/feature/blood/bloodRequestApi.ts): `src/redux/feature/blood/bloodRequestApi.ts`
- [Notification API](https://github.com/mahi-rejone/bloodflow/blob/main/src/redux/feature/notification/notificationApi.ts): `src/redux/feature/notification/notificationApi.ts`
- [API Base Query](https://github.com/mahi-rejone/bloodflow/blob/main/src/redux/api/baseApi.tsx): `src/redux/api/baseApi.tsx`
- [Auth State](https://github.com/mahi-rejone/bloodflow/blob/main/src/redux/feature/authSlice.ts): `src/redux/feature/authSlice.ts`
- [Redux Store](https://github.com/mahi-rejone/bloodflow/blob/main/src/redux/store/store.ts): `src/redux/store/store.ts`

### Other components

- **User**

## Connections

- User → Sign In: submits credentials (evidence: `src/app/(AuthPage)/login/page.tsx`)
- Sign In → Authentication API: requests login (evidence: `src/app/(AuthPage)/login/page.tsx`)
- Sign In → Session Route: creates session (evidence: `src/app/(AuthPage)/login/page.tsx`)
- Sign In → Auth State: sets credentials (evidence: `src/app/(AuthPage)/login/page.tsx`)
- Registration → User Management: registers user (evidence: `src/app/(AuthPage)/register/page.tsx`)
- Email Verification → User Management: verifies user (evidence: `src/app/(AuthPage)/verify/page.tsx`)
- Authentication API → API Base Query: injects endpoints (evidence: `src/redux/feature/auth/authApi.ts`)
- Blood Request API → API Base Query: uses base query (evidence: `src/redux/feature/blood/bloodRequestApi.ts`)
- Notification API → API Base Query: injects endpoints (evidence: `src/redux/feature/notification/notificationApi.ts`)
- User Management → API Base Query: injects endpoints (evidence: `src/redux/feature/user/userApi.ts`)
- API Base Query → Auth State: refreshes credentials (evidence: `src/redux/api/baseApi.tsx`)
- Redux Store → Auth State: combines reducer (evidence: `src/redux/store/store.ts`)
- Redux Store → API Base Query: registers API middleware (evidence: `src/redux/store/store.ts`)
- Home and Donor Discovery → Blood Request API: queries requests (evidence: `src/components/home/heroBanner.tsx`)
- Home and Donor Discovery → User Management: queries donors (evidence: `src/components/home/heroBanner.tsx`)
- Blood Requests → Blood Request API: loads requests (evidence: `src/app/(MainPage)/(withnav)/requests/page.tsx`)
- Blood Requests → User Management: loads users (evidence: `src/app/(MainPage)/(withnav)/requests/page.tsx`)
- Blood Requests → Notification API: uses notifications (evidence: `src/app/(MainPage)/(withnav)/requests/page.tsx`)
- Nearby Alerts → Notification API: sends nearby alert (evidence: `src/hooks/useNotifyNearby.ts`)
- Notification Panel → Notification API: loads notifications (evidence: `src/components/NotificationsPanel.tsx`)
- Blog Pages → Blog API: loads blog posts (evidence: `src/app/(MainPage)/(withnav)/blogs/page.tsx`)
- Role Route Generator → Sidebar UI: renders sidebar items (evidence: `src/utils/RouteGeneratior.tsx`)
