# imnotheron/community-resource-mapping architecture

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

- Interactive diagram: https://gitdiagram.com/imnotheron/community-resource-mapping
- Repository: https://github.com/imnotheron/community-resource-mapping

## Overview

CRMS is a role-based municipal records and relief-coordination platform. Its main workflow is field registration of vulnerable residents, administrative review, worker-recorded relief distribution, and administrative approval and reporting; maps, announcements, feedback, and guided help support that work. The graph combines README-described capabilities with relationships visible in excerpts and the source index. Many individual routes and screens were not sampled, so their internal wiring is grouped or left unspecified.

Main entry points: [`src/components/dashboards/worker-dashboard.tsx`](https://github.com/imnotheron/community-resource-mapping/blob/main/src/components/dashboards/worker-dashboard.tsx) (Role dashboards), [`src/app/api`](https://github.com/imnotheron/community-resource-mapping/tree/main/src/app/api) (API routes), [`src/app/api/admin/register-vulnerable/route.ts`](https://github.com/imnotheron/community-resource-mapping/blob/main/src/app/api/admin/register-vulnerable/route.ts) (Registration review), [`src/app/api/assistant/chat/route.ts`](https://github.com/imnotheron/community-resource-mapping/blob/main/src/app/api/assistant/chat/route.ts) (CRMS assistant)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Role-based experience"]
  node_role_ui["Role dashboards"]
  node_auth_ui["Sign-in experience<br/>[auth-screen.tsx]"]
  node_walkthroughs["Guided walkthroughs"]
end

subgraph group_operations["Registration and relief"]
  node_registration["Resident registration"]
  node_registration_review["Registration review<br/>[route.ts]"]
  node_duplicate_check["Duplicate screening"]
  node_documents["Registration documents"]
  node_relief_work["Relief distribution"]
  node_relief_approval["Relief approval<br/>[route.ts]"]
  node_history["Operations history"]
  node_reports["Daily reports"]
end

subgraph group_visibility["Maps and information"]
  node_maps["Community mapping"]
  node_geography["Municipal geography"]
  node_announcements["Announcements<br/>[route.ts]"]
  node_feedback["Feedback<br/>[route.ts]"]
  node_analytics["Admin analytics<br/>[route.ts]"]
  node_assistant["CRMS assistant<br/>[route.ts]"]
end

subgraph group_services["Application services"]
  node_api_client["API client<br/>[api-client.ts]"]
  node_api_routes["API routes"]
  node_assistant_language["Assistant language"]
  node_email["Email delivery<br/>[email.ts]"]
end

subgraph group_persistence["Identity and data"]
  node_session["Request authorization"]
  node_session_token["Session tokens<br/>[session-token.ts]"]
  node_database_client["Database client<br/>[db.ts]"]
  node_database[("SQLite / libSQL")]
end

node_browser(("Community users"))
node_gemini{{"Gemini AI"}}

node_browser -->|"uses"| node_role_ui
node_browser -->|"signs in"| node_auth_ui
node_role_ui -->|"requests data"| node_api_client
node_api_client -->|"sends requests"| node_api_routes
node_auth_ui -.->|"authenticates"| node_api_routes
node_role_ui -->|"offers guidance"| node_walkthroughs
node_role_ui -->|"starts registration"| node_registration
node_registration -.->|"submits records"| node_api_routes
node_api_routes -.->|"routes review"| node_registration_review
node_registration_review -->|"checks duplicates"| node_duplicate_check
node_registration_review -.->|"handles documents"| node_documents
node_role_ui -->|"records assistance"| node_relief_work
node_relief_work -->|"submits distributions"| node_api_routes
node_api_routes -.->|"routes approval"| node_relief_approval
node_role_ui -->|"views history"| node_history
node_role_ui -->|"views reports"| node_reports
node_role_ui -->|"views locations"| node_maps
node_maps -->|"loads map data"| node_api_routes
node_api_routes -->|"uses map bounds"| node_geography
node_role_ui -->|"views updates"| node_announcements
node_role_ui -->|"submits feedback"| node_feedback
node_role_ui -->|"views analytics"| node_analytics
node_role_ui -.->|"asks questions"| node_assistant
node_assistant -->|"normalizes language"| node_assistant_language
node_assistant -.->|"requests responses"| node_gemini
node_api_routes -->|"checks access"| node_session
node_session -->|"verifies tokens"| node_session_token
node_session -->|"loads user"| node_database_client
node_api_routes -->|"reads and writes"| node_database_client
node_database_client -->|"connects to"| node_database
node_api_routes -->|"sends notifications"| node_email

click node_role_ui "https://github.com/imnotheron/community-resource-mapping/blob/main/src/components/dashboards/worker-dashboard.tsx"
click node_auth_ui "https://github.com/imnotheron/community-resource-mapping/blob/main/src/components/auth-screen.tsx"
click node_walkthroughs "https://github.com/imnotheron/community-resource-mapping/blob/main/src/components/walkthrough/walkthrough-provider.tsx"
click node_api_client "https://github.com/imnotheron/community-resource-mapping/blob/main/src/lib/api-client.ts"
click node_api_routes "https://github.com/imnotheron/community-resource-mapping/tree/main/src/app/api"
click node_registration "https://github.com/imnotheron/community-resource-mapping/blob/main/src/components/modals/VulnerableRegistrationModal.tsx"
click node_registration_review "https://github.com/imnotheron/community-resource-mapping/blob/main/src/app/api/admin/register-vulnerable/route.ts"
click node_duplicate_check "https://github.com/imnotheron/community-resource-mapping/blob/main/src/lib/vulnerable-duplicate-check.ts"
click node_documents "https://github.com/imnotheron/community-resource-mapping/blob/main/src/lib/registration-documents.ts"
click node_relief_work "https://github.com/imnotheron/community-resource-mapping/blob/main/src/components/dashboards/worker-dashboard.tsx"
click node_relief_approval "https://github.com/imnotheron/community-resource-mapping/blob/main/src/app/api/admin/relief-approval/route.ts"
click node_history "https://github.com/imnotheron/community-resource-mapping/blob/main/src/components/admin/operations-history.tsx"
click node_reports "https://github.com/imnotheron/community-resource-mapping/blob/main/src/components/reports/daily-reports-view.tsx"
click node_maps "https://github.com/imnotheron/community-resource-mapping/blob/main/src/components/maps/live-vulnerable-map-view.tsx"
click node_geography "https://github.com/imnotheron/community-resource-mapping/blob/main/src/lib/san-policarpo-geography.ts"
click node_announcements "https://github.com/imnotheron/community-resource-mapping/blob/main/src/app/api/announcements/route.ts"
click node_feedback "https://github.com/imnotheron/community-resource-mapping/blob/main/src/app/api/feedback/route.ts"
click node_analytics "https://github.com/imnotheron/community-resource-mapping/blob/main/src/app/api/admin/analytics/route.ts"
click node_assistant "https://github.com/imnotheron/community-resource-mapping/blob/main/src/app/api/assistant/chat/route.ts"
click node_assistant_language "https://github.com/imnotheron/community-resource-mapping/blob/main/src/lib/assistant-language.ts"
click node_session "https://github.com/imnotheron/community-resource-mapping/blob/main/src/lib/request-user-session.ts"
click node_session_token "https://github.com/imnotheron/community-resource-mapping/blob/main/src/lib/session-token.ts"
click node_database_client "https://github.com/imnotheron/community-resource-mapping/blob/main/src/lib/db.ts"
click node_email "https://github.com/imnotheron/community-resource-mapping/blob/main/src/lib/email.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_role_ui,node_auth_ui,node_walkthroughs,node_browser toneBlue
class node_registration,node_registration_review,node_duplicate_check,node_documents,node_relief_work,node_relief_approval,node_history,node_reports toneAmber
class node_maps,node_geography,node_announcements,node_feedback,node_analytics,node_assistant toneMint
class node_api_client,node_api_routes,node_assistant_language,node_email toneRose
class node_session,node_session_token,node_database_client,node_database,node_gemini toneIndigo
```

## Components

### Role-based experience

- [Role dashboards](https://github.com/imnotheron/community-resource-mapping/blob/main/src/components/dashboards/worker-dashboard.tsx): `src/components/dashboards/worker-dashboard.tsx`
- [Sign-in experience](https://github.com/imnotheron/community-resource-mapping/blob/main/src/components/auth-screen.tsx): `src/components/auth-screen.tsx`
- [Guided walkthroughs](https://github.com/imnotheron/community-resource-mapping/blob/main/src/components/walkthrough/walkthrough-provider.tsx): `src/components/walkthrough/walkthrough-provider.tsx`

### Registration and relief

- [Resident registration](https://github.com/imnotheron/community-resource-mapping/blob/main/src/components/modals/VulnerableRegistrationModal.tsx): `src/components/modals/VulnerableRegistrationModal.tsx`
- [Registration review](https://github.com/imnotheron/community-resource-mapping/blob/main/src/app/api/admin/register-vulnerable/route.ts): `src/app/api/admin/register-vulnerable/route.ts`
- [Duplicate screening](https://github.com/imnotheron/community-resource-mapping/blob/main/src/lib/vulnerable-duplicate-check.ts): `src/lib/vulnerable-duplicate-check.ts`
- [Registration documents](https://github.com/imnotheron/community-resource-mapping/blob/main/src/lib/registration-documents.ts): `src/lib/registration-documents.ts`
- [Relief distribution](https://github.com/imnotheron/community-resource-mapping/blob/main/src/components/dashboards/worker-dashboard.tsx): `src/components/dashboards/worker-dashboard.tsx`
- [Relief approval](https://github.com/imnotheron/community-resource-mapping/blob/main/src/app/api/admin/relief-approval/route.ts): `src/app/api/admin/relief-approval/route.ts`
- [Operations history](https://github.com/imnotheron/community-resource-mapping/blob/main/src/components/admin/operations-history.tsx): `src/components/admin/operations-history.tsx`
- [Daily reports](https://github.com/imnotheron/community-resource-mapping/blob/main/src/components/reports/daily-reports-view.tsx): `src/components/reports/daily-reports-view.tsx`

### Maps and information

- [Community mapping](https://github.com/imnotheron/community-resource-mapping/blob/main/src/components/maps/live-vulnerable-map-view.tsx): `src/components/maps/live-vulnerable-map-view.tsx`
- [Municipal geography](https://github.com/imnotheron/community-resource-mapping/blob/main/src/lib/san-policarpo-geography.ts): `src/lib/san-policarpo-geography.ts`
- [Announcements](https://github.com/imnotheron/community-resource-mapping/blob/main/src/app/api/announcements/route.ts): `src/app/api/announcements/route.ts`
- [Feedback](https://github.com/imnotheron/community-resource-mapping/blob/main/src/app/api/feedback/route.ts): `src/app/api/feedback/route.ts`
- [Admin analytics](https://github.com/imnotheron/community-resource-mapping/blob/main/src/app/api/admin/analytics/route.ts): `src/app/api/admin/analytics/route.ts`
- [CRMS assistant](https://github.com/imnotheron/community-resource-mapping/blob/main/src/app/api/assistant/chat/route.ts): `src/app/api/assistant/chat/route.ts`

### Application services

- [API client](https://github.com/imnotheron/community-resource-mapping/blob/main/src/lib/api-client.ts): `src/lib/api-client.ts`
- [API routes](https://github.com/imnotheron/community-resource-mapping/tree/main/src/app/api): `src/app/api`
- [Assistant language](https://github.com/imnotheron/community-resource-mapping/blob/main/src/lib/assistant-language.ts): `src/lib/assistant-language.ts`
- [Email delivery](https://github.com/imnotheron/community-resource-mapping/blob/main/src/lib/email.ts): `src/lib/email.ts`

### Identity and data

- [Request authorization](https://github.com/imnotheron/community-resource-mapping/blob/main/src/lib/request-user-session.ts): `src/lib/request-user-session.ts`
- [Session tokens](https://github.com/imnotheron/community-resource-mapping/blob/main/src/lib/session-token.ts): `src/lib/session-token.ts`
- [Database client](https://github.com/imnotheron/community-resource-mapping/blob/main/src/lib/db.ts): `src/lib/db.ts`
- **SQLite / libSQL**

### Other components

- **Community users**
- **Gemini AI**

## Connections

- Community users → Role dashboards: uses (evidence: `README.md`)
- Community users → Sign-in experience: signs in (evidence: `README.md`)
- Role dashboards → API client: requests data (evidence: `src/components/dashboards/worker-dashboard.tsx`)
- API client → API routes: sends requests (evidence: `src/lib/api-client.ts`)
- Sign-in experience → API routes: authenticates
- Role dashboards → Guided walkthroughs: offers guidance
- Role dashboards → Resident registration: starts registration (evidence: `src/components/dashboards/worker-dashboard.tsx`)
- Resident registration → API routes: submits records
- API routes → Registration review: routes review
- Registration review → Duplicate screening: checks duplicates (evidence: `src/app/api/admin/register-vulnerable/route.ts`)
- Registration review → Registration documents: handles documents (evidence: `src/app/api/admin/register-vulnerable/route.ts`)
- Role dashboards → Relief distribution: records assistance (evidence: `src/components/dashboards/worker-dashboard.tsx`)
- Relief distribution → API routes: submits distributions (evidence: `src/components/dashboards/worker-dashboard.tsx`)
- API routes → Relief approval: routes approval
- Role dashboards → Operations history: views history (evidence: `src/components/dashboards/worker-dashboard.tsx`)
- Role dashboards → Daily reports: views reports (evidence: `README.md`)
- Role dashboards → Community mapping: views locations (evidence: `README.md`)
- Community mapping → API routes: loads map data (evidence: `README.md`)
- API routes → Municipal geography: uses map bounds (evidence: `src/app/api/map/data/route.ts`)
- Role dashboards → Announcements: views updates (evidence: `README.md`)
- Role dashboards → Feedback: submits feedback (evidence: `README.md`)
- Role dashboards → Admin analytics: views analytics (evidence: `README.md`)
- Role dashboards → CRMS assistant: asks questions
- CRMS assistant → Assistant language: normalizes language (evidence: `src/app/api/assistant/chat/route.ts`)
- CRMS assistant → Gemini AI: requests responses
- API routes → Request authorization: checks access (evidence: `src/app/api/announcements/route.ts`)
- Request authorization → Session tokens: verifies tokens (evidence: `src/lib/request-user-session.ts`)
- Request authorization → Database client: loads user (evidence: `src/lib/request-user-session.ts`)
- API routes → Database client: reads and writes (evidence: `src/app/api/announcements/route.ts`)
- Database client → SQLite / libSQL: connects to (evidence: `src/lib/db.ts`)
- API routes → Email delivery: sends notifications (evidence: `src/app/api/admin/register-vulnerable/route.ts`)
