# sfwebsolution/nexa architecture

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

- Interactive diagram: https://gitdiagram.com/sfwebsolution/nexa
- Repository: https://github.com/sfwebsolution/nexa

## Overview

Nexa is a browser-based messaging and social app, with account pages, a dashboard, live voice rooms, push notifications, and privileged administration. The likely user journey is account access followed by social activity in the dashboard; however, the README is empty and the sampled files do not show the page-level wiring, so that flow is represented by the components rather than inferred edges. The live-room module manages participant state and Firestore room records. The service worker handles push display and app caching, while the admin API performs privileged user operations and activity aggregation. Unsampled page capabilities are identified from filenames only.

Main entry points: [`firebase-messaging-sw.js`](https://github.com/sfwebsolution/nexa/blob/main/firebase-messaging-sw.js) (Push and cache worker), [`firebase.js`](https://github.com/sfwebsolution/nexa/blob/main/firebase.js) (Firebase client), [`server/admin-api.js`](https://github.com/sfwebsolution/nexa/blob/main/server/admin-api.js) (Admin API), [`nexa-voice-room.js`](https://github.com/sfwebsolution/nexa/blob/main/nexa-voice-room.js) (Voice room manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web app"]
  node_landing["Landing page<br/>[index.html]"]
  node_login["Login<br/>[login.html]"]
  node_signup["Sign up<br/>[signup.html]"]
  node_dashboard["Social dashboard<br/>[dashboard.html]"]
  node_appmain["App logic<br/>[app-main.js]"]
  node_firebaseclient["Firebase client<br/>[firebase.js]"]
end

subgraph group_rooms["Live rooms"]
  node_voice["Voice room manager<br/>[nexa-voice-room.js]"]
end

subgraph group_push["Push and PWA"]
  node_messagingworker["Push and cache worker"]
  node_serviceworker["Worker bootstrap<br/>[sw.js]"]
  node_onesignalworker["OneSignal worker"]
end

subgraph group_admin["Administration"]
  node_adminpage["Admin console<br/>[admin.html]"]
  node_adminapi["Admin API<br/>[admin-api.js]"]
end

node_visitor(("App visitor"))
node_firestore[("Cloud Firestore")]
node_firebaseauth["Firebase Authentication"]
node_peers["PeerJS / WebRTC"]
node_adminfirestore[("Admin Firestore")]
node_adminauth["Firebase Admin Auth"]

node_firebaseclient -->|"initializes client"| node_firestore
node_firebaseclient -->|"initializes client"| node_firebaseauth
node_firebaseclient -->|"registers worker"| node_messagingworker
node_messagingworker -.-> node_firestore
node_messagingworker -->|"shows notifications"| node_visitor
node_messagingworker -->|"opens on click"| node_dashboard
node_serviceworker -->|"imports"| node_messagingworker
node_onesignalworker -->|"loads push SDK"| node_visitor
node_voice -->|"reads and writes rooms"| node_firestore
node_voice -.->|"uses audio mesh"| node_peers
node_adminpage -->|"calls admin endpoints"| node_adminapi
node_adminapi -->|"reads and updates"| node_adminfirestore
node_adminapi -->|"updates accounts"| node_adminauth

click node_landing "https://github.com/sfwebsolution/nexa/blob/main/index.html"
click node_login "https://github.com/sfwebsolution/nexa/blob/main/login.html"
click node_signup "https://github.com/sfwebsolution/nexa/blob/main/signup.html"
click node_dashboard "https://github.com/sfwebsolution/nexa/blob/main/dashboard.html"
click node_appmain "https://github.com/sfwebsolution/nexa/blob/main/app-main.js"
click node_firebaseclient "https://github.com/sfwebsolution/nexa/blob/main/firebase.js"
click node_voice "https://github.com/sfwebsolution/nexa/blob/main/nexa-voice-room.js"
click node_messagingworker "https://github.com/sfwebsolution/nexa/blob/main/firebase-messaging-sw.js"
click node_serviceworker "https://github.com/sfwebsolution/nexa/blob/main/sw.js"
click node_onesignalworker "https://github.com/sfwebsolution/nexa/blob/main/OneSignalSDKWorker.js"
click node_adminpage "https://github.com/sfwebsolution/nexa/blob/main/admin.html"
click node_adminapi "https://github.com/sfwebsolution/nexa/blob/main/server/admin-api.js"

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_landing,node_login,node_signup,node_dashboard,node_appmain,node_firebaseclient toneBlue
class node_voice,node_firestore,node_adminfirestore toneAmber
class node_messagingworker,node_serviceworker,node_onesignalworker toneMint
class node_adminpage,node_adminapi toneRose
class node_visitor,node_firebaseauth,node_peers,node_adminauth toneIndigo
```

## Components

### Web app

- [Landing page](https://github.com/sfwebsolution/nexa/blob/main/index.html): `index.html`
- [Login](https://github.com/sfwebsolution/nexa/blob/main/login.html): `login.html`
- [Sign up](https://github.com/sfwebsolution/nexa/blob/main/signup.html): `signup.html`
- [Social dashboard](https://github.com/sfwebsolution/nexa/blob/main/dashboard.html): `dashboard.html`
- [App logic](https://github.com/sfwebsolution/nexa/blob/main/app-main.js): `app-main.js`
- [Firebase client](https://github.com/sfwebsolution/nexa/blob/main/firebase.js): `firebase.js`

### Live rooms

- [Voice room manager](https://github.com/sfwebsolution/nexa/blob/main/nexa-voice-room.js): `nexa-voice-room.js`

### Push and PWA

- [Push and cache worker](https://github.com/sfwebsolution/nexa/blob/main/firebase-messaging-sw.js): `firebase-messaging-sw.js`
- [Worker bootstrap](https://github.com/sfwebsolution/nexa/blob/main/sw.js): `sw.js`
- [OneSignal worker](https://github.com/sfwebsolution/nexa/blob/main/OneSignalSDKWorker.js): `OneSignalSDKWorker.js`

### Administration

- [Admin console](https://github.com/sfwebsolution/nexa/blob/main/admin.html): `admin.html`
- [Admin API](https://github.com/sfwebsolution/nexa/blob/main/server/admin-api.js): `server/admin-api.js`

### Other components

- **App visitor**
- **Cloud Firestore**
- **Firebase Authentication**
- **PeerJS / WebRTC**
- **Admin Firestore**
- **Firebase Admin Auth**

## Connections

- Firebase client → Cloud Firestore: initializes client (evidence: `firebase.js`)
- Firebase client → Firebase Authentication: initializes client (evidence: `firebase.js`)
- Firebase client → Push and cache worker: registers worker (evidence: `firebase.js`)
- Push and cache worker → Cloud Firestore
- Push and cache worker → App visitor: shows notifications (evidence: `firebase-messaging-sw.js`)
- Push and cache worker → Social dashboard: opens on click (evidence: `firebase-messaging-sw.js`)
- Worker bootstrap → Push and cache worker: imports (evidence: `sw.js`)
- OneSignal worker → App visitor: loads push SDK (evidence: `OneSignalSDKWorker.js`)
- Voice room manager → Cloud Firestore: reads and writes rooms (evidence: `nexa-voice-room.js`)
- Voice room manager → PeerJS / WebRTC: uses audio mesh
- Admin console → Admin API: calls admin endpoints (evidence: `server/admin-api.js`)
- Admin API → Admin Firestore: reads and updates (evidence: `server/admin-api.js`)
- Admin API → Firebase Admin Auth: updates accounts (evidence: `server/admin-api.js`)
