# congplatform/cong-platform architecture

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

- Interactive diagram: https://gitdiagram.com/congplatform/cong-platform
- Repository: https://github.com/congplatform/cong-platform

## Overview

CONG is a developing multi-tenant platform for NGOs, with a React web client and a shared Express API; the README also documents a separate mobile client using that API. The principal workflow is user authentication, account and collaboration-profile setup, then participation in the community through posts, interactions, search, and notifications. The web app also exposes public institutional pages. The API owns business rules and persistence, while Supabase provides authentication and PostgreSQL storage. Community routes and selected calls are evidenced in excerpts; other capability links reflect README documentation or indexed references, not a full inspection of unsampled code.

Main entry points: [`src/contexts/AuthProvider.tsx`](https://github.com/congplatform/cong-platform/blob/main/src/contexts/AuthProvider.tsx) (Auth state), [`src/services/api.ts`](https://github.com/congplatform/cong-platform/blob/main/src/services/api.ts) (API client), [`backend/src/config/database.ts`](https://github.com/congplatform/cong-platform/blob/main/backend/src/config/database.ts) (PostgreSQL pool), [`src/routes/Routes.tsx`](https://github.com/congplatform/cong-platform/blob/main/src/routes/Routes.tsx) (Web routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_routes["Web routes<br/>[Routes.tsx]"]
  node_public["Public pages<br/>[About.tsx]"]
  node_loggedin["Signed-in workspace<br/>[LoggedInLayout.tsx]"]
end

subgraph group_identity["Identity and onboarding"]
  node_authstate["Auth state<br/>[AuthProvider.tsx]"]
  node_authservice["Auth client services<br/>[oauthService.ts]"]
  node_account["Account and profiles<br/>[accountService.ts]"]
  node_onboarding["Onboarding"]
  node_representation["Organization representation"]
  node_orgcontext["Organization context"]
end

subgraph group_community["Community"]
  node_communityui["Community workspace<br/>[Community.tsx]"]
  node_communitypanels["Community panels"]
  node_communityclient["Community client"]
end

subgraph group_api["API and domain services"]
  node_apihelper["API client<br/>[api.ts]"]
  node_apientry["API entry<br/>[index.ts]"]
  node_approuter["Express app and routes<br/>[app.ts]"]
  node_authcontroller["Auth controller<br/>[auth.controller.ts]"]
  node_authrules["Auth rules<br/>[auth.service.ts]"]
  node_communityroutes["Community routes"]
  node_communitycontroller["Community controller"]
  node_communityrules["Community services"]
end

subgraph group_data["Persistence and integrations"]
  node_database[("PostgreSQL pool<br/>[database.ts]")]
  node_supabase["Supabase Auth<br/>[supabase.ts]"]
end

node_visitor(("Visitor / user"))
node_mobile["Mobile client"]

node_visitor -->|"uses"| node_routes
node_routes -->|"routes to"| node_public
node_routes -->|"routes to"| node_loggedin
node_visitor -.->|"uses"| node_mobile
node_loggedin -->|"reads session"| node_authstate
node_authstate -->|"loads account"| node_account
node_authstate -->|"loads requests"| node_representation
node_authstate -->|"calls API"| node_apihelper
node_authservice -->|"completes login"| node_apihelper
node_authservice -->|"starts OAuth"| node_supabase
node_apihelper -->|"sends HTTPS"| node_apientry
node_mobile -->|"uses HTTPS API"| node_apientry
node_apientry -->|"serves app"| node_approuter
node_approuter -.->|"routes auth"| node_authcontroller
node_authcontroller -->|"calls"| node_authrules
node_authrules -->|"authenticates"| node_supabase
node_authrules -->|"reads / writes"| node_database
node_authstate -.->|"supports setup"| node_onboarding
node_authstate -.->|"loads organization"| node_orgcontext
node_communityui -->|"requests content"| node_communityclient
node_communitypanels -->|"requests research"| node_communityclient
node_communityclient -->|"calls API"| node_apihelper
node_apihelper -.->|"sends community requests"| node_communityroutes
node_communityroutes -->|"dispatches"| node_communitycontroller
node_communitycontroller -->|"calls"| node_communityrules
node_communityrules -.->|"persists community data"| node_database
node_onboarding -.->|"persists setup"| node_database
node_representation -.->|"persists requests"| node_database

click node_routes "https://github.com/congplatform/cong-platform/blob/main/src/routes/Routes.tsx"
click node_public "https://github.com/congplatform/cong-platform/blob/main/src/pages/about/About.tsx"
click node_loggedin "https://github.com/congplatform/cong-platform/blob/main/src/layouts/LoggedInLayout.tsx"
click node_authstate "https://github.com/congplatform/cong-platform/blob/main/src/contexts/AuthProvider.tsx"
click node_authservice "https://github.com/congplatform/cong-platform/blob/main/src/services/oauthService.ts"
click node_account "https://github.com/congplatform/cong-platform/blob/main/src/services/accountService.ts"
click node_onboarding "https://github.com/congplatform/cong-platform/blob/main/backend/src/services/onboarding.service.ts"
click node_representation "https://github.com/congplatform/cong-platform/blob/main/backend/src/services/representation.service.ts"
click node_orgcontext "https://github.com/congplatform/cong-platform/blob/main/src/contexts/OrganizationProvider.tsx"
click node_communityui "https://github.com/congplatform/cong-platform/blob/main/src/pages/logged-in/community/Community.tsx"
click node_communitypanels "https://github.com/congplatform/cong-platform/blob/main/src/components/community/CommunityResearchPanel.tsx"
click node_communityclient "https://github.com/congplatform/cong-platform/blob/main/src/services/communityService.ts"
click node_apihelper "https://github.com/congplatform/cong-platform/blob/main/src/services/api.ts"
click node_apientry "https://github.com/congplatform/cong-platform/blob/main/api/index.ts"
click node_approuter "https://github.com/congplatform/cong-platform/blob/main/backend/src/app.ts"
click node_authcontroller "https://github.com/congplatform/cong-platform/blob/main/backend/src/controllers/auth.controller.ts"
click node_authrules "https://github.com/congplatform/cong-platform/blob/main/backend/src/services/auth.service.ts"
click node_communityroutes "https://github.com/congplatform/cong-platform/blob/main/backend/src/routes/community.routes.ts"
click node_communitycontroller "https://github.com/congplatform/cong-platform/blob/main/backend/src/controllers/community.controller.ts"
click node_communityrules "https://github.com/congplatform/cong-platform/blob/main/backend/src/services/community.service.ts"
click node_database "https://github.com/congplatform/cong-platform/blob/main/backend/src/config/database.ts"
click node_supabase "https://github.com/congplatform/cong-platform/blob/main/backend/src/config/supabase.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_routes,node_public,node_loggedin,node_visitor,node_mobile toneBlue
class node_authstate,node_authservice,node_account,node_onboarding,node_representation,node_orgcontext toneAmber
class node_communityui,node_communitypanels,node_communityclient toneMint
class node_apihelper,node_apientry,node_approuter,node_authcontroller,node_authrules,node_communityroutes,node_communitycontroller,node_communityrules toneRose
class node_database,node_supabase toneIndigo
```

## Components

### Web experience

- [Web routes](https://github.com/congplatform/cong-platform/blob/main/src/routes/Routes.tsx): `src/routes/Routes.tsx`
- [Public pages](https://github.com/congplatform/cong-platform/blob/main/src/pages/about/About.tsx): `src/pages/about/About.tsx`
- [Signed-in workspace](https://github.com/congplatform/cong-platform/blob/main/src/layouts/LoggedInLayout.tsx): `src/layouts/LoggedInLayout.tsx`

### Identity and onboarding

- [Auth state](https://github.com/congplatform/cong-platform/blob/main/src/contexts/AuthProvider.tsx): `src/contexts/AuthProvider.tsx`
- [Auth client services](https://github.com/congplatform/cong-platform/blob/main/src/services/oauthService.ts): `src/services/oauthService.ts`
- [Account and profiles](https://github.com/congplatform/cong-platform/blob/main/src/services/accountService.ts): `src/services/accountService.ts`
- [Onboarding](https://github.com/congplatform/cong-platform/blob/main/backend/src/services/onboarding.service.ts): `backend/src/services/onboarding.service.ts`
- [Organization representation](https://github.com/congplatform/cong-platform/blob/main/backend/src/services/representation.service.ts): `backend/src/services/representation.service.ts`
- [Organization context](https://github.com/congplatform/cong-platform/blob/main/src/contexts/OrganizationProvider.tsx): `src/contexts/OrganizationProvider.tsx`

### Community

- [Community workspace](https://github.com/congplatform/cong-platform/blob/main/src/pages/logged-in/community/Community.tsx): `src/pages/logged-in/community/Community.tsx`
- [Community panels](https://github.com/congplatform/cong-platform/blob/main/src/components/community/CommunityResearchPanel.tsx): `src/components/community/CommunityResearchPanel.tsx`
- [Community client](https://github.com/congplatform/cong-platform/blob/main/src/services/communityService.ts): `src/services/communityService.ts`

### API and domain services

- [API client](https://github.com/congplatform/cong-platform/blob/main/src/services/api.ts): `src/services/api.ts`
- [API entry](https://github.com/congplatform/cong-platform/blob/main/api/index.ts): `api/index.ts`
- [Express app and routes](https://github.com/congplatform/cong-platform/blob/main/backend/src/app.ts): `backend/src/app.ts`
- [Auth controller](https://github.com/congplatform/cong-platform/blob/main/backend/src/controllers/auth.controller.ts): `backend/src/controllers/auth.controller.ts`
- [Auth rules](https://github.com/congplatform/cong-platform/blob/main/backend/src/services/auth.service.ts): `backend/src/services/auth.service.ts`
- [Community routes](https://github.com/congplatform/cong-platform/blob/main/backend/src/routes/community.routes.ts): `backend/src/routes/community.routes.ts`
- [Community controller](https://github.com/congplatform/cong-platform/blob/main/backend/src/controllers/community.controller.ts): `backend/src/controllers/community.controller.ts`
- [Community services](https://github.com/congplatform/cong-platform/blob/main/backend/src/services/community.service.ts): `backend/src/services/community.service.ts`

### Persistence and integrations

- [PostgreSQL pool](https://github.com/congplatform/cong-platform/blob/main/backend/src/config/database.ts): `backend/src/config/database.ts`
- [Supabase Auth](https://github.com/congplatform/cong-platform/blob/main/backend/src/config/supabase.ts): `backend/src/config/supabase.ts`

### Other components

- **Visitor / user**
- **Mobile client**

## Connections

- Visitor / user → Web routes: uses (evidence: `README.md`)
- Web routes → Public pages: routes to (evidence: `src/routes/Routes.tsx`)
- Web routes → Signed-in workspace: routes to (evidence: `src/routes/Routes.tsx`)
- Visitor / user → Mobile client: uses (evidence: `README.md`)
- Signed-in workspace → Auth state: reads session (evidence: `src/layouts/LoggedInLayout.tsx`)
- Auth state → Account and profiles: loads account (evidence: `src/contexts/AuthProvider.tsx`)
- Auth state → Organization representation: loads requests (evidence: `src/contexts/AuthProvider.tsx`)
- Auth state → API client: calls API (evidence: `src/contexts/AuthProvider.tsx`)
- Auth client services → API client: completes login (evidence: `src/services/oauthService.ts`)
- Auth client services → Supabase Auth: starts OAuth (evidence: `src/services/oauthService.ts`)
- API client → API entry: sends HTTPS (evidence: `README.md`)
- Mobile client → API entry: uses HTTPS API (evidence: `README.md`)
- API entry → Express app and routes: serves app (evidence: `README.md`)
- Express app and routes → Auth controller: routes auth
- Auth controller → Auth rules: calls (evidence: `backend/src/controllers/auth.controller.ts`)
- Auth rules → Supabase Auth: authenticates (evidence: `backend/src/services/auth.service.ts`)
- Auth rules → PostgreSQL pool: reads / writes (evidence: `backend/src/services/auth.service.ts`)
- Auth state → Onboarding: supports setup
- Auth state → Organization context: loads organization
- Community workspace → Community client: requests content (evidence: `src/pages/logged-in/community/Community.tsx`)
- Community panels → Community client: requests research (evidence: `src/components/community/CommunityResearchPanel.tsx`)
- Community client → API client: calls API (evidence: `src/services/communityService.ts`)
- API client → Community routes: sends community requests
- Community routes → Community controller: dispatches (evidence: `backend/src/routes/community.routes.ts`)
- Community controller → Community services: calls (evidence: `backend/src/controllers/community.controller.ts`)
- Community services → PostgreSQL pool: persists community data
- Onboarding → PostgreSQL pool: persists setup
- Organization representation → PostgreSQL pool: persists requests
