# cassianoomotta/geoalerta architecture

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

- Interactive diagram: https://gitdiagram.com/cassianoomotta/geoalerta
- Repository: https://github.com/cassianoomotta/geoalerta

## Overview

GeoAlerta Core supports public occurrence reporting and an authenticated municipal operations panel. The primary workflow is citizen submission with required GPS location, optional photo, and a confirmation protocol; authorized staff then triage and track occurrences, with dashboards, maps, alerts, and CSV export. Separate administrative workflows manage access, statuses, risk zones, and shelters. The graph combines documented capabilities with relationships visible in the supplied excerpts and SOURCE INDEX; unsampled route wiring is not inferred.

Main entry points: [`src/server/access/session.ts`](https://github.com/cassianoomotta/geoalerta/blob/main/src/server/access/session.ts) (Session authentication), [`src/app/painel/page.tsx`](https://github.com/cassianoomotta/geoalerta/blob/main/src/app/painel/page.tsx) (Municipal panel), [`src/app/api/core/occurrences/route.ts`](https://github.com/cassianoomotta/geoalerta/blob/main/src/app/api/core/occurrences/route.ts) (Occurrence API), [`src/app/api/core/dashboard/route.ts`](https://github.com/cassianoomotta/geoalerta/blob/main/src/app/api/core/dashboard/route.ts) (Dashboard API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_reporting["Public reporting"]
  node_public_occurrences["Public occurrence entry<br/>[route.ts]"]
  node_occurrence_api["Occurrence API<br/>[route.ts]"]
  node_occurrence_creation["Occurrence creation"]
  node_occurrence_persistence["Occurrence persistence<br/>[persist.ts]"]
  node_public_shelters["Public shelter catalog<br/>[route.ts]"]
end

subgraph group_operations["Occurrence operations"]
  node_panel["Municipal panel<br/>[page.tsx]"]
  node_dashboard_api["Dashboard API<br/>[route.ts]"]
  node_dashboard_indicators["Dashboard indicators"]
  node_dashboard_map["Dashboard map<br/>[dashboard-map.ts]"]
  node_occurrence_list["Occurrence listing<br/>[list.ts]"]
  node_occurrence_detail["Occurrence detail and mutation<br/>[route.ts]"]
  node_occurrence_mutation["Mutation transaction<br/>[mutate.ts]"]
  node_csv_export["CSV export<br/>[export-csv.ts]"]
end

subgraph group_access["Identity and access"]
  node_session["Session authentication<br/>[session.ts]"]
  node_access_context["Access context<br/>[context.ts]"]
  node_access_permissions["Permission rules<br/>[permissions.ts]"]
end

subgraph group_administration["Municipal administration"]
  node_admin_users["Access administration<br/>[route.ts]"]
  node_admin_status["Status administration<br/>[route.ts]"]
  node_admin_risk_zones["Risk-zone administration<br/>[route.ts]"]
  node_admin_shelters["Shelter administration<br/>[route.ts]"]
  node_climate_events["Climate events<br/>[route.ts]"]
end

node_citizen(("Citizen"))
node_panel_user(("Panel user"))
node_database[("Database<br/>[prisma.ts]")]

node_citizen -->|"submits report"| node_public_occurrences
node_public_occurrences -.->|"confirms report"| node_occurrence_api
node_occurrence_api -->|"creates occurrence"| node_occurrence_creation
node_occurrence_api -->|"persists occurrence"| node_occurrence_persistence
node_citizen -->|"views catalog"| node_public_shelters
node_panel_user -->|"uses panel"| node_panel
node_panel -->|"views indicators"| node_dashboard_api
node_panel -->|"reviews occurrences"| node_occurrence_list
node_panel -->|"operates occurrences"| node_occurrence_detail
node_panel -->|"exports locally"| node_csv_export
node_dashboard_api -.->|"loads indicators"| node_dashboard_indicators
node_dashboard_api -.->|"loads map data"| node_dashboard_map
node_occurrence_detail -->|"mutates occurrence"| node_occurrence_mutation
node_occurrence_api -->|"authenticates request"| node_session
node_occurrence_detail -->|"authenticates request"| node_session
node_session -->|"resolves identity"| node_access_context
node_access_context -->|"checks capabilities"| node_access_permissions
node_access_context -->|"queries in transaction"| node_database
node_panel_user -->|"administers access"| node_admin_users
node_panel_user -->|"configures statuses"| node_admin_status
node_panel_user -->|"manages risk zones"| node_admin_risk_zones
node_panel_user -->|"manages shelters"| node_admin_shelters
node_admin_users -->|"authenticates request"| node_session
node_admin_status -.->|"authenticates request"| node_session
node_admin_risk_zones -->|"authenticates request"| node_session
node_admin_shelters -->|"authenticates request"| node_session
node_panel_user -.->|"manages events"| node_climate_events

click node_public_occurrences "https://github.com/cassianoomotta/geoalerta/blob/main/src/app/api/core/public/occurrences/route.ts"
click node_occurrence_api "https://github.com/cassianoomotta/geoalerta/blob/main/src/app/api/core/occurrences/route.ts"
click node_occurrence_creation "https://github.com/cassianoomotta/geoalerta/blob/main/src/features/occurrences/application/create-manual-occurrence.ts"
click node_occurrence_persistence "https://github.com/cassianoomotta/geoalerta/blob/main/src/server/occurrences/persist.ts"
click node_public_shelters "https://github.com/cassianoomotta/geoalerta/blob/main/src/app/api/core/public/shelters/route.ts"
click node_panel "https://github.com/cassianoomotta/geoalerta/blob/main/src/app/painel/page.tsx"
click node_dashboard_api "https://github.com/cassianoomotta/geoalerta/blob/main/src/app/api/core/dashboard/route.ts"
click node_dashboard_indicators "https://github.com/cassianoomotta/geoalerta/blob/main/src/server/occurrences/dashboard-indicators.ts"
click node_dashboard_map "https://github.com/cassianoomotta/geoalerta/blob/main/src/server/occurrences/dashboard-map.ts"
click node_occurrence_list "https://github.com/cassianoomotta/geoalerta/blob/main/src/server/occurrences/list.ts"
click node_occurrence_detail "https://github.com/cassianoomotta/geoalerta/blob/main/src/app/api/core/occurrences/%5Bid%5D/route.ts"
click node_occurrence_mutation "https://github.com/cassianoomotta/geoalerta/blob/main/src/server/occurrences/mutate.ts"
click node_csv_export "https://github.com/cassianoomotta/geoalerta/blob/main/src/features/occurrences/export-csv.ts"
click node_session "https://github.com/cassianoomotta/geoalerta/blob/main/src/server/access/session.ts"
click node_access_context "https://github.com/cassianoomotta/geoalerta/blob/main/src/server/access/context.ts"
click node_access_permissions "https://github.com/cassianoomotta/geoalerta/blob/main/src/features/access/domain/permissions.ts"
click node_admin_users "https://github.com/cassianoomotta/geoalerta/blob/main/src/app/api/core/admin/route.ts"
click node_admin_status "https://github.com/cassianoomotta/geoalerta/blob/main/src/app/api/core/admin/status/route.ts"
click node_admin_risk_zones "https://github.com/cassianoomotta/geoalerta/blob/main/src/app/api/core/admin/risk-zones/route.ts"
click node_admin_shelters "https://github.com/cassianoomotta/geoalerta/blob/main/src/app/api/core/admin/shelters/route.ts"
click node_climate_events "https://github.com/cassianoomotta/geoalerta/blob/main/src/app/api/core/climate-events/route.ts"
click node_database "https://github.com/cassianoomotta/geoalerta/blob/main/src/server/database/prisma.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_public_occurrences,node_occurrence_api,node_occurrence_creation,node_occurrence_persistence,node_public_shelters,node_panel_user toneBlue
class node_panel,node_dashboard_api,node_dashboard_indicators,node_dashboard_map,node_occurrence_list,node_occurrence_detail,node_occurrence_mutation,node_csv_export,node_database toneAmber
class node_session,node_access_context,node_access_permissions toneMint
class node_admin_users,node_admin_status,node_admin_risk_zones,node_admin_shelters,node_climate_events toneRose
class node_citizen toneIndigo
```

## Components

### Public reporting

- [Public occurrence entry](https://github.com/cassianoomotta/geoalerta/blob/main/src/app/api/core/public/occurrences/route.ts): `src/app/api/core/public/occurrences/route.ts`
- [Occurrence API](https://github.com/cassianoomotta/geoalerta/blob/main/src/app/api/core/occurrences/route.ts): `src/app/api/core/occurrences/route.ts`
- [Occurrence creation](https://github.com/cassianoomotta/geoalerta/blob/main/src/features/occurrences/application/create-manual-occurrence.ts): `src/features/occurrences/application/create-manual-occurrence.ts`
- [Occurrence persistence](https://github.com/cassianoomotta/geoalerta/blob/main/src/server/occurrences/persist.ts): `src/server/occurrences/persist.ts`
- [Public shelter catalog](https://github.com/cassianoomotta/geoalerta/blob/main/src/app/api/core/public/shelters/route.ts): `src/app/api/core/public/shelters/route.ts`

### Occurrence operations

- [Municipal panel](https://github.com/cassianoomotta/geoalerta/blob/main/src/app/painel/page.tsx): `src/app/painel/page.tsx`
- [Dashboard API](https://github.com/cassianoomotta/geoalerta/blob/main/src/app/api/core/dashboard/route.ts): `src/app/api/core/dashboard/route.ts`
- [Dashboard indicators](https://github.com/cassianoomotta/geoalerta/blob/main/src/server/occurrences/dashboard-indicators.ts): `src/server/occurrences/dashboard-indicators.ts`
- [Dashboard map](https://github.com/cassianoomotta/geoalerta/blob/main/src/server/occurrences/dashboard-map.ts): `src/server/occurrences/dashboard-map.ts`
- [Occurrence listing](https://github.com/cassianoomotta/geoalerta/blob/main/src/server/occurrences/list.ts): `src/server/occurrences/list.ts`
- [Occurrence detail and mutation](https://github.com/cassianoomotta/geoalerta/blob/main/src/app/api/core/occurrences/%5Bid%5D/route.ts): `src/app/api/core/occurrences/[id]/route.ts`
- [Mutation transaction](https://github.com/cassianoomotta/geoalerta/blob/main/src/server/occurrences/mutate.ts): `src/server/occurrences/mutate.ts`
- [CSV export](https://github.com/cassianoomotta/geoalerta/blob/main/src/features/occurrences/export-csv.ts): `src/features/occurrences/export-csv.ts`

### Identity and access

- [Session authentication](https://github.com/cassianoomotta/geoalerta/blob/main/src/server/access/session.ts): `src/server/access/session.ts`
- [Access context](https://github.com/cassianoomotta/geoalerta/blob/main/src/server/access/context.ts): `src/server/access/context.ts`
- [Permission rules](https://github.com/cassianoomotta/geoalerta/blob/main/src/features/access/domain/permissions.ts): `src/features/access/domain/permissions.ts`

### Municipal administration

- [Access administration](https://github.com/cassianoomotta/geoalerta/blob/main/src/app/api/core/admin/route.ts): `src/app/api/core/admin/route.ts`
- [Status administration](https://github.com/cassianoomotta/geoalerta/blob/main/src/app/api/core/admin/status/route.ts): `src/app/api/core/admin/status/route.ts`
- [Risk-zone administration](https://github.com/cassianoomotta/geoalerta/blob/main/src/app/api/core/admin/risk-zones/route.ts): `src/app/api/core/admin/risk-zones/route.ts`
- [Shelter administration](https://github.com/cassianoomotta/geoalerta/blob/main/src/app/api/core/admin/shelters/route.ts): `src/app/api/core/admin/shelters/route.ts`
- [Climate events](https://github.com/cassianoomotta/geoalerta/blob/main/src/app/api/core/climate-events/route.ts): `src/app/api/core/climate-events/route.ts`

### Other components

- **Citizen**
- **Panel user**
- [Database](https://github.com/cassianoomotta/geoalerta/blob/main/src/server/database/prisma.ts): `src/server/database/prisma.ts`

## Connections

- Citizen → Public occurrence entry: submits report
- Public occurrence entry → Occurrence API: confirms report
- Occurrence API → Occurrence creation: creates occurrence (evidence: `src/app/api/core/occurrences/route.ts`)
- Occurrence API → Occurrence persistence: persists occurrence (evidence: `src/app/api/core/occurrences/route.ts`)
- Citizen → Public shelter catalog: views catalog
- Panel user → Municipal panel: uses panel
- Municipal panel → Dashboard API: views indicators
- Municipal panel → Occurrence listing: reviews occurrences
- Municipal panel → Occurrence detail and mutation: operates occurrences
- Municipal panel → CSV export: exports locally
- Dashboard API → Dashboard indicators: loads indicators
- Dashboard API → Dashboard map: loads map data
- Occurrence detail and mutation → Mutation transaction: mutates occurrence (evidence: `src/app/api/core/occurrences/[id]/route.ts`)
- Occurrence API → Session authentication: authenticates request (evidence: `src/app/api/core/occurrences/route.ts`)
- Occurrence detail and mutation → Session authentication: authenticates request (evidence: `src/app/api/core/occurrences/[id]/route.ts`)
- Session authentication → Access context: resolves identity (evidence: `src/server/access/session.ts`)
- Access context → Permission rules: checks capabilities (evidence: `src/server/access/context.ts`)
- Access context → Database: queries in transaction (evidence: `src/server/access/context.ts`)
- Panel user → Access administration: administers access
- Panel user → Status administration: configures statuses
- Panel user → Risk-zone administration: manages risk zones
- Panel user → Shelter administration: manages shelters
- Access administration → Session authentication: authenticates request (evidence: `src/app/api/core/admin/route.ts`)
- Status administration → Session authentication: authenticates request (evidence: `src/app/api/core/admin/status/route.ts`)
- Risk-zone administration → Session authentication: authenticates request (evidence: `src/app/api/core/admin/risk-zones/route.ts`)
- Shelter administration → Session authentication: authenticates request (evidence: `src/app/api/core/admin/shelters/route.ts`)
- Panel user → Climate events: manages events
