# riemarseruelas/3dmap architecture

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

- Interactive diagram: https://gitdiagram.com/riemarseruelas/3dmap
- Repository: https://github.com/riemarseruelas/3dmap

## Overview

Company Street View is an internal, role-based plant navigation and configuration application. Employees sign in, choose a site and area, then navigate linked 360° panoramas; administrators configure locations, maps, Tour/Safety information, and image assets. The backend keeps live map configuration and tracking records in PostgreSQL and image files under public/uploads, with optional multiresolution optimization and manual unused-file cleanup. Edges follow shown frontend routing/API calls or README-documented behavior; unsampled implementation details are not inferred.

Main entry points: [`src/App.jsx`](https://github.com/riemarseruelas/3dmap/blob/master/src/App.jsx) (Route and access control), [`server/index.cjs`](https://github.com/riemarseruelas/3dmap/blob/master/server/index.cjs) (HTTP API and routing), [`src/utils/streetViewAdminStorage.js`](https://github.com/riemarseruelas/3dmap/blob/master/src/utils/streetViewAdminStorage.js) (Map and asset API client), [`server/storage.cjs`](https://github.com/riemarseruelas/3dmap/blob/master/server/storage.cjs) (Upload and file operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Navigation experience"]
  node_app["Route and access control<br/>[App.jsx]"]
  node_login["Sign-in<br/>[LoginPage.jsx]"]
  node_kiosk["Site selection<br/>[KioskPage.jsx]"]
  node_area_map["Area map<br/>[AreaMapPage.jsx]"]
  node_street_page["Viewer page<br/>[StreetViewPage.jsx]"]
  node_viewer["360° navigation<br/>[StreetViewer.jsx]"]
end

subgraph group_administration["Admin configuration"]
  node_admin_home["Admin site setup<br/>[AdminPage.jsx]"]
  node_admin_config["Location and mode setup"]
  node_image_maintenance["Image maintenance"]
end

subgraph group_services["Application services"]
  node_frontend_store["Map and asset API client"]
  node_auth_client["Auth and session client<br/>[auth.js]"]
  node_usage_client["Usage session tracker<br/>[usageSession.js]"]
  node_api["HTTP API and routing<br/>[index.cjs]"]
  node_auth_service["Authentication service<br/>[auth.cjs]"]
  node_file_service["Upload and file operations<br/>[storage.cjs]"]
  node_optimizer["Panorama tiling<br/>[multires.cjs]"]
end

subgraph group_persistence["Storage and tracking"]
  node_repository["Map and asset repository<br/>[repository.cjs]"]
  node_database[("PostgreSQL access and schema<br/>[db.cjs]")]
  node_uploads[("Image file store")]
end

node_employee(("Employee / Admin"))

node_employee -->|"uses"| node_app
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_kiosk
node_app -->|"routes to"| node_area_map
node_app -->|"routes to"| node_street_page
node_app -->|"routes to"| node_admin_home
node_app -->|"routes to"| node_admin_config
node_login -->|"authenticates via"| node_auth_client
node_auth_client -->|"calls auth endpoints"| node_api
node_app -->|"tracks usage with"| node_usage_client
node_usage_client -->|"posts session events"| node_api
node_area_map -->|"loads map data"| node_frontend_store
node_street_page -->|"renders"| node_viewer
node_admin_home -->|"saves map setup"| node_frontend_store
node_admin_config -->|"configures locations"| node_frontend_store
node_admin_config -->|"hosts"| node_image_maintenance
node_image_maintenance -->|"uses"| node_frontend_store
node_frontend_store -->|"calls map and asset APIs"| node_api
node_api -->|"delegates auth"| node_auth_service
node_api -->|"reads and saves state"| node_repository
node_api -->|"handles assets"| node_file_service
node_api -->|"initializes and checks"| node_database
node_file_service -->|"registers assets"| node_repository
node_file_service -->|"generates tiles"| node_optimizer
node_repository -->|"queries and updates"| node_database
node_file_service -->|"stores and manages files"| node_uploads
node_viewer -->|"loads panorama images"| node_uploads
node_repository -->|"tracks file references"| node_uploads

click node_app "https://github.com/riemarseruelas/3dmap/blob/master/src/App.jsx"
click node_login "https://github.com/riemarseruelas/3dmap/blob/master/src/pages/LoginPage.jsx"
click node_kiosk "https://github.com/riemarseruelas/3dmap/blob/master/src/pages/KioskPage.jsx"
click node_area_map "https://github.com/riemarseruelas/3dmap/blob/master/src/pages/AreaMapPage.jsx"
click node_street_page "https://github.com/riemarseruelas/3dmap/blob/master/src/pages/StreetViewPage.jsx"
click node_viewer "https://github.com/riemarseruelas/3dmap/blob/master/src/components/StreetViewer.jsx"
click node_admin_home "https://github.com/riemarseruelas/3dmap/blob/master/src/pages/AdminPage.jsx"
click node_admin_config "https://github.com/riemarseruelas/3dmap/blob/master/src/pages/AdminAreaConfigPage.jsx"
click node_image_maintenance "https://github.com/riemarseruelas/3dmap/blob/master/src/components/ImageMaintenancePanel.jsx"
click node_frontend_store "https://github.com/riemarseruelas/3dmap/blob/master/src/utils/streetViewAdminStorage.js"
click node_auth_client "https://github.com/riemarseruelas/3dmap/blob/master/src/utils/auth.js"
click node_usage_client "https://github.com/riemarseruelas/3dmap/blob/master/src/utils/usageSession.js"
click node_api "https://github.com/riemarseruelas/3dmap/blob/master/server/index.cjs"
click node_auth_service "https://github.com/riemarseruelas/3dmap/blob/master/server/auth.cjs"
click node_file_service "https://github.com/riemarseruelas/3dmap/blob/master/server/storage.cjs"
click node_optimizer "https://github.com/riemarseruelas/3dmap/blob/master/server/multires.cjs"
click node_repository "https://github.com/riemarseruelas/3dmap/blob/master/server/repository.cjs"
click node_database "https://github.com/riemarseruelas/3dmap/blob/master/server/db.cjs"
click node_uploads "https://github.com/riemarseruelas/3dmap/tree/master/public/uploads"

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_app,node_login,node_kiosk,node_area_map,node_street_page,node_viewer toneBlue
class node_admin_home,node_admin_config,node_image_maintenance toneAmber
class node_frontend_store,node_auth_client,node_usage_client,node_api,node_auth_service,node_file_service,node_optimizer toneMint
class node_repository,node_database,node_uploads toneRose
class node_employee toneIndigo
```

## Components

### Navigation experience

- [Route and access control](https://github.com/riemarseruelas/3dmap/blob/master/src/App.jsx): `src/App.jsx`
- [Sign-in](https://github.com/riemarseruelas/3dmap/blob/master/src/pages/LoginPage.jsx): `src/pages/LoginPage.jsx`
- [Site selection](https://github.com/riemarseruelas/3dmap/blob/master/src/pages/KioskPage.jsx): `src/pages/KioskPage.jsx`
- [Area map](https://github.com/riemarseruelas/3dmap/blob/master/src/pages/AreaMapPage.jsx): `src/pages/AreaMapPage.jsx`
- [Viewer page](https://github.com/riemarseruelas/3dmap/blob/master/src/pages/StreetViewPage.jsx): `src/pages/StreetViewPage.jsx`
- [360° navigation](https://github.com/riemarseruelas/3dmap/blob/master/src/components/StreetViewer.jsx): `src/components/StreetViewer.jsx`

### Admin configuration

- [Admin site setup](https://github.com/riemarseruelas/3dmap/blob/master/src/pages/AdminPage.jsx): `src/pages/AdminPage.jsx`
- [Location and mode setup](https://github.com/riemarseruelas/3dmap/blob/master/src/pages/AdminAreaConfigPage.jsx): `src/pages/AdminAreaConfigPage.jsx`
- [Image maintenance](https://github.com/riemarseruelas/3dmap/blob/master/src/components/ImageMaintenancePanel.jsx): `src/components/ImageMaintenancePanel.jsx`

### Application services

- [Map and asset API client](https://github.com/riemarseruelas/3dmap/blob/master/src/utils/streetViewAdminStorage.js): `src/utils/streetViewAdminStorage.js`
- [Auth and session client](https://github.com/riemarseruelas/3dmap/blob/master/src/utils/auth.js): `src/utils/auth.js`
- [Usage session tracker](https://github.com/riemarseruelas/3dmap/blob/master/src/utils/usageSession.js): `src/utils/usageSession.js`
- [HTTP API and routing](https://github.com/riemarseruelas/3dmap/blob/master/server/index.cjs): `server/index.cjs`
- [Authentication service](https://github.com/riemarseruelas/3dmap/blob/master/server/auth.cjs): `server/auth.cjs`
- [Upload and file operations](https://github.com/riemarseruelas/3dmap/blob/master/server/storage.cjs): `server/storage.cjs`
- [Panorama tiling](https://github.com/riemarseruelas/3dmap/blob/master/server/multires.cjs): `server/multires.cjs`

### Storage and tracking

- [Map and asset repository](https://github.com/riemarseruelas/3dmap/blob/master/server/repository.cjs): `server/repository.cjs`
- [PostgreSQL access and schema](https://github.com/riemarseruelas/3dmap/blob/master/server/db.cjs): `server/db.cjs`
- [Image file store](https://github.com/riemarseruelas/3dmap/tree/master/public/uploads): `public/uploads`

### Other components

- **Employee / Admin**

## Connections

- Employee / Admin → Route and access control: uses (evidence: `README.md`)
- Route and access control → Sign-in: routes to (evidence: `src/App.jsx`)
- Route and access control → Site selection: routes to (evidence: `src/App.jsx`)
- Route and access control → Area map: routes to (evidence: `src/App.jsx`)
- Route and access control → Viewer page: routes to (evidence: `src/App.jsx`)
- Route and access control → Admin site setup: routes to (evidence: `src/App.jsx`)
- Route and access control → Location and mode setup: routes to (evidence: `src/App.jsx`)
- Sign-in → Auth and session client: authenticates via (evidence: `src/pages/LoginPage.jsx`)
- Auth and session client → HTTP API and routing: calls auth endpoints (evidence: `src/utils/auth.js`)
- Route and access control → Usage session tracker: tracks usage with (evidence: `src/App.jsx`)
- Usage session tracker → HTTP API and routing: posts session events (evidence: `src/utils/usageSession.js`)
- Area map → Map and asset API client: loads map data (evidence: `src/pages/AreaMapPage.jsx`)
- Viewer page → 360° navigation: renders (evidence: `src/pages/StreetViewPage.jsx`)
- Admin site setup → Map and asset API client: saves map setup (evidence: `src/pages/AdminPage.jsx`)
- Location and mode setup → Map and asset API client: configures locations (evidence: `src/pages/AdminAreaConfigPage.jsx`)
- Location and mode setup → Image maintenance: hosts (evidence: `src/pages/AdminAreaConfigPage.jsx`)
- Image maintenance → Map and asset API client: uses (evidence: `src/components/ImageMaintenancePanel.jsx`)
- Map and asset API client → HTTP API and routing: calls map and asset APIs (evidence: `src/utils/streetViewAdminStorage.js`)
- HTTP API and routing → Authentication service: delegates auth (evidence: `server/index.cjs`)
- HTTP API and routing → Map and asset repository: reads and saves state (evidence: `server/index.cjs`)
- HTTP API and routing → Upload and file operations: handles assets (evidence: `server/index.cjs`)
- HTTP API and routing → PostgreSQL access and schema: initializes and checks (evidence: `server/index.cjs`)
- Upload and file operations → Map and asset repository: registers assets (evidence: `server/storage.cjs`)
- Upload and file operations → Panorama tiling: generates tiles (evidence: `server/storage.cjs`)
- Map and asset repository → PostgreSQL access and schema: queries and updates (evidence: `server/repository.cjs`)
- Upload and file operations → Image file store: stores and manages files (evidence: `README.md`)
- 360° navigation → Image file store: loads panorama images (evidence: `README.md`)
- Map and asset repository → Image file store: tracks file references (evidence: `README.md`)
