# ashutosh-vaishnav/ngo-ashu architecture

> Architecture diagram of the GitHub repository ashutosh-vaishnav/ngo-ashu, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ashutosh-vaishnav/ngo-ashu
- Repository: https://github.com/ashutosh-vaishnav/ngo-ashu

## Overview

This is an NGO management application with a React client and Express API. Users authenticate and enter role-protected dashboards to manage campaigns, donations, people, events, reports, and settings; donors can initiate payments and review donation history. The donation path is the best-evidenced user-to-result workflow: the client donation page uses donation services, while the API controller delegates donation actions to its service. The repository index documents additional management areas, but their detailed call paths were not sampled, so those links are shown only where supported.

Main entry points: [`client/src/routes/AppRoutes.jsx`](https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/client/src/routes/AppRoutes.jsx) (Role-based routes), [`server/src/routes`](https://github.com/ashutosh-vaishnav/ngo-ashu/tree/main/server/src/routes) (API routes), [`client/src/App.jsx`](https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/client/src/App.jsx) (Web app), [`server/src/routes/authRoutes.js`](https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/server/src/routes/authRoutes.js) (Auth routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_webapp["Web app<br/>[App.jsx]"]
  node_routing["Role-based routes<br/>[AppRoutes.jsx]"]
  node_authstate["Auth state<br/>[AuthContext.jsx]"]
  node_authclient["Auth client<br/>[authService.js]"]
  node_donationspage["Donations page<br/>[DonationsPage.jsx]"]
  node_reports["Reports page<br/>[ReportsPage.jsx]"]
  node_settings["Settings page<br/>[SettingsPage.jsx]"]
  node_entitypages["Entity pages"]
  node_clientapi["API client<br/>[api.js]"]
  node_donationpageflow["Donation service client<br/>[donationService.js]"]
end

subgraph group_api["API and access"]
  node_appruntime["Express app<br/>[app.js]"]
  node_routes["API routes"]
  node_authroutes["Auth routes<br/>[authRoutes.js]"]
  node_access["Auth middleware<br/>[auth.js]"]
  node_authcontroller["Auth controller<br/>[authController.js]"]
  node_donationroutes["Donation routes<br/>[donationRoutes.js]"]
end

subgraph group_domain["Management domains"]
  node_authservice["Auth service<br/>[authService.js]"]
  node_donationcontroller["Donation controller"]
  node_donationservice["Donation service<br/>[donationService.js]"]
  node_management["Management services"]
  node_reportservice["Report service<br/>[reportService.js]"]
  node_settingscontroller["Settings controller"]
end

subgraph group_persistence["Data and payments"]
  node_userstore[("User model<br/>[User.js]")]
  node_donationmodels[("Donation models")]
  node_payments["Payment service<br/>[paymentService.js]"]
  node_database[("Database setup<br/>[database.js]")]
end

node_user(("User"))

node_user -->|"uses"| node_webapp
node_webapp -->|"renders"| node_routing
node_webapp -->|"provides auth"| node_authstate
node_routing -->|"routes to"| node_donationspage
node_routing -->|"routes to"| node_reports
node_routing -->|"routes to"| node_settings
node_routing -->|"routes to"| node_entitypages
node_authstate -->|"calls"| node_authclient
node_authclient -->|"uses"| node_clientapi
node_donationspage -->|"uses"| node_donationpageflow
node_donationpageflow -->|"uses"| node_clientapi
node_clientapi -.->|"requests"| node_routes
node_appruntime -->|"mounts"| node_routes
node_routes -.->|"registers"| node_authroutes
node_authroutes -->|"dispatches"| node_authcontroller
node_authroutes -->|"applies"| node_access
node_authcontroller -.->|"delegates to"| node_authservice
node_authservice -->|"reads and writes"| node_userstore
node_routes -.->|"registers"| node_donationroutes
node_donationroutes -->|"dispatches"| node_donationcontroller
node_donationroutes -->|"applies"| node_access
node_donationcontroller -->|"delegates to"| node_donationservice
node_donationservice -->|"uses"| node_donationmodels
node_donationservice -->|"calls"| node_payments
node_routes -.->|"registers"| node_management
node_reports -->|"uses"| node_reportservice
node_settings -.->|"requests"| node_settingscontroller
node_database -.->|"backs"| node_donationmodels

click node_webapp "https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/client/src/App.jsx"
click node_routing "https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/client/src/routes/AppRoutes.jsx"
click node_authstate "https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/client/src/context/AuthContext.jsx"
click node_authclient "https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/client/src/services/authService.js"
click node_donationspage "https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/client/src/pages/donations/DonationsPage.jsx"
click node_reports "https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/client/src/pages/reports/ReportsPage.jsx"
click node_settings "https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/client/src/pages/settings/SettingsPage.jsx"
click node_entitypages "https://github.com/ashutosh-vaishnav/ngo-ashu/tree/main/client/src/pages"
click node_clientapi "https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/client/src/services/api.js"
click node_appruntime "https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/server/src/app.js"
click node_routes "https://github.com/ashutosh-vaishnav/ngo-ashu/tree/main/server/src/routes"
click node_authroutes "https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/server/src/routes/authRoutes.js"
click node_access "https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/server/src/middleware/auth.js"
click node_authcontroller "https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/server/src/controllers/authController.js"
click node_authservice "https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/server/src/services/authService.js"
click node_donationpageflow "https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/client/src/services/donationService.js"
click node_donationroutes "https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/server/src/routes/donationRoutes.js"
click node_donationcontroller "https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/server/src/controllers/donationController.js"
click node_donationservice "https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/server/src/services/donationService.js"
click node_management "https://github.com/ashutosh-vaishnav/ngo-ashu/tree/main/server/src/services"
click node_reportservice "https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/server/src/services/reportService.js"
click node_settingscontroller "https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/server/src/controllers/settingsController.js"
click node_userstore "https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/server/src/models/User.js"
click node_donationmodels "https://github.com/ashutosh-vaishnav/ngo-ashu/tree/main/server/src/models"
click node_payments "https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/server/src/services/paymentService.js"
click node_database "https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/server/src/config/database.js"

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_webapp,node_routing,node_authstate,node_authclient,node_donationspage,node_reports,node_settings,node_entitypages,node_clientapi,node_donationpageflow,node_user toneBlue
class node_appruntime,node_routes,node_authroutes,node_access,node_authcontroller,node_donationroutes toneAmber
class node_authservice,node_donationcontroller,node_donationservice,node_management,node_reportservice,node_settingscontroller toneMint
class node_userstore,node_donationmodels,node_payments,node_database toneRose
```

## Components

### Web client

- [Web app](https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Role-based routes](https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/client/src/routes/AppRoutes.jsx): `client/src/routes/AppRoutes.jsx`
- [Auth state](https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/client/src/context/AuthContext.jsx): `client/src/context/AuthContext.jsx`
- [Auth client](https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/client/src/services/authService.js): `client/src/services/authService.js`
- [Donations page](https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/client/src/pages/donations/DonationsPage.jsx): `client/src/pages/donations/DonationsPage.jsx`
- [Reports page](https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/client/src/pages/reports/ReportsPage.jsx): `client/src/pages/reports/ReportsPage.jsx`
- [Settings page](https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/client/src/pages/settings/SettingsPage.jsx): `client/src/pages/settings/SettingsPage.jsx`
- [Entity pages](https://github.com/ashutosh-vaishnav/ngo-ashu/tree/main/client/src/pages): `client/src/pages`
- [API client](https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/client/src/services/api.js): `client/src/services/api.js`
- [Donation service client](https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/client/src/services/donationService.js): `client/src/services/donationService.js`

### API and access

- [Express app](https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/server/src/app.js): `server/src/app.js`
- [API routes](https://github.com/ashutosh-vaishnav/ngo-ashu/tree/main/server/src/routes): `server/src/routes`
- [Auth routes](https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/server/src/routes/authRoutes.js): `server/src/routes/authRoutes.js`
- [Auth middleware](https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/server/src/middleware/auth.js): `server/src/middleware/auth.js`
- [Auth controller](https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/server/src/controllers/authController.js): `server/src/controllers/authController.js`
- [Donation routes](https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/server/src/routes/donationRoutes.js): `server/src/routes/donationRoutes.js`

### Management domains

- [Auth service](https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/server/src/services/authService.js): `server/src/services/authService.js`
- [Donation controller](https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/server/src/controllers/donationController.js): `server/src/controllers/donationController.js`
- [Donation service](https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/server/src/services/donationService.js): `server/src/services/donationService.js`
- [Management services](https://github.com/ashutosh-vaishnav/ngo-ashu/tree/main/server/src/services): `server/src/services`
- [Report service](https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/server/src/services/reportService.js): `server/src/services/reportService.js`
- [Settings controller](https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/server/src/controllers/settingsController.js): `server/src/controllers/settingsController.js`

### Data and payments

- [User model](https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/server/src/models/User.js): `server/src/models/User.js`
- [Donation models](https://github.com/ashutosh-vaishnav/ngo-ashu/tree/main/server/src/models): `server/src/models`
- [Payment service](https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/server/src/services/paymentService.js): `server/src/services/paymentService.js`
- [Database setup](https://github.com/ashutosh-vaishnav/ngo-ashu/blob/main/server/src/config/database.js): `server/src/config/database.js`

### Other components

- **User**

## Connections

- User → Web app: uses
- Web app → Role-based routes: renders (evidence: `client/src/App.jsx`)
- Web app → Auth state: provides auth (evidence: `client/src/App.jsx`)
- Role-based routes → Donations page: routes to (evidence: `client/src/routes/AppRoutes.jsx`)
- Role-based routes → Reports page: routes to (evidence: `client/src/routes/AppRoutes.jsx`)
- Role-based routes → Settings page: routes to (evidence: `client/src/routes/AppRoutes.jsx`)
- Role-based routes → Entity pages: routes to (evidence: `client/src/routes/AppRoutes.jsx`)
- Auth state → Auth client: calls (evidence: `client/src/context/AuthContext.jsx`)
- Auth client → API client: uses (evidence: `client/src/services/authService.js`)
- Donations page → Donation service client: uses (evidence: `client/src/pages/donations/DonationsPage.jsx`)
- Donation service client → API client: uses (evidence: `client/src/services/donationService.js`)
- API client → API routes: requests
- Express app → API routes: mounts (evidence: `server/src/app.js`)
- API routes → Auth routes: registers
- Auth routes → Auth controller: dispatches (evidence: `server/src/routes/authRoutes.js`)
- Auth routes → Auth middleware: applies (evidence: `server/src/routes/authRoutes.js`)
- Auth controller → Auth service: delegates to
- Auth service → User model: reads and writes (evidence: `server/src/services/authService.js`)
- API routes → Donation routes: registers
- Donation routes → Donation controller: dispatches (evidence: `server/src/routes/donationRoutes.js`)
- Donation routes → Auth middleware: applies (evidence: `server/src/routes/donationRoutes.js`)
- Donation controller → Donation service: delegates to (evidence: `server/src/controllers/donationController.js`)
- Donation service → Donation models: uses (evidence: `server/src/services/donationService.js`)
- Donation service → Payment service: calls (evidence: `server/src/services/donationService.js`)
- API routes → Management services: registers
- Reports page → Report service: uses (evidence: `client/src/pages/reports/ReportsPage.jsx`)
- Settings page → Settings controller: requests
- Database setup → Donation models: backs
