# atlasz2/projekt-labor architecture

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

- Interactive diagram: https://gitdiagram.com/atlasz2/projekt-labor
- Repository: https://github.com/atlasz2/projekt-labor

## Overview

The repository is a white-label tourism QR-points platform: visitors explore local content, scan station QR codes, earn server-validated points and rewards, and compete on leaderboards; staff manage that content in a web admin. The README documents the mobile app’s offline capabilities and the server’s callable workflows. Mobile implementation sources and several function handlers were not included in the tree or excerpts, so those nodes use the supported enclosing directory and only documented relationships are shown.

Main entry points: [`functions/index.js`](https://github.com/atlasz2/projekt-labor/blob/main/functions/index.js) (Callable and event handlers), [`mobile_app`](https://github.com/atlasz2/projekt-labor/tree/main/mobile_app) (Explore and play), [`admin/src/App.jsx`](https://github.com/atlasz2/projekt-labor/blob/main/admin/src/App.jsx) (Admin portal), [`admin/src/pages/Stations.jsx`](https://github.com/atlasz2/projekt-labor/blob/main/admin/src/pages/Stations.jsx) (Content management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Visitor app"]
  node_mobile_app["Explore and play"]
end

subgraph group_admin["Content administration"]
  node_admin_app["Admin portal<br/>[App.jsx]"]
  node_admin_auth["Staff access"]
  node_project_scope["Town selection<br/>[ProjectContext.jsx]"]
  node_content_manage["Content management<br/>[Stations.jsx]"]
  node_trip_manage["Trip planning<br/>[Trips.jsx]"]
  node_admin_insights["Analytics and dashboard<br/>[Analytics.jsx]"]
  node_user_manage["User administration<br/>[Users.jsx]"]
  node_route_client["Route requests<br/>[routeService.js]"]
end

subgraph group_backend["Server workflows"]
  node_functions_entry["Callable and event handlers<br/>[index.js]"]
  node_qr_redemption["QR redemption<br/>[redeem-core.js]"]
  node_account_privacy["Account and GDPR<br/>[gdpr-core.js]"]
  node_route_backend["Hiking routes"]
  node_analytics_backend["Trip analytics<br/>[analytics-core.js]"]
  node_notifications["Event notifications"]
end

subgraph group_data["Firebase services"]
  node_firebase_client["Firebase client<br/>[firebaseConfig.js]"]
  node_firestore[("Firestore")]
  node_storage[("Firebase Storage")]
end

node_visitor(("Tourist"))
node_staff(("Admin staff"))
node_routing_services["Routing providers"]

node_visitor -->|"uses"| node_mobile_app
node_mobile_app -->|"reads content"| node_firestore
node_mobile_app -->|"calls redemption"| node_functions_entry
node_functions_entry -->|"dispatches"| node_qr_redemption
node_qr_redemption -->|"validates and writes"| node_firestore
node_mobile_app -->|"caches offline"| node_firestore
node_staff -->|"uses"| node_admin_app
node_admin_app -->|"provides access"| node_admin_auth
node_admin_app -->|"provides town scope"| node_project_scope
node_admin_auth -->|"authenticates with"| node_firebase_client
node_project_scope -->|"manages projects"| node_firestore
node_content_manage -->|"manages content"| node_firestore
node_trip_manage -->|"manages trips"| node_firestore
node_trip_manage -->|"requests routes"| node_route_client
node_route_client -->|"calls hikingRoute"| node_functions_entry
node_functions_entry -->|"uses route parser"| node_route_backend
node_route_backend -.->|"queries providers"| node_routing_services
node_admin_insights -->|"requests analytics"| node_functions_entry
node_functions_entry -->|"dispatches"| node_analytics_backend
node_admin_insights -->|"reads metrics"| node_firestore
node_user_manage -->|"requests user actions"| node_functions_entry
node_functions_entry -->|"dispatches privacy actions"| node_account_privacy
node_functions_entry -->|"reads and writes"| node_firestore
node_content_manage -->|"uploads photos"| node_storage
node_notifications -->|"observes new events"| node_firestore
node_functions_entry -->|"builds notifications"| node_notifications

click node_mobile_app "https://github.com/atlasz2/projekt-labor/tree/main/mobile_app"
click node_admin_app "https://github.com/atlasz2/projekt-labor/blob/main/admin/src/App.jsx"
click node_admin_auth "https://github.com/atlasz2/projekt-labor/blob/main/admin/src/context/AdminAuthContext.jsx"
click node_project_scope "https://github.com/atlasz2/projekt-labor/blob/main/admin/src/context/ProjectContext.jsx"
click node_content_manage "https://github.com/atlasz2/projekt-labor/blob/main/admin/src/pages/Stations.jsx"
click node_trip_manage "https://github.com/atlasz2/projekt-labor/blob/main/admin/src/pages/Trips.jsx"
click node_admin_insights "https://github.com/atlasz2/projekt-labor/blob/main/admin/src/pages/Analytics.jsx"
click node_user_manage "https://github.com/atlasz2/projekt-labor/blob/main/admin/src/pages/Users.jsx"
click node_route_client "https://github.com/atlasz2/projekt-labor/blob/main/admin/src/utils/routeService.js"
click node_firebase_client "https://github.com/atlasz2/projekt-labor/blob/main/admin/src/firebaseConfig.js"
click node_functions_entry "https://github.com/atlasz2/projekt-labor/blob/main/functions/index.js"
click node_qr_redemption "https://github.com/atlasz2/projekt-labor/blob/main/functions/lib/redeem-core.js"
click node_account_privacy "https://github.com/atlasz2/projekt-labor/blob/main/functions/lib/gdpr-core.js"
click node_route_backend "https://github.com/atlasz2/projekt-labor/blob/main/functions/lib/hiking-route-core.js"
click node_analytics_backend "https://github.com/atlasz2/projekt-labor/blob/main/functions/lib/analytics-core.js"
click node_notifications "https://github.com/atlasz2/projekt-labor/blob/main/functions/lib/notification-builder.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_mobile_app toneBlue
class node_admin_app,node_admin_auth,node_project_scope,node_content_manage,node_trip_manage,node_admin_insights,node_user_manage,node_route_client toneAmber
class node_functions_entry,node_qr_redemption,node_account_privacy,node_route_backend,node_analytics_backend,node_notifications toneMint
class node_firebase_client,node_firestore,node_storage toneRose
class node_visitor,node_staff,node_routing_services toneIndigo
```

## Components

### Visitor app

- [Explore and play](https://github.com/atlasz2/projekt-labor/tree/main/mobile_app): `mobile_app`

### Content administration

- [Admin portal](https://github.com/atlasz2/projekt-labor/blob/main/admin/src/App.jsx): `admin/src/App.jsx`
- [Staff access](https://github.com/atlasz2/projekt-labor/blob/main/admin/src/context/AdminAuthContext.jsx): `admin/src/context/AdminAuthContext.jsx`
- [Town selection](https://github.com/atlasz2/projekt-labor/blob/main/admin/src/context/ProjectContext.jsx): `admin/src/context/ProjectContext.jsx`
- [Content management](https://github.com/atlasz2/projekt-labor/blob/main/admin/src/pages/Stations.jsx): `admin/src/pages/Stations.jsx`
- [Trip planning](https://github.com/atlasz2/projekt-labor/blob/main/admin/src/pages/Trips.jsx): `admin/src/pages/Trips.jsx`
- [Analytics and dashboard](https://github.com/atlasz2/projekt-labor/blob/main/admin/src/pages/Analytics.jsx): `admin/src/pages/Analytics.jsx`
- [User administration](https://github.com/atlasz2/projekt-labor/blob/main/admin/src/pages/Users.jsx): `admin/src/pages/Users.jsx`
- [Route requests](https://github.com/atlasz2/projekt-labor/blob/main/admin/src/utils/routeService.js): `admin/src/utils/routeService.js`

### Server workflows

- [Callable and event handlers](https://github.com/atlasz2/projekt-labor/blob/main/functions/index.js): `functions/index.js`
- [QR redemption](https://github.com/atlasz2/projekt-labor/blob/main/functions/lib/redeem-core.js): `functions/lib/redeem-core.js`
- [Account and GDPR](https://github.com/atlasz2/projekt-labor/blob/main/functions/lib/gdpr-core.js): `functions/lib/gdpr-core.js`
- [Hiking routes](https://github.com/atlasz2/projekt-labor/blob/main/functions/lib/hiking-route-core.js): `functions/lib/hiking-route-core.js`
- [Trip analytics](https://github.com/atlasz2/projekt-labor/blob/main/functions/lib/analytics-core.js): `functions/lib/analytics-core.js`
- [Event notifications](https://github.com/atlasz2/projekt-labor/blob/main/functions/lib/notification-builder.js): `functions/lib/notification-builder.js`

### Firebase services

- [Firebase client](https://github.com/atlasz2/projekt-labor/blob/main/admin/src/firebaseConfig.js): `admin/src/firebaseConfig.js`
- **Firestore**
- **Firebase Storage**

### Other components

- **Tourist**
- **Admin staff**
- **Routing providers**

## Connections

- Tourist → Explore and play: uses
- Explore and play → Firestore: reads content
- Explore and play → Callable and event handlers: calls redemption
- Callable and event handlers → QR redemption: dispatches (evidence: `functions/index.js`)
- QR redemption → Firestore: validates and writes
- Explore and play → Firestore: caches offline
- Admin staff → Admin portal: uses
- Admin portal → Staff access: provides access (evidence: `admin/src/App.jsx`)
- Admin portal → Town selection: provides town scope (evidence: `admin/src/App.jsx`)
- Staff access → Firebase client: authenticates with (evidence: `admin/src/context/AdminAuthContext.jsx`)
- Town selection → Firestore: manages projects (evidence: `admin/src/context/ProjectContext.jsx`)
- Content management → Firestore: manages content (evidence: `admin/src/pages/Stations.jsx`)
- Trip planning → Firestore: manages trips (evidence: `admin/src/pages/Trips.jsx`)
- Trip planning → Route requests: requests routes (evidence: `admin/src/pages/Trips.jsx`)
- Route requests → Callable and event handlers: calls hikingRoute (evidence: `admin/src/utils/routeService.js`)
- Callable and event handlers → Hiking routes: uses route parser (evidence: `functions/index.js`)
- Hiking routes → Routing providers: queries providers
- Analytics and dashboard → Callable and event handlers: requests analytics
- Callable and event handlers → Trip analytics: dispatches (evidence: `functions/index.js`)
- Analytics and dashboard → Firestore: reads metrics (evidence: `admin/src/pages/Analytics.jsx`)
- User administration → Callable and event handlers: requests user actions
- Callable and event handlers → Account and GDPR: dispatches privacy actions (evidence: `functions/index.js`)
- Callable and event handlers → Firestore: reads and writes (evidence: `functions/index.js`)
- Content management → Firebase Storage: uploads photos
- Event notifications → Firestore: observes new events
- Callable and event handlers → Event notifications: builds notifications (evidence: `functions/index.js`)
