# ivanmercado0998/navicom-aerotrace architecture

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

- Interactive diagram: https://gitdiagram.com/ivanmercado0998/navicom-aerotrace
- Repository: https://github.com/ivanmercado0998/navicom-aerotrace

## Overview

AeroTrace is an air-quality monitoring dashboard for managing monitoring nodes and pollution sources, viewing readings and history, and exploring locations on a map. The main user path is admin sign-in, then dashboard interactions that request monitoring data through server actions backed by authentication and a database; live readings may also use OpenAQ. The map, node details, history, location search, and node-management UI are distinct dashboard capabilities. The README is empty, and unsampled modules are represented only where the source index establishes their role or relationship.

Main entry points: [`app/dashboard/page.tsx`](https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/app/dashboard/page.tsx) (Dashboard orchestration), [`app/actions/monitoring.ts`](https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/app/actions/monitoring.ts) (Monitoring actions), [`components/auth-form.tsx`](https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/components/auth-form.tsx) (Admin login form), [`app/api/admin/login/route.ts`](https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/app/api/admin/login/route.ts) (Admin login route)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and sessions"]
  node_login["Admin login form<br/>[auth-form.tsx]"]
  node_login_route["Admin login route<br/>[route.ts]"]
  node_admin_sessions["Admin sessions<br/>[admin-auth.ts]"]
  node_auth_api["Auth API route<br/>[route.ts]"]
  node_auth["User authentication<br/>[auth.ts]"]
end

subgraph group_dashboard["Monitoring dashboard"]
  node_dashboard_page["Dashboard orchestration<br/>[page.tsx]"]
  node_map["Pollution map<br/>[pollution-map.tsx]"]
  node_node_details["Node details"]
  node_node_management["Node management"]
  node_add_node["Add node dialog"]
  node_history["Reading history<br/>[history-panel.tsx]"]
  node_location_search["Location search"]
  node_location_search_basic["Location search"]
  node_panels["Draggable panels"]
end

subgraph group_data["Monitoring services"]
  node_monitoring_actions["Monitoring actions<br/>[monitoring.ts]"]
  node_openaq["OpenAQ readings"]
end

subgraph group_storage["Persistence"]
  node_schema["Monitoring schema<br/>[schema.ts]"]
  node_database[("Application database<br/>[index.ts]")]
end

node_admin(("Admin"))

node_admin -->|"enters credentials"| node_login
node_login -->|"posts login"| node_login_route
node_login_route -->|"validates and creates session"| node_admin_sessions
node_admin -.->|"uses dashboard"| node_dashboard_page
node_dashboard_page -->|"requests readings and updates"| node_monitoring_actions
node_dashboard_page -->|"renders"| node_map
node_dashboard_page -->|"renders"| node_node_details
node_dashboard_page -->|"renders"| node_node_management
node_dashboard_page -->|"renders"| node_add_node
node_dashboard_page -->|"renders"| node_history
node_dashboard_page -->|"renders"| node_location_search
node_dashboard_page -->|"wraps dashboard widgets"| node_panels
node_monitoring_actions -->|"checks session"| node_auth
node_monitoring_actions -->|"reads and writes"| node_database
node_database -->|"uses tables"| node_schema
node_monitoring_actions -->|"fetches live readings"| node_openaq
node_auth_api -->|"dispatches requests"| node_auth
node_location_search -.->|"alternative implementation"| node_location_search_basic

click node_login "https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/components/auth-form.tsx"
click node_login_route "https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/app/api/admin/login/route.ts"
click node_admin_sessions "https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/lib/admin-auth.ts"
click node_auth_api "https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/app/api/auth/%5B...all%5D/route.ts"
click node_auth "https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/lib/auth.ts"
click node_dashboard_page "https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/app/dashboard/page.tsx"
click node_map "https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/components/map/pollution-map.tsx"
click node_node_details "https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/components/map/node-details-panel.tsx"
click node_node_management "https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/components/dashboard/node-management-panel.tsx"
click node_add_node "https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/components/dashboard/add-node-dialog.tsx"
click node_history "https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/components/dashboard/history-panel.tsx"
click node_location_search "https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/components/dashboard/location-search-enhanced.tsx"
click node_location_search_basic "https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/components/dashboard/location-search.tsx"
click node_panels "https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/components/dashboard/draggable-panel.tsx"
click node_monitoring_actions "https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/app/actions/monitoring.ts"
click node_schema "https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/lib/db/schema.ts"
click node_database "https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/lib/db/index.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_login,node_login_route,node_admin_sessions,node_auth_api,node_auth toneBlue
class node_dashboard_page,node_map,node_node_details,node_node_management,node_add_node,node_history,node_location_search,node_location_search_basic,node_panels toneAmber
class node_monitoring_actions,node_openaq toneMint
class node_schema,node_database toneRose
class node_admin toneIndigo
```

## Components

### Access and sessions

- [Admin login form](https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/components/auth-form.tsx): `components/auth-form.tsx`
- [Admin login route](https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/app/api/admin/login/route.ts): `app/api/admin/login/route.ts`
- [Admin sessions](https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/lib/admin-auth.ts): `lib/admin-auth.ts`
- [Auth API route](https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/app/api/auth/%5B...all%5D/route.ts): `app/api/auth/[...all]/route.ts`
- [User authentication](https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/lib/auth.ts): `lib/auth.ts`

### Monitoring dashboard

- [Dashboard orchestration](https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/app/dashboard/page.tsx): `app/dashboard/page.tsx`
- [Pollution map](https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/components/map/pollution-map.tsx): `components/map/pollution-map.tsx`
- [Node details](https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/components/map/node-details-panel.tsx): `components/map/node-details-panel.tsx`
- [Node management](https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/components/dashboard/node-management-panel.tsx): `components/dashboard/node-management-panel.tsx`
- [Add node dialog](https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/components/dashboard/add-node-dialog.tsx): `components/dashboard/add-node-dialog.tsx`
- [Reading history](https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/components/dashboard/history-panel.tsx): `components/dashboard/history-panel.tsx`
- [Location search](https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/components/dashboard/location-search-enhanced.tsx): `components/dashboard/location-search-enhanced.tsx`
- [Location search](https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/components/dashboard/location-search.tsx): `components/dashboard/location-search.tsx`
- [Draggable panels](https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/components/dashboard/draggable-panel.tsx): `components/dashboard/draggable-panel.tsx`

### Monitoring services

- [Monitoring actions](https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/app/actions/monitoring.ts): `app/actions/monitoring.ts`
- **OpenAQ readings**

### Persistence

- [Monitoring schema](https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/lib/db/schema.ts): `lib/db/schema.ts`
- [Application database](https://github.com/ivanmercado0998/navicom-aerotrace/blob/main/lib/db/index.ts): `lib/db/index.ts`

### Other components

- **Admin**

## Connections

- Admin → Admin login form: enters credentials (evidence: `components/auth-form.tsx`)
- Admin login form → Admin login route: posts login (evidence: `components/auth-form.tsx`)
- Admin login route → Admin sessions: validates and creates session (evidence: `app/api/admin/login/route.ts`)
- Admin → Dashboard orchestration: uses dashboard
- Dashboard orchestration → Monitoring actions: requests readings and updates (evidence: `app/dashboard/page.tsx`)
- Dashboard orchestration → Pollution map: renders (evidence: `app/dashboard/page.tsx`)
- Dashboard orchestration → Node details: renders (evidence: `app/dashboard/page.tsx`)
- Dashboard orchestration → Node management: renders (evidence: `app/dashboard/page.tsx`)
- Dashboard orchestration → Add node dialog: renders (evidence: `app/dashboard/page.tsx`)
- Dashboard orchestration → Reading history: renders (evidence: `app/dashboard/page.tsx`)
- Dashboard orchestration → Location search: renders (evidence: `app/dashboard/page.tsx`)
- Dashboard orchestration → Draggable panels: wraps dashboard widgets (evidence: `app/dashboard/page.tsx`)
- Monitoring actions → User authentication: checks session (evidence: `app/actions/monitoring.ts`)
- Monitoring actions → Application database: reads and writes (evidence: `app/actions/monitoring.ts`)
- Application database → Monitoring schema: uses tables (evidence: `lib/db/index.ts`)
- Monitoring actions → OpenAQ readings: fetches live readings (evidence: `app/actions/monitoring.ts`)
- Auth API route → User authentication: dispatches requests (evidence: `app/api/auth/[...all]/route.ts`)
- Location search → Location search: alternative implementation
