# ralphwreckeri2/revela-prod architecture

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

- Interactive diagram: https://gitdiagram.com/ralphwreckeri2/revela-prod
- Repository: https://github.com/ralphwreckeri2/revela-prod

## Overview

REVELA is a municipal geospatial compliance-monitoring system for identifying potentially unregistered businesses, managing a business registry, and coordinating field inspections. Its principal workflow runs from map-based detection and registry matching through flagged cases, inspector assignment, evidence submission, and administrative reporting. The React dashboard and Flutter field client use the Flask REST API, backed by MySQL. The README documents client/API and API/database connections; sampled backend routes and the app excerpt clarify several internal calls. Mobile application internals and some page-to-endpoint calls were not sampled.

Main entry points: [`revela_backend/app.py`](https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/app.py) (Flask API), [`revela_web/src/App.jsx`](https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_web/src/App.jsx) (Web dashboard), [`revela_backend/api/auth/routes.py`](https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/api/auth/routes.py) (Auth routes), [`revela_backend/api/analytics/routes.py`](https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/api/analytics/routes.py) (Compliance analytics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["User clients"]
  node_web["Web dashboard<br/>[App.jsx]"]
  node_fieldapp["Mobile field app"]
end

subgraph group_api["Backend API"]
  node_apiapp["Flask API<br/>[app.py]"]
  node_geospatial["Geospatial routes<br/>[routes.py]"]
  node_authroutes["Auth routes<br/>[routes.py]"]
end

subgraph group_domain["Compliance workflows"]
  node_registry["Business registry<br/>[service.py]"]
  node_detection["Business detection<br/>[service.py]"]
  node_inspections["Inspection workflow<br/>[service.py]"]
  node_analytics["Compliance analytics<br/>[routes.py]"]
  node_analyticsdispatch["Priority dispatch<br/>[dispatch.py]"]
  node_analyticsfilters["Analytics filters<br/>[filters.py]"]
end

subgraph group_support["Identity and notifications"]
  node_auth["Authentication<br/>[service.py]"]
  node_users["User administration<br/>[routes.py]"]
  node_access["Access control<br/>[decorators.py]"]
  node_userrecords[("User records<br/>[user.py]")]
  node_notify["Notifications<br/>[service.py]"]
  node_eventhub["Admin event hub<br/>[hub.py]"]
end

node_admin(("Admin staff"))
node_inspectors(("Field inspectors"))
node_mysql[("MySQL database")]

node_admin -->|"uses"| node_web
node_inspectors -->|"uses"| node_fieldapp
node_web -->|"calls REST API"| node_apiapp
node_fieldapp -->|"calls HTTPS API"| node_apiapp
node_apiapp -->|"uses database"| node_mysql
node_apiapp -->|"registers routes"| node_authroutes
node_apiapp -->|"checks expired permits"| node_registry
node_apiapp -->|"initializes"| node_mysql
node_web -->|"provides auth context"| node_auth
node_web -.->|"opens registry view"| node_registry
node_web -.->|"opens map view"| node_detection
node_web -->|"opens analytics view"| node_analytics
node_web -->|"opens inspections view"| node_inspections
node_authroutes -->|"calls"| node_auth
node_authroutes -->|"reads user"| node_userrecords
node_authroutes -->|"calls"| node_notify
node_authroutes -->|"protects routes"| node_access
node_users -->|"manages accounts"| node_userrecords
node_users -->|"publishes updates"| node_eventhub
node_registry -->|"snaps new locations"| node_detection
node_inspections -->|"sends assignment alerts"| node_notify
node_analytics -->|"uses dispatch logic"| node_analyticsdispatch
node_analytics -->|"uses filters"| node_analyticsfilters
node_analytics -->|"queries compliance data"| node_mysql
node_apiapp -->|"registers registry routes"| node_registry
node_apiapp -->|"registers flag routes"| node_detection
node_apiapp -->|"registers inspection routes"| node_inspections
node_apiapp -->|"registers analytics routes"| node_analytics
node_apiapp -->|"registers user routes"| node_users
node_notify -->|"publishes events"| node_eventhub

click node_web "https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_web/src/App.jsx"
click node_fieldapp "https://github.com/ralphwreckeri2/revela-prod/tree/main/revela_mobile"
click node_apiapp "https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/app.py"
click node_registry "https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/api/registry/service.py"
click node_detection "https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/api/flags/service.py"
click node_geospatial "https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/api/geospatial/routes.py"
click node_inspections "https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/api/inspections/service.py"
click node_analytics "https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/api/analytics/routes.py"
click node_analyticsdispatch "https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/api/analytics/dispatch.py"
click node_analyticsfilters "https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/api/analytics/filters.py"
click node_auth "https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/api/auth/service.py"
click node_authroutes "https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/api/auth/routes.py"
click node_users "https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/api/users/routes.py"
click node_access "https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/api/middleware/decorators.py"
click node_userrecords "https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/api/models/user.py"
click node_notify "https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/api/notifications/service.py"
click node_eventhub "https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/api/notifications/hub.py"

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_web,node_fieldapp toneBlue
class node_apiapp,node_geospatial,node_authroutes,node_mysql toneAmber
class node_registry,node_detection,node_inspections,node_analytics,node_analyticsdispatch,node_analyticsfilters toneMint
class node_auth,node_users,node_access,node_userrecords,node_notify,node_eventhub toneRose
class node_admin,node_inspectors toneIndigo
```

## Components

### User clients

- [Web dashboard](https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_web/src/App.jsx): `revela_web/src/App.jsx`
- [Mobile field app](https://github.com/ralphwreckeri2/revela-prod/tree/main/revela_mobile): `revela_mobile`

### Backend API

- [Flask API](https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/app.py): `revela_backend/app.py`
- [Geospatial routes](https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/api/geospatial/routes.py): `revela_backend/api/geospatial/routes.py`
- [Auth routes](https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/api/auth/routes.py): `revela_backend/api/auth/routes.py`

### Compliance workflows

- [Business registry](https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/api/registry/service.py): `revela_backend/api/registry/service.py`
- [Business detection](https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/api/flags/service.py): `revela_backend/api/flags/service.py`
- [Inspection workflow](https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/api/inspections/service.py): `revela_backend/api/inspections/service.py`
- [Compliance analytics](https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/api/analytics/routes.py): `revela_backend/api/analytics/routes.py`
- [Priority dispatch](https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/api/analytics/dispatch.py): `revela_backend/api/analytics/dispatch.py`
- [Analytics filters](https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/api/analytics/filters.py): `revela_backend/api/analytics/filters.py`

### Identity and notifications

- [Authentication](https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/api/auth/service.py): `revela_backend/api/auth/service.py`
- [User administration](https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/api/users/routes.py): `revela_backend/api/users/routes.py`
- [Access control](https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/api/middleware/decorators.py): `revela_backend/api/middleware/decorators.py`
- [User records](https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/api/models/user.py): `revela_backend/api/models/user.py`
- [Notifications](https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/api/notifications/service.py): `revela_backend/api/notifications/service.py`
- [Admin event hub](https://github.com/ralphwreckeri2/revela-prod/blob/main/revela_backend/api/notifications/hub.py): `revela_backend/api/notifications/hub.py`

### Other components

- **Admin staff**
- **Field inspectors**
- **MySQL database**

## Connections

- Admin staff → Web dashboard: uses (evidence: `README.md`)
- Field inspectors → Mobile field app: uses (evidence: `README.md`)
- Web dashboard → Flask API: calls REST API (evidence: `README.md`)
- Mobile field app → Flask API: calls HTTPS API (evidence: `README.md`)
- Flask API → MySQL database: uses database (evidence: `README.md`)
- Flask API → Auth routes: registers routes (evidence: `revela_backend/app.py`)
- Flask API → Business registry: checks expired permits (evidence: `revela_backend/app.py`)
- Flask API → MySQL database: initializes (evidence: `revela_backend/app.py`)
- Web dashboard → Authentication: provides auth context (evidence: `revela_web/src/App.jsx`)
- Web dashboard → Business registry: opens registry view
- Web dashboard → Business detection: opens map view
- Web dashboard → Compliance analytics: opens analytics view (evidence: `revela_web/src/App.jsx`)
- Web dashboard → Inspection workflow: opens inspections view (evidence: `revela_web/src/App.jsx`)
- Auth routes → Authentication: calls (evidence: `revela_backend/api/auth/routes.py`)
- Auth routes → User records: reads user (evidence: `revela_backend/api/auth/routes.py`)
- Auth routes → Notifications: calls (evidence: `revela_backend/api/auth/routes.py`)
- Auth routes → Access control: protects routes (evidence: `revela_backend/api/auth/routes.py`)
- User administration → User records: manages accounts (evidence: `revela_backend/api/users/routes.py`)
- User administration → Admin event hub: publishes updates (evidence: `revela_backend/api/users/routes.py`)
- Business registry → Business detection: snaps new locations (evidence: `revela_backend/api/registry/routes.py`)
- Inspection workflow → Notifications: sends assignment alerts (evidence: `revela_backend/api/inspections/routes.py`)
- Compliance analytics → Priority dispatch: uses dispatch logic (evidence: `revela_backend/api/analytics/routes.py`)
- Compliance analytics → Analytics filters: uses filters (evidence: `revela_backend/api/analytics/routes.py`)
- Compliance analytics → MySQL database: queries compliance data (evidence: `revela_backend/api/analytics/routes.py`)
- Flask API → Business registry: registers registry routes (evidence: `revela_backend/app.py`)
- Flask API → Business detection: registers flag routes (evidence: `revela_backend/app.py`)
- Flask API → Inspection workflow: registers inspection routes (evidence: `revela_backend/app.py`)
- Flask API → Compliance analytics: registers analytics routes (evidence: `revela_backend/app.py`)
- Flask API → User administration: registers user routes (evidence: `revela_backend/app.py`)
- Notifications → Admin event hub: publishes events (evidence: `revela_backend/api/notifications/service.py`)
