# hoangnguyenkim/kindwave architecture

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

- Interactive diagram: https://gitdiagram.com/hoangnguyenkim/kindwave
- Repository: https://github.com/hoangnguyenkim/kindwave

## Overview

#### Purpose and entry points
KindWave is a TypeScript fundraising/campaign application with donor, organizer, administrator, and volunteer experiences. The browser client starts at `src/main.tsx`, renders the application shell in `src/App.tsx`, and is served by Vite (`vite.config.ts`). A Node/TypeScript backend entry point exists at `server.ts`.

#### Client application shell and navigation
`src/App.tsx` is the primary UI composition and view-selection boundary. Shared navigation, authentication presentation, notifications, and layout components live in `src/components/Navbar.tsx`, `src/components/LoginView.tsx`, and `src/components/ToastContainer.tsx`. The static host document is `index.html`.

#### Role-specific product surfaces
Feature-level views separate the primary user workflows:
- Public discovery and campaign browsing: `src/features/HomeView.tsx`, `src/features/CampaignDetailView.tsx`
- Donor activity: `src/features/DonorDashboard.tsx`
- Campaign management: `src/features/OrganizerDashboard.tsx`
- Administrative oversight: `src/features/AdminDashboard.tsx`
- Volunteer participation: `src/features/VolunteerHub.tsx`

These views form the main control boundary between role-specific workflows and reusable presentation components.

#### Campaign and donation workflow
Campaign discovery and display are centered on `src/components/CampaignCard.tsx` and `src/features/CampaignDetailView.tsx`. Campaign creation/editing is modeled as a guided UI flow in `src/components/CampaignWizard.tsx`. Donation capture is isolated in `src/components/DonationModal.tsx`, allowing campaign views and dashboards to invoke contribution actions without owning that UI state.

#### Data model and persistence boundary
Client-side domain types are centralized in `src/types.ts`; seeded or fallback application data is in `src/data/initialData.ts`. Server persistence is isolated behind `server/db.ts`, with repository data artifacts `db-store.json`, `db-images.json`, and `metadata.json`. This establishes a clear boundary: React features consume application state/data, while server/database code owns durable storage access.

#### Backend and external service runtime
The application requires Node.js and uses a local development command from `package.json`. `server.ts` likely hosts API behavior used by the client, while `server/db.ts` manages storage operations. The README requires `GEMINI_API_KEY` through `.env.local`, indicating an integration with Google Gemini/AI Studio; `.env.example` documents the environment-variable contract. The AI service should remain server-side or otherwise protected from direct browser key exposure.

#### Validation and delivery
API behavior is covered at the backend boundary by `test/api.test.ts`. Build/runtime configuration is split between `vite.config.ts` for the frontend and `vitest.config.ts` for testing, with TypeScript compilation governed by `tsconfig.json`.

Main entry points: [`src/App.tsx`](https://github.com/hoangnguyenkim/kindwave/blob/main/src/App.tsx) (Application shell), [`src/features/HomeView.tsx`](https://github.com/hoangnguyenkim/kindwave/blob/main/src/features/HomeView.tsx) (Discovery and campaign detail), [`server.ts`](https://github.com/hoangnguyenkim/kindwave/blob/main/server.ts) (Node API server), [`index.html`](https://github.com/hoangnguyenkim/kindwave/blob/main/index.html) (Static host document)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser client"]
  node_host["Static host document<br/>HTML entry<br/>[index.html]"]
  node_main["Client bootstrap<br/>React entry<br/>[main.tsx]"]
  node_app["Application shell<br/>UI composition<br/>[App.tsx]"]
  node_shared_ui["Shared UI<br/>navigation and auth UI<br/>[Navbar.tsx]"]
  node_domain_types["Domain types<br/>TypeScript models<br/>[types.ts]"]
  node_seed_data["Seed and fallback data<br/>client data<br/>[initialData.ts]"]
end

subgraph group_workflows["Product workflows"]
  node_public_views["Discovery and campaign detail<br/>public views<br/>[HomeView.tsx]"]
  node_donor["Donor dashboard<br/>donor workflow<br/>[DonorDashboard.tsx]"]
  node_organizer["Organizer dashboard<br/>campaign management workflow"]
  node_admin["Admin dashboard<br/>oversight workflow<br/>[AdminDashboard.tsx]"]
  node_volunteer["Volunteer hub<br/>volunteer workflow<br/>[VolunteerHub.tsx]"]
  node_campaign_ui["Campaign UI<br/>campaign components<br/>[CampaignCard.tsx]"]
  node_donation_ui["Donation modal<br/>contribution UI<br/>[DonationModal.tsx]"]
end

subgraph group_server["Server runtime"]
  node_api{{"Node API server<br/>backend entry<br/>[server.ts]"}}
  node_database[("Persistence access<br/>storage adapter<br/>[db.ts]")]
  node_data_artifacts[("Repository data artifacts<br/>durable data files<br/>[db-store.json]")]
  node_gemini{{"Gemini integration<br/>protected AI service"}}
end

subgraph group_delivery["Runtime configuration"]
  node_vite["Vite frontend runtime<br/>dev and build config<br/>[vite.config.ts]"]
  node_env_contract["Environment contract<br/>environment template<br/>[.env.example]"]
end

node_host -->|"loads"| node_main
node_vite -->|"serves"| node_host
node_main -->|"renders"| node_app
node_app -->|"composes"| node_shared_ui
node_app -->|"selects"| node_public_views
node_app -->|"selects"| node_donor
node_app -->|"selects"| node_organizer
node_app -->|"selects"| node_admin
node_app -->|"selects"| node_volunteer
node_public_views -->|"uses"| node_campaign_ui
node_organizer -->|"uses"| node_campaign_ui
node_public_views -->|"invokes"| node_donation_ui
node_donor -->|"invokes"| node_donation_ui
node_app -->|"uses"| node_domain_types
node_app -.->|"uses fallback data"| node_seed_data
node_app -->|"calls API"| node_api
node_api -->|"persists through"| node_database
node_database -->|"reads and writes"| node_data_artifacts
node_api -->|"uses server-side"| node_gemini
node_env_contract -.->|"documents key"| node_gemini

click node_host "https://github.com/hoangnguyenkim/kindwave/blob/main/index.html"
click node_main "https://github.com/hoangnguyenkim/kindwave/blob/main/src/main.tsx"
click node_app "https://github.com/hoangnguyenkim/kindwave/blob/main/src/App.tsx"
click node_shared_ui "https://github.com/hoangnguyenkim/kindwave/blob/main/src/components/Navbar.tsx"
click node_domain_types "https://github.com/hoangnguyenkim/kindwave/blob/main/src/types.ts"
click node_seed_data "https://github.com/hoangnguyenkim/kindwave/blob/main/src/data/initialData.ts"
click node_public_views "https://github.com/hoangnguyenkim/kindwave/blob/main/src/features/HomeView.tsx"
click node_donor "https://github.com/hoangnguyenkim/kindwave/blob/main/src/features/DonorDashboard.tsx"
click node_organizer "https://github.com/hoangnguyenkim/kindwave/blob/main/src/features/OrganizerDashboard.tsx"
click node_admin "https://github.com/hoangnguyenkim/kindwave/blob/main/src/features/AdminDashboard.tsx"
click node_volunteer "https://github.com/hoangnguyenkim/kindwave/blob/main/src/features/VolunteerHub.tsx"
click node_campaign_ui "https://github.com/hoangnguyenkim/kindwave/blob/main/src/components/CampaignCard.tsx"
click node_donation_ui "https://github.com/hoangnguyenkim/kindwave/blob/main/src/components/DonationModal.tsx"
click node_api "https://github.com/hoangnguyenkim/kindwave/blob/main/server.ts"
click node_database "https://github.com/hoangnguyenkim/kindwave/blob/main/server/db.ts"
click node_data_artifacts "https://github.com/hoangnguyenkim/kindwave/blob/main/db-store.json"
click node_vite "https://github.com/hoangnguyenkim/kindwave/blob/main/vite.config.ts"
click node_env_contract "https://github.com/hoangnguyenkim/kindwave/blob/main/.env.example"

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_host,node_main,node_app,node_shared_ui,node_domain_types,node_seed_data toneBlue
class node_public_views,node_donor,node_organizer,node_admin,node_volunteer,node_campaign_ui,node_donation_ui toneAmber
class node_api,node_database,node_data_artifacts,node_gemini toneMint
class node_vite,node_env_contract toneRose
```

## Components

### Browser client

React application served by Vite.

- [Static host document](https://github.com/hoangnguyenkim/kindwave/blob/main/index.html): HTML entry · `index.html`
- [Client bootstrap](https://github.com/hoangnguyenkim/kindwave/blob/main/src/main.tsx): React entry · `src/main.tsx`
- [Application shell](https://github.com/hoangnguyenkim/kindwave/blob/main/src/App.tsx): UI composition · Selects views and coordinates shared UI. · `src/App.tsx`
- [Shared UI](https://github.com/hoangnguyenkim/kindwave/blob/main/src/components/Navbar.tsx): navigation and auth UI · Navbar, login presentation, notifications, and layout. · `src/components/Navbar.tsx`
- [Domain types](https://github.com/hoangnguyenkim/kindwave/blob/main/src/types.ts): TypeScript models · `src/types.ts`
- [Seed and fallback data](https://github.com/hoangnguyenkim/kindwave/blob/main/src/data/initialData.ts): client data · `src/data/initialData.ts`

### Product workflows

Role-specific and public feature views.

- [Discovery and campaign detail](https://github.com/hoangnguyenkim/kindwave/blob/main/src/features/HomeView.tsx): public views · Campaign browsing and campaign display. · `src/features/HomeView.tsx`
- [Donor dashboard](https://github.com/hoangnguyenkim/kindwave/blob/main/src/features/DonorDashboard.tsx): donor workflow · `src/features/DonorDashboard.tsx`
- [Organizer dashboard](https://github.com/hoangnguyenkim/kindwave/blob/main/src/features/OrganizerDashboard.tsx): campaign management workflow · `src/features/OrganizerDashboard.tsx`
- [Admin dashboard](https://github.com/hoangnguyenkim/kindwave/blob/main/src/features/AdminDashboard.tsx): oversight workflow · `src/features/AdminDashboard.tsx`
- [Volunteer hub](https://github.com/hoangnguyenkim/kindwave/blob/main/src/features/VolunteerHub.tsx): volunteer workflow · `src/features/VolunteerHub.tsx`
- [Campaign UI](https://github.com/hoangnguyenkim/kindwave/blob/main/src/components/CampaignCard.tsx): campaign components · Campaign cards and guided campaign creation/editing. · `src/components/CampaignCard.tsx`
- [Donation modal](https://github.com/hoangnguyenkim/kindwave/blob/main/src/components/DonationModal.tsx): contribution UI · Reusable donation capture flow. · `src/components/DonationModal.tsx`

### Server runtime

Node API and persistence boundary.

- [Node API server](https://github.com/hoangnguyenkim/kindwave/blob/main/server.ts): backend entry · Hosts API behavior used by the browser client. · `server.ts`
- [Persistence access](https://github.com/hoangnguyenkim/kindwave/blob/main/server/db.ts): storage adapter · Owns durable storage operations. · `server/db.ts`
- [Repository data artifacts](https://github.com/hoangnguyenkim/kindwave/blob/main/db-store.json): durable data files · Store, image, and metadata artifacts. · `db-store.json`
- **Gemini integration**: protected AI service · Requires the Gemini API key outside the browser.

### Runtime configuration

- [Vite frontend runtime](https://github.com/hoangnguyenkim/kindwave/blob/main/vite.config.ts): dev and build config · `vite.config.ts`
- [Environment contract](https://github.com/hoangnguyenkim/kindwave/blob/main/.env.example): environment template · Documents Gemini API key configuration. · `.env.example`

## Connections

- Static host document → Client bootstrap: loads
- Vite frontend runtime → Static host document: serves
- Client bootstrap → Application shell: renders
- Application shell → Shared UI: composes
- Application shell → Discovery and campaign detail: selects
- Application shell → Donor dashboard: selects
- Application shell → Organizer dashboard: selects
- Application shell → Admin dashboard: selects
- Application shell → Volunteer hub: selects
- Discovery and campaign detail → Campaign UI: uses
- Organizer dashboard → Campaign UI: uses
- Discovery and campaign detail → Donation modal: invokes
- Donor dashboard → Donation modal: invokes
- Application shell → Domain types: uses
- Application shell → Seed and fallback data: uses fallback data
- Application shell → Node API server: calls API
- Node API server → Persistence access: persists through
- Persistence access → Repository data artifacts: reads and writes
- Node API server → Gemini integration: uses server-side
- Environment contract → Gemini integration: documents key
