# agprep/n2k architecture

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

## Overview

N2K Logistics is a browser-based logistics operations app with booking, delivery, dispatch, master-data, reporting, and sign-in pages. Its shared database connector handles live business data and session checks; a service worker provides an installable, offline-capable shell while leaving Supabase traffic live. Page internals are not excerpted, so their workflows and connections are not inferred. The page inventory comes from the file tree; connector and caching relationships are supported by the excerpts.

Main entry points: [`sw.js`](https://github.com/agprep/n2k/blob/main/sw.js) (Service Worker), [`n2k_db.js`](https://github.com/agprep/n2k/blob/main/n2k_db.js) (Live Data Connector), [`n2k_agent_booking.html`](https://github.com/agprep/n2k/blob/main/n2k_agent_booking.html) (Agent Booking), [`n2k_delivery.html`](https://github.com/agprep/n2k/blob/main/n2k_delivery.html) (Delivery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_operations["Logistics Operations"]
  node_agent_booking["Agent Booking"]
  node_delivery["Delivery<br/>[n2k_delivery.html]"]
  node_dispatch["Dispatch<br/>[n2k_dispatch.html]"]
end

subgraph group_admin["Administration"]
  node_masters["Master Data<br/>[n2k_masters.html]"]
  node_reports["Reports<br/>[n2k_reports.html]"]
  node_roadmap["Roadmap<br/>[n2k_roadmap.html]"]
end

subgraph group_runtime["Shared Runtime"]
  node_signin["Sign In<br/>[n2k_signin.html]"]
  node_home["App Home<br/>[index.html]"]
  node_db_connector["Live Data Connector<br/>[n2k_db.js]"]
end

subgraph group_offline["Offline Shell"]
  node_service_worker["Service Worker<br/>[sw.js]"]
  node_offline_page["Offline Page<br/>[offline.html]"]
  node_manifest["App Manifest"]
end

node_supabase[("Supabase")]

node_db_connector -->|"queries live data"| node_supabase
node_service_worker -->|"pre-caches shell"| node_home
node_service_worker -->|"pre-caches shell"| node_agent_booking
node_service_worker -->|"pre-caches shell"| node_delivery
node_service_worker -->|"pre-caches shell"| node_dispatch
node_service_worker -->|"pre-caches shell"| node_masters
node_service_worker -->|"pre-caches shell"| node_reports
node_service_worker -->|"pre-caches shell"| node_roadmap
node_service_worker -->|"network-first fallback"| node_db_connector
node_service_worker -->|"fallback navigation"| node_offline_page

click node_agent_booking "https://github.com/agprep/n2k/blob/main/n2k_agent_booking.html"
click node_delivery "https://github.com/agprep/n2k/blob/main/n2k_delivery.html"
click node_dispatch "https://github.com/agprep/n2k/blob/main/n2k_dispatch.html"
click node_masters "https://github.com/agprep/n2k/blob/main/n2k_masters.html"
click node_reports "https://github.com/agprep/n2k/blob/main/n2k_reports.html"
click node_roadmap "https://github.com/agprep/n2k/blob/main/n2k_roadmap.html"
click node_signin "https://github.com/agprep/n2k/blob/main/n2k_signin.html"
click node_home "https://github.com/agprep/n2k/blob/main/index.html"
click node_db_connector "https://github.com/agprep/n2k/blob/main/n2k_db.js"
click node_service_worker "https://github.com/agprep/n2k/blob/main/sw.js"
click node_offline_page "https://github.com/agprep/n2k/blob/main/offline.html"
click node_manifest "https://github.com/agprep/n2k/blob/main/manifest.webmanifest"

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_agent_booking,node_delivery,node_dispatch toneBlue
class node_masters,node_reports,node_roadmap,node_supabase toneAmber
class node_signin,node_home,node_db_connector toneMint
class node_service_worker,node_offline_page,node_manifest toneRose
```

## Components

### Logistics Operations

- [Agent Booking](https://github.com/agprep/n2k/blob/main/n2k_agent_booking.html): `n2k_agent_booking.html`
- [Delivery](https://github.com/agprep/n2k/blob/main/n2k_delivery.html): `n2k_delivery.html`
- [Dispatch](https://github.com/agprep/n2k/blob/main/n2k_dispatch.html): `n2k_dispatch.html`

### Administration

- [Master Data](https://github.com/agprep/n2k/blob/main/n2k_masters.html): `n2k_masters.html`
- [Reports](https://github.com/agprep/n2k/blob/main/n2k_reports.html): `n2k_reports.html`
- [Roadmap](https://github.com/agprep/n2k/blob/main/n2k_roadmap.html): `n2k_roadmap.html`

### Shared Runtime

- [Sign In](https://github.com/agprep/n2k/blob/main/n2k_signin.html): `n2k_signin.html`
- [App Home](https://github.com/agprep/n2k/blob/main/index.html): `index.html`
- [Live Data Connector](https://github.com/agprep/n2k/blob/main/n2k_db.js): `n2k_db.js`

### Offline Shell

- [Service Worker](https://github.com/agprep/n2k/blob/main/sw.js): `sw.js`
- [Offline Page](https://github.com/agprep/n2k/blob/main/offline.html): `offline.html`
- [App Manifest](https://github.com/agprep/n2k/blob/main/manifest.webmanifest): `manifest.webmanifest`

### Other components

- **Supabase**

## Connections

- Live Data Connector → Supabase: queries live data (evidence: `n2k_db.js`)
- Service Worker → App Home: pre-caches shell (evidence: `sw.js`)
- Service Worker → Agent Booking: pre-caches shell (evidence: `sw.js`)
- Service Worker → Delivery: pre-caches shell (evidence: `sw.js`)
- Service Worker → Dispatch: pre-caches shell (evidence: `sw.js`)
- Service Worker → Master Data: pre-caches shell (evidence: `sw.js`)
- Service Worker → Reports: pre-caches shell (evidence: `sw.js`)
- Service Worker → Roadmap: pre-caches shell (evidence: `sw.js`)
- Service Worker → Live Data Connector: network-first fallback (evidence: `sw.js`)
- Service Worker → Offline Page: fallback navigation (evidence: `sw.js`)
