# leogenocide/caremesh architecture

> Architecture diagram of the GitHub repository leogenocide/caremesh, 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/leogenocide/caremesh
- Repository: https://github.com/leogenocide/caremesh

## Overview

CareMesh is a civic-resilience and mutual-aid application for exploring local needs and resources, coordinating plans and projects, sharing community activity, and governing public records. A user enters through the routed React application; views use shared CareMesh state and the API client to access backend capabilities, whose Express routes are backed by SQLite. Authentication and community moderation are visible internal layers. The README is only the default Vite template, so product capabilities are inferred from the repository tree and sampled source; unsampled route internals are not expanded.

Main entry points: [`src/views`](https://github.com/leogenocide/caremesh/tree/main/src/views) (Product views), [`server/routes`](https://github.com/leogenocide/caremesh/tree/main/server/routes) (Domain routes), [`server/db/database.js`](https://github.com/leogenocide/caremesh/blob/main/server/db/database.js) (SQLite database), [`src/App.jsx`](https://github.com/leogenocide/caremesh/blob/main/src/App.jsx) (Routed app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React application"]
  node_app["Routed app<br/>[App.jsx]"]
  node_views["Product views"]
  node_shared_state["CareMesh state"]
  node_api_client["API client<br/>[client.js]"]
end

subgraph group_coordination["Mutual aid"]
  node_explore["Explore map<br/>[ExploreView.jsx]"]
  node_plans["Plans and projects<br/>[PlansView.jsx]"]
  node_collaborate["Collaboration"]
  node_readiness["Readiness checks"]
  node_matching["Resource matching<br/>[matcherService.js]"]
end

subgraph group_community["Community and governance"]
  node_social["Community social<br/>[SocialView.jsx]"]
  node_profiles["User profiles<br/>[ProfileView.jsx]"]
  node_governance["Admin governance"]
  node_evidence["Evidence and claims<br/>[evidence.js]"]
  node_reports["Reports and safety<br/>[reports.js]"]
end

subgraph group_backend["API backend"]
  node_auth["Authentication<br/>[auth.js]"]
  node_auth_middleware["JWT authorization<br/>[auth.js]"]
  node_server["Express API<br/>[index.js]"]
  node_routes["Domain routes"]
  node_rate_limiter["Write rate limits<br/>[rateLimiter.js]"]
  node_matcher_route["Matcher endpoint<br/>[matcher.js]"]
end

subgraph group_persistence["Persistence and services"]
  node_database[("SQLite database<br/>[database.js]")]
  node_learning["Learning service<br/>[learningService.js]"]
end

node_user(("CareMesh user"))

node_user -->|"opens"| node_app
node_app -->|"routes to"| node_views
node_app -->|"provides"| node_shared_state
node_views -->|"uses"| node_shared_state
node_shared_state -->|"calls"| node_api_client
node_api_client -->|"sends API requests"| node_server
node_views -.->|"includes"| node_explore
node_views -.->|"includes"| node_plans
node_views -.->|"includes"| node_collaborate
node_explore -.->|"opens checks"| node_readiness
node_server -->|"mounts"| node_routes
node_server -->|"initializes"| node_database
node_routes -.->|"includes"| node_auth
node_routes -->|"includes"| node_evidence
node_routes -->|"includes"| node_reports
node_routes -->|"includes"| node_matcher_route
node_auth -->|"signs tokens"| node_auth_middleware
node_auth_middleware -->|"reads users"| node_database
node_routes -.->|"applies limits"| node_rate_limiter
node_matcher_route -->|"uses service"| node_matching
node_matching -->|"reads records"| node_database
node_routes -->|"uses service"| node_learning
node_learning -->|"queries"| node_database
node_views -.->|"includes"| node_social
node_views -.->|"includes"| node_profiles
node_views -.->|"includes"| node_governance

click node_app "https://github.com/leogenocide/caremesh/blob/main/src/App.jsx"
click node_views "https://github.com/leogenocide/caremesh/tree/main/src/views"
click node_shared_state "https://github.com/leogenocide/caremesh/blob/main/src/context/CareMeshContext.jsx"
click node_api_client "https://github.com/leogenocide/caremesh/blob/main/src/api/client.js"
click node_explore "https://github.com/leogenocide/caremesh/blob/main/src/views/ExploreView.jsx"
click node_plans "https://github.com/leogenocide/caremesh/blob/main/src/views/PlansView.jsx"
click node_collaborate "https://github.com/leogenocide/caremesh/blob/main/src/views/CollaborateView.jsx"
click node_readiness "https://github.com/leogenocide/caremesh/blob/main/src/components/readiness/ReadinessCheckerModal.jsx"
click node_matching "https://github.com/leogenocide/caremesh/blob/main/server/services/matcherService.js"
click node_social "https://github.com/leogenocide/caremesh/blob/main/src/views/SocialView.jsx"
click node_profiles "https://github.com/leogenocide/caremesh/blob/main/src/views/ProfileView.jsx"
click node_governance "https://github.com/leogenocide/caremesh/blob/main/src/views/AdminGovernanceView.jsx"
click node_evidence "https://github.com/leogenocide/caremesh/blob/main/server/routes/evidence.js"
click node_reports "https://github.com/leogenocide/caremesh/blob/main/server/routes/reports.js"
click node_auth "https://github.com/leogenocide/caremesh/blob/main/server/routes/auth.js"
click node_auth_middleware "https://github.com/leogenocide/caremesh/blob/main/server/middleware/auth.js"
click node_server "https://github.com/leogenocide/caremesh/blob/main/server/index.js"
click node_routes "https://github.com/leogenocide/caremesh/tree/main/server/routes"
click node_rate_limiter "https://github.com/leogenocide/caremesh/blob/main/server/middleware/rateLimiter.js"
click node_database "https://github.com/leogenocide/caremesh/blob/main/server/db/database.js"
click node_learning "https://github.com/leogenocide/caremesh/blob/main/server/services/learningService.js"
click node_matcher_route "https://github.com/leogenocide/caremesh/blob/main/server/routes/matcher.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_app,node_views,node_shared_state,node_api_client,node_user toneBlue
class node_explore,node_plans,node_collaborate,node_readiness,node_matching toneAmber
class node_social,node_profiles,node_governance,node_evidence,node_reports toneMint
class node_auth,node_auth_middleware,node_server,node_routes,node_rate_limiter,node_matcher_route toneRose
class node_database,node_learning toneIndigo
```

## Components

### React application

- [Routed app](https://github.com/leogenocide/caremesh/blob/main/src/App.jsx): `src/App.jsx`
- [Product views](https://github.com/leogenocide/caremesh/tree/main/src/views): `src/views`
- [CareMesh state](https://github.com/leogenocide/caremesh/blob/main/src/context/CareMeshContext.jsx): `src/context/CareMeshContext.jsx`
- [API client](https://github.com/leogenocide/caremesh/blob/main/src/api/client.js): `src/api/client.js`

### Mutual aid

- [Explore map](https://github.com/leogenocide/caremesh/blob/main/src/views/ExploreView.jsx): `src/views/ExploreView.jsx`
- [Plans and projects](https://github.com/leogenocide/caremesh/blob/main/src/views/PlansView.jsx): `src/views/PlansView.jsx`
- [Collaboration](https://github.com/leogenocide/caremesh/blob/main/src/views/CollaborateView.jsx): `src/views/CollaborateView.jsx`
- [Readiness checks](https://github.com/leogenocide/caremesh/blob/main/src/components/readiness/ReadinessCheckerModal.jsx): `src/components/readiness/ReadinessCheckerModal.jsx`
- [Resource matching](https://github.com/leogenocide/caremesh/blob/main/server/services/matcherService.js): `server/services/matcherService.js`

### Community and governance

- [Community social](https://github.com/leogenocide/caremesh/blob/main/src/views/SocialView.jsx): `src/views/SocialView.jsx`
- [User profiles](https://github.com/leogenocide/caremesh/blob/main/src/views/ProfileView.jsx): `src/views/ProfileView.jsx`
- [Admin governance](https://github.com/leogenocide/caremesh/blob/main/src/views/AdminGovernanceView.jsx): `src/views/AdminGovernanceView.jsx`
- [Evidence and claims](https://github.com/leogenocide/caremesh/blob/main/server/routes/evidence.js): `server/routes/evidence.js`
- [Reports and safety](https://github.com/leogenocide/caremesh/blob/main/server/routes/reports.js): `server/routes/reports.js`

### API backend

- [Authentication](https://github.com/leogenocide/caremesh/blob/main/server/routes/auth.js): `server/routes/auth.js`
- [JWT authorization](https://github.com/leogenocide/caremesh/blob/main/server/middleware/auth.js): `server/middleware/auth.js`
- [Express API](https://github.com/leogenocide/caremesh/blob/main/server/index.js): `server/index.js`
- [Domain routes](https://github.com/leogenocide/caremesh/tree/main/server/routes): `server/routes`
- [Write rate limits](https://github.com/leogenocide/caremesh/blob/main/server/middleware/rateLimiter.js): `server/middleware/rateLimiter.js`
- [Matcher endpoint](https://github.com/leogenocide/caremesh/blob/main/server/routes/matcher.js): `server/routes/matcher.js`

### Persistence and services

- [SQLite database](https://github.com/leogenocide/caremesh/blob/main/server/db/database.js): `server/db/database.js`
- [Learning service](https://github.com/leogenocide/caremesh/blob/main/server/services/learningService.js): `server/services/learningService.js`

### Other components

- **CareMesh user**

## Connections

- CareMesh user → Routed app: opens (evidence: `src/App.jsx`)
- Routed app → Product views: routes to (evidence: `src/App.jsx`)
- Routed app → CareMesh state: provides (evidence: `src/App.jsx`)
- Product views → CareMesh state: uses (evidence: `src/views/ExploreView.jsx`)
- CareMesh state → API client: calls (evidence: `src/context/CareMeshContext.jsx`)
- API client → Express API: sends API requests (evidence: `src/api/client.js`)
- Product views → Explore map: includes
- Product views → Plans and projects: includes
- Product views → Collaboration: includes
- Explore map → Readiness checks: opens checks
- Express API → Domain routes: mounts (evidence: `server/index.js`)
- Express API → SQLite database: initializes (evidence: `server/index.js`)
- Domain routes → Authentication: includes (evidence: `server/routes/communities.js`)
- Domain routes → Evidence and claims: includes (evidence: `server/index.js`)
- Domain routes → Reports and safety: includes (evidence: `server/index.js`)
- Domain routes → Matcher endpoint: includes (evidence: `server/index.js`)
- Authentication → JWT authorization: signs tokens (evidence: `server/routes/auth.js`)
- JWT authorization → SQLite database: reads users (evidence: `server/middleware/auth.js`)
- Domain routes → Write rate limits: applies limits (evidence: `server/routes/admin.js`)
- Matcher endpoint → Resource matching: uses service (evidence: `server/routes/matcher.js`)
- Resource matching → SQLite database: reads records (evidence: `server/services/matcherService.js`)
- Domain routes → Learning service: uses service (evidence: `server/routes/learning.js`)
- Learning service → SQLite database: queries (evidence: `server/services/learningService.js`)
- Product views → Community social: includes
- Product views → User profiles: includes
- Product views → Admin governance: includes
