# marcojaycee2-afk/wifi architecture

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

- Interactive diagram: https://gitdiagram.com/marcojaycee2-afk/wifi
- Repository: https://github.com/marcojaycee2-afk/wifi

## Overview

NAPBOX is an ISP customer and network-access-point manager. An administrator signs in, manages the client roster and NAP boxes, and connects clients to available ports; the application stores shared state in PostgreSQL. The NAP interface also provides grid, splitter, and map views. The sampled server and NAP excerpts support the authentication, persistence, and map-configuration links shown; the README documents the client workflow and map providers, but much of the general dashboard implementation was not sampled.

Main entry points: [`backend/server.js`](https://github.com/marcojaycee2-afk/wifi/blob/main/backend/server.js) (HTTP API), [`naps.js`](https://github.com/marcojaycee2-afk/wifi/blob/main/naps.js) (NAP boxes and ports), [`login.html`](https://github.com/marcojaycee2-afk/wifi/blob/main/login.html) (Sign-in page), [`index.html`](https://github.com/marcojaycee2-afk/wifi/blob/main/index.html) (Management dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Admin access"]
  node_login["Sign-in page<br/>[login.html]"]
  node_auth["Session authentication<br/>[auth.js]"]
end

subgraph group_app["ISP management"]
  node_dashboard["Management dashboard<br/>[index.html]"]
  node_nap["NAP boxes and ports<br/>[naps.js]"]
end

subgraph group_service["Application service"]
  node_server["HTTP API<br/>[server.js]"]
  node_state[("Saved application state<br/>[schema.sql]")]
end

subgraph group_maps["Mapping"]
  node_osm["OpenStreetMap tiles"]
  node_mapbox["Mapbox maps"]
end

node_admin(("Administrator"))

node_admin -->|"signs in"| node_login
node_login -->|"submits credentials"| node_server
node_server -->|"checks sessions"| node_auth
node_server -->|"serves page"| node_login
node_server -->|"serves dashboard"| node_dashboard
node_dashboard -->|"loads and saves state"| node_server
node_server -->|"reads and writes"| node_state
node_nap -->|"fetches map config"| node_server
node_nap -->|"uses fallback tiles"| node_osm
node_nap -.->|"optionally renders map"| node_mapbox

click node_login "https://github.com/marcojaycee2-afk/wifi/blob/main/login.html"
click node_auth "https://github.com/marcojaycee2-afk/wifi/blob/main/backend/auth.js"
click node_dashboard "https://github.com/marcojaycee2-afk/wifi/blob/main/index.html"
click node_nap "https://github.com/marcojaycee2-afk/wifi/blob/main/naps.js"
click node_server "https://github.com/marcojaycee2-afk/wifi/blob/main/backend/server.js"
click node_state "https://github.com/marcojaycee2-afk/wifi/blob/main/backend/schema.sql"

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_auth toneBlue
class node_dashboard,node_nap toneAmber
class node_server,node_state toneMint
class node_osm,node_mapbox toneRose
class node_admin toneIndigo
```

## Components

### Admin access

- [Sign-in page](https://github.com/marcojaycee2-afk/wifi/blob/main/login.html): `login.html`
- [Session authentication](https://github.com/marcojaycee2-afk/wifi/blob/main/backend/auth.js): `backend/auth.js`

### ISP management

- [Management dashboard](https://github.com/marcojaycee2-afk/wifi/blob/main/index.html): `index.html`
- [NAP boxes and ports](https://github.com/marcojaycee2-afk/wifi/blob/main/naps.js): `naps.js`

### Application service

- [HTTP API](https://github.com/marcojaycee2-afk/wifi/blob/main/backend/server.js): `backend/server.js`
- [Saved application state](https://github.com/marcojaycee2-afk/wifi/blob/main/backend/schema.sql): `backend/schema.sql`

### Mapping

- **OpenStreetMap tiles**
- **Mapbox maps**

### Other components

- **Administrator**

## Connections

- Administrator → Sign-in page: signs in (evidence: `README.md`)
- Sign-in page → HTTP API: submits credentials (evidence: `backend/server.js`)
- HTTP API → Session authentication: checks sessions (evidence: `backend/server.js`)
- HTTP API → Sign-in page: serves page (evidence: `backend/server.js`)
- HTTP API → Management dashboard: serves dashboard (evidence: `backend/server.js`)
- Management dashboard → HTTP API: loads and saves state (evidence: `README.md`)
- HTTP API → Saved application state: reads and writes (evidence: `backend/server.js`)
- NAP boxes and ports → HTTP API: fetches map config (evidence: `naps.js`)
- NAP boxes and ports → OpenStreetMap tiles: uses fallback tiles (evidence: `README.md`)
- NAP boxes and ports → Mapbox maps: optionally renders map (evidence: `naps.js`)
