# rafsanjani21/filantropi architecture

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

- Interactive diagram: https://gitdiagram.com/rafsanjani21/filantropi
- Repository: https://github.com/rafsanjani21/filantropi

## Overview

Filantropi is a Next.js donation and fundraising platform. The main donor journey is to discover a campaign, inspect its detail and fund history, complete a donation or wakaf flow, and view the payment outcome. Beneficiaries can create and manage campaigns, while donors and beneficiaries have profile, transaction-history, and disbursement/progress features. The graph includes shared authentication, API, and localization layers. Some feature links are documented in the README or SOURCE INDEX; unsampled implementation details are not inferred.

Main entry points: [`lib/auth.service.ts`](https://github.com/rafsanjani21/filantropi/blob/main/lib/auth.service.ts) (Auth and campaign service), [`app/DetailPage/hooks/useCampaignDetail.ts`](https://github.com/rafsanjani21/filantropi/blob/main/app/DetailPage/hooks/useCampaignDetail.ts) (Campaign detail hook), [`app/DetailPage/page.tsx`](https://github.com/rafsanjani21/filantropi/blob/main/app/DetailPage/page.tsx) (Campaign detail), [`hooks/useAuth.ts`](https://github.com/rafsanjani21/filantropi/blob/main/hooks/useAuth.ts) (Authentication workflows)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discovery["Discovery"]
  node_home["Home<br/>[page.tsx]"]
  node_catalog["Program catalog<br/>[page.tsx]"]
  node_news["News feed<br/>[page.tsx]"]
end

subgraph group_campaigns["Campaigns"]
  node_campaign_detail["Campaign detail<br/>[page.tsx]"]
  node_campaign_data["Campaign detail hook"]
  node_fundraise["Create campaign<br/>[page.tsx]"]
  node_manage_campaigns["Manage campaigns<br/>[page.tsx]"]
  node_edit_campaign["Edit campaign<br/>[page.tsx]"]
  node_progress["Disbursement progress<br/>[page.tsx]"]
end

subgraph group_giving["Giving"]
  node_donation_flow["Donation flow<br/>[page.tsx]"]
  node_wakaf_detail["Wakaf detail<br/>[page.tsx]"]
  node_wakaf_flow["Wakaf flow<br/>[page.tsx]"]
  node_payment_views["Payment views"]
  node_payment_result["Payment outcome"]
  node_wallet_history["Wallet donation history<br/>[page.tsx]"]
end

subgraph group_accounts["Accounts"]
  node_login["Google sign-in<br/>[page.tsx]"]
  node_profile["User and beneficiary profiles"]
  node_transaction_history["Donation and wakaf history<br/>[page.tsx]"]
end

subgraph group_core["Shared services"]
  node_auth_hook["Authentication workflows<br/>[useAuth.ts]"]
  node_auth_service["Auth and campaign service<br/>[auth.service.ts]"]
  node_api_client["API client<br/>[api.ts]"]
  node_auth_state["Auth state<br/>[useAuthStore.ts]"]
  node_firebase["Firebase Google Auth<br/>[firebase.ts]"]
end

node_donor(("Donor"))
node_beneficiary(("Beneficiary"))
node_backend["Backend API"]
node_payment_networks["Payment networks"]

node_donor -->|"browses"| node_home
node_home -->|"opens programs"| node_catalog
node_donor -->|"searches programs"| node_catalog
node_donor -->|"reads news"| node_news
node_catalog -.->|"selects campaign"| node_campaign_detail
node_donor -->|"views campaign"| node_campaign_detail
node_campaign_detail -->|"loads detail"| node_campaign_data
node_campaign_data -->|"fetches campaign"| node_auth_service
node_campaign_data -->|"loads transactions"| node_api_client
node_campaign_detail -->|"starts donation"| node_donation_flow
node_donation_flow -->|"renders payment steps"| node_payment_views
node_donation_flow -->|"leads to outcome"| node_payment_result
node_payment_views -.->|"presents payment"| node_payment_networks
node_donor -->|"views wakaf"| node_wakaf_detail
node_wakaf_detail -->|"starts wakaf"| node_wakaf_flow
node_wakaf_flow -->|"renders payment steps"| node_payment_views
node_wakaf_flow -.->|"leads to outcome"| node_payment_result
node_beneficiary -->|"creates campaign"| node_fundraise
node_fundraise -->|"creates campaign"| node_auth_hook
node_beneficiary -->|"manages campaigns"| node_manage_campaigns
node_manage_campaigns -->|"reads wallet totals"| node_wallet_history
node_beneficiary -->|"edits campaign"| node_edit_campaign
node_beneficiary -->|"tracks disbursement"| node_progress
node_donor -->|"reviews transactions"| node_transaction_history
node_beneficiary -->|"maintains profile"| node_profile
node_donor -->|"signs in"| node_login
node_login -->|"authenticates with Google"| node_firebase
node_login -->|"starts authentication"| node_auth_hook
node_auth_hook -->|"calls auth service"| node_auth_service
node_auth_hook -->|"checks auth state"| node_auth_state
node_auth_state -->|"loads profile"| node_auth_service
node_auth_service -->|"sends API requests"| node_api_client
node_campaign_data -->|"reads user state"| node_auth_state
node_api_client -->|"fetches API"| node_backend
node_auth_service -.->|"authenticates and manages campaigns"| node_backend
node_wallet_history -->|"reads wallet totals"| node_backend

click node_home "https://github.com/rafsanjani21/filantropi/blob/main/app/HomePage/page.tsx"
click node_catalog "https://github.com/rafsanjani21/filantropi/blob/main/app/AllProgramsPage/page.tsx"
click node_news "https://github.com/rafsanjani21/filantropi/blob/main/app/BeritaPage/page.tsx"
click node_campaign_detail "https://github.com/rafsanjani21/filantropi/blob/main/app/DetailPage/page.tsx"
click node_campaign_data "https://github.com/rafsanjani21/filantropi/blob/main/app/DetailPage/hooks/useCampaignDetail.ts"
click node_fundraise "https://github.com/rafsanjani21/filantropi/blob/main/app/GalangPage/page.tsx"
click node_manage_campaigns "https://github.com/rafsanjani21/filantropi/blob/main/app/ProgramPage/page.tsx"
click node_edit_campaign "https://github.com/rafsanjani21/filantropi/blob/main/app/ProgramPage/EditProgram/page.tsx"
click node_progress "https://github.com/rafsanjani21/filantropi/blob/main/app/ProgressPage/page.tsx"
click node_donation_flow "https://github.com/rafsanjani21/filantropi/blob/main/app/DetailPage/FormDonasiPage/page.tsx"
click node_wakaf_detail "https://github.com/rafsanjani21/filantropi/blob/main/app/WakafDetailPage/page.tsx"
click node_wakaf_flow "https://github.com/rafsanjani21/filantropi/blob/main/app/WakafDetailPage/FormWakafPage/page.tsx"
click node_payment_views "https://github.com/rafsanjani21/filantropi/tree/main/app/components/ui/sharedpayment"
click node_payment_result "https://github.com/rafsanjani21/filantropi/tree/main/app/Payment"
click node_wallet_history "https://github.com/rafsanjani21/filantropi/blob/main/app/ProgramPage/page.tsx"
click node_login "https://github.com/rafsanjani21/filantropi/blob/main/app/LoginPage/page.tsx"
click node_profile "https://github.com/rafsanjani21/filantropi/tree/main/app/ProfilePage"
click node_transaction_history "https://github.com/rafsanjani21/filantropi/blob/main/app/ProfilePage/HistoryWakafPage/page.tsx"
click node_auth_hook "https://github.com/rafsanjani21/filantropi/blob/main/hooks/useAuth.ts"
click node_auth_service "https://github.com/rafsanjani21/filantropi/blob/main/lib/auth.service.ts"
click node_api_client "https://github.com/rafsanjani21/filantropi/blob/main/lib/api.ts"
click node_auth_state "https://github.com/rafsanjani21/filantropi/blob/main/store/useAuthStore.ts"
click node_firebase "https://github.com/rafsanjani21/filantropi/blob/main/lib/firebase.ts"

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_home,node_catalog,node_news toneBlue
class node_campaign_detail,node_campaign_data,node_fundraise,node_manage_campaigns,node_edit_campaign,node_progress toneAmber
class node_donation_flow,node_wakaf_detail,node_wakaf_flow,node_payment_views,node_payment_result,node_wallet_history,node_backend toneMint
class node_login,node_profile,node_transaction_history toneRose
class node_auth_hook,node_auth_service,node_api_client,node_auth_state,node_firebase,node_donor,node_beneficiary,node_payment_networks toneIndigo
```

## Components

### Discovery

- [Home](https://github.com/rafsanjani21/filantropi/blob/main/app/HomePage/page.tsx): `app/HomePage/page.tsx`
- [Program catalog](https://github.com/rafsanjani21/filantropi/blob/main/app/AllProgramsPage/page.tsx): `app/AllProgramsPage/page.tsx`
- [News feed](https://github.com/rafsanjani21/filantropi/blob/main/app/BeritaPage/page.tsx): `app/BeritaPage/page.tsx`

### Campaigns

- [Campaign detail](https://github.com/rafsanjani21/filantropi/blob/main/app/DetailPage/page.tsx): `app/DetailPage/page.tsx`
- [Campaign detail hook](https://github.com/rafsanjani21/filantropi/blob/main/app/DetailPage/hooks/useCampaignDetail.ts): `app/DetailPage/hooks/useCampaignDetail.ts`
- [Create campaign](https://github.com/rafsanjani21/filantropi/blob/main/app/GalangPage/page.tsx): `app/GalangPage/page.tsx`
- [Manage campaigns](https://github.com/rafsanjani21/filantropi/blob/main/app/ProgramPage/page.tsx): `app/ProgramPage/page.tsx`
- [Edit campaign](https://github.com/rafsanjani21/filantropi/blob/main/app/ProgramPage/EditProgram/page.tsx): `app/ProgramPage/EditProgram/page.tsx`
- [Disbursement progress](https://github.com/rafsanjani21/filantropi/blob/main/app/ProgressPage/page.tsx): `app/ProgressPage/page.tsx`

### Giving

- [Donation flow](https://github.com/rafsanjani21/filantropi/blob/main/app/DetailPage/FormDonasiPage/page.tsx): `app/DetailPage/FormDonasiPage/page.tsx`
- [Wakaf detail](https://github.com/rafsanjani21/filantropi/blob/main/app/WakafDetailPage/page.tsx): `app/WakafDetailPage/page.tsx`
- [Wakaf flow](https://github.com/rafsanjani21/filantropi/blob/main/app/WakafDetailPage/FormWakafPage/page.tsx): `app/WakafDetailPage/FormWakafPage/page.tsx`
- [Payment views](https://github.com/rafsanjani21/filantropi/tree/main/app/components/ui/sharedpayment): `app/components/ui/sharedpayment`
- [Payment outcome](https://github.com/rafsanjani21/filantropi/tree/main/app/Payment): `app/Payment`
- [Wallet donation history](https://github.com/rafsanjani21/filantropi/blob/main/app/ProgramPage/page.tsx): `app/ProgramPage/page.tsx`

### Accounts

- [Google sign-in](https://github.com/rafsanjani21/filantropi/blob/main/app/LoginPage/page.tsx): `app/LoginPage/page.tsx`
- [User and beneficiary profiles](https://github.com/rafsanjani21/filantropi/tree/main/app/ProfilePage): `app/ProfilePage`
- [Donation and wakaf history](https://github.com/rafsanjani21/filantropi/blob/main/app/ProfilePage/HistoryWakafPage/page.tsx): `app/ProfilePage/HistoryWakafPage/page.tsx`

### Shared services

- [Authentication workflows](https://github.com/rafsanjani21/filantropi/blob/main/hooks/useAuth.ts): `hooks/useAuth.ts`
- [Auth and campaign service](https://github.com/rafsanjani21/filantropi/blob/main/lib/auth.service.ts): `lib/auth.service.ts`
- [API client](https://github.com/rafsanjani21/filantropi/blob/main/lib/api.ts): `lib/api.ts`
- [Auth state](https://github.com/rafsanjani21/filantropi/blob/main/store/useAuthStore.ts): `store/useAuthStore.ts`
- [Firebase Google Auth](https://github.com/rafsanjani21/filantropi/blob/main/lib/firebase.ts): `lib/firebase.ts`

### Other components

- **Donor**
- **Beneficiary**
- **Backend API**
- **Payment networks**

## Connections

- Donor → Home: browses
- Home → Program catalog: opens programs
- Donor → Program catalog: searches programs
- Donor → News feed: reads news
- Program catalog → Campaign detail: selects campaign
- Donor → Campaign detail: views campaign
- Campaign detail → Campaign detail hook: loads detail (evidence: `app/DetailPage/page.tsx`)
- Campaign detail hook → Auth and campaign service: fetches campaign (evidence: `app/DetailPage/hooks/useCampaignDetail.ts`)
- Campaign detail hook → API client: loads transactions (evidence: `app/DetailPage/hooks/useCampaignDetail.ts`)
- Campaign detail → Donation flow: starts donation
- Donation flow → Payment views: renders payment steps (evidence: `app/DetailPage/FormDonasiPage/page.tsx`)
- Donation flow → Payment outcome: leads to outcome
- Payment views → Payment networks: presents payment
- Donor → Wakaf detail: views wakaf
- Wakaf detail → Wakaf flow: starts wakaf
- Wakaf flow → Payment views: renders payment steps (evidence: `app/WakafDetailPage/FormWakafPage/page.tsx`)
- Wakaf flow → Payment outcome: leads to outcome
- Beneficiary → Create campaign: creates campaign
- Create campaign → Authentication workflows: creates campaign (evidence: `app/GalangPage/page.tsx`)
- Beneficiary → Manage campaigns: manages campaigns
- Manage campaigns → Wallet donation history: reads wallet totals (evidence: `app/ProgramPage/page.tsx`)
- Beneficiary → Edit campaign: edits campaign
- Beneficiary → Disbursement progress: tracks disbursement
- Donor → Donation and wakaf history: reviews transactions
- Beneficiary → User and beneficiary profiles: maintains profile
- Donor → Google sign-in: signs in
- Google sign-in → Firebase Google Auth: authenticates with Google (evidence: `app/LoginPage/page.tsx`)
- Google sign-in → Authentication workflows: starts authentication (evidence: `app/LoginPage/page.tsx`)
- Authentication workflows → Auth and campaign service: calls auth service (evidence: `hooks/useAuth.ts`)
- Authentication workflows → Auth state: checks auth state (evidence: `hooks/useAuth.ts`)
- Auth state → Auth and campaign service: loads profile (evidence: `store/useAuthStore.ts`)
- Auth and campaign service → API client: sends API requests (evidence: `lib/auth.service.ts`)
- Campaign detail hook → Auth state: reads user state (evidence: `app/DetailPage/hooks/useCampaignDetail.ts`)
- API client → Backend API: fetches API (evidence: `lib/api.ts`)
- Auth and campaign service → Backend API: authenticates and manages campaigns
- Wallet donation history → Backend API: reads wallet totals (evidence: `app/ProgramPage/page.tsx`)
