# nazmul19/geofencing-app architecture

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

- Interactive diagram: https://gitdiagram.com/nazmul19/geofencing-app
- Repository: https://github.com/nazmul19/geofencing-app

## Overview

Geofencing App is a multi-tenant web application for managing organizations, users, geofences, routes, and field assignments. Users sign up or log in, then use role-gated dashboards to configure geofences and routes, assign work, check in, and view notifications. The frontend calls a NestJS API backed by PostgreSQL. The sampled source verifies route/geofence management and assignment-to-notification links; unsampled page and service connections are omitted where evidence is unavailable.

Main entry points: [`frontend/src/App.jsx`](https://github.com/nazmul19/geofencing-app/blob/main/frontend/src/App.jsx) (App routes), [`frontend/src/services/orgApi.js`](https://github.com/nazmul19/geofencing-app/blob/main/frontend/src/services/orgApi.js) (Organization API client), [`frontend/src/pages/ManageRoutes.jsx`](https://github.com/nazmul19/geofencing-app/blob/main/frontend/src/pages/ManageRoutes.jsx) (Route management), [`backend/src/auth/auth.service.ts`](https://github.com/nazmul19/geofencing-app/blob/main/backend/src/auth/auth.service.ts) (Authentication logic)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_app["App routes<br/>[App.jsx]"]
  node_authstate["Auth state<br/>[AuthContext.jsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_admin["Admin dashboard<br/>[AdminDashboard.jsx]"]
  node_manageusers["User management<br/>[ManageUsers.jsx]"]
  node_managegeo["Geofence management"]
  node_manageroutes["Route management<br/>[ManageRoutes.jsx]"]
  node_assignments["Assignment management"]
  node_myassignments["My assignments<br/>[MyAssignments.jsx]"]
  node_notificationspage["Notifications<br/>[Notifications.jsx]"]
  node_orgapi["Organization API client<br/>[orgApi.js]"]
  node_map["Map view<br/>[MapComponent.jsx]"]
  node_authapi["Auth API client<br/>[api.js]"]
end

subgraph group_identity["Identity and tenancy"]
  node_authcontroller["Authentication endpoint<br/>[auth.controller.ts]"]
  node_authservice["Authentication logic<br/>[auth.service.ts]"]
  node_users["User service<br/>[users.service.ts]"]
  node_organizations["Organization service"]
end

subgraph group_operations["Geospatial operations"]
  node_geofencecontroller["Geofence endpoint"]
  node_geofences["Geofence service"]
  node_routescontroller["Route endpoint"]
  node_routes["Route service<br/>[routes.service.ts]"]
  node_assignmentcontroller["Assignment endpoint"]
  node_assignmentservice["Assignment service"]
  node_notificationservice["Notification service"]
end

subgraph group_backend["API and persistence"]
  node_postgres[("PostgreSQL")]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"provides auth"| node_authstate
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_admin
node_app -->|"routes to"| node_manageusers
node_app -->|"routes to"| node_managegeo
node_app -->|"routes to"| node_manageroutes
node_app -->|"routes to"| node_assignments
node_app -->|"routes to"| node_myassignments
node_app -->|"routes to"| node_notificationspage
node_authstate -->|"calls"| node_authapi
node_manageroutes -->|"calls"| node_orgapi
node_manageroutes -->|"renders"| node_map
node_managegeo -->|"calls"| node_orgapi
node_orgapi -->|"HTTP requests"| node_geofencecontroller
node_orgapi -->|"HTTP requests"| node_routescontroller
node_orgapi -->|"HTTP requests"| node_assignmentcontroller
node_authapi -.->|"HTTP requests"| node_authcontroller
node_authcontroller -->|"delegates"| node_authservice
node_authservice -->|"looks up users"| node_users
node_authservice -->|"finds or creates org"| node_organizations
node_geofencecontroller -->|"delegates"| node_geofences
node_routescontroller -->|"delegates"| node_routes
node_routes -->|"resolves geofences"| node_geofences
node_assignmentcontroller -->|"delegates"| node_assignmentservice
node_assignmentservice -->|"uses"| node_notificationservice
node_geofences -.->|"reads and writes"| node_postgres
node_routes -.->|"reads and writes"| node_postgres
node_users -.->|"reads and writes"| node_postgres
node_organizations -.->|"reads and writes"| node_postgres
node_assignmentservice -.->|"reads and writes"| node_postgres
node_notificationservice -.->|"reads and writes"| node_postgres

click node_app "https://github.com/nazmul19/geofencing-app/blob/main/frontend/src/App.jsx"
click node_authstate "https://github.com/nazmul19/geofencing-app/blob/main/frontend/src/contexts/AuthContext.jsx"
click node_dashboard "https://github.com/nazmul19/geofencing-app/blob/main/frontend/src/pages/Dashboard.jsx"
click node_admin "https://github.com/nazmul19/geofencing-app/blob/main/frontend/src/pages/AdminDashboard.jsx"
click node_manageusers "https://github.com/nazmul19/geofencing-app/blob/main/frontend/src/pages/ManageUsers.jsx"
click node_managegeo "https://github.com/nazmul19/geofencing-app/blob/main/frontend/src/pages/ManageGeofences.jsx"
click node_manageroutes "https://github.com/nazmul19/geofencing-app/blob/main/frontend/src/pages/ManageRoutes.jsx"
click node_assignments "https://github.com/nazmul19/geofencing-app/blob/main/frontend/src/pages/ManageAssignments.jsx"
click node_myassignments "https://github.com/nazmul19/geofencing-app/blob/main/frontend/src/pages/MyAssignments.jsx"
click node_notificationspage "https://github.com/nazmul19/geofencing-app/blob/main/frontend/src/pages/Notifications.jsx"
click node_orgapi "https://github.com/nazmul19/geofencing-app/blob/main/frontend/src/services/orgApi.js"
click node_map "https://github.com/nazmul19/geofencing-app/blob/main/frontend/src/components/MapComponent.jsx"
click node_authapi "https://github.com/nazmul19/geofencing-app/blob/main/frontend/src/services/api.js"
click node_authcontroller "https://github.com/nazmul19/geofencing-app/blob/main/backend/src/auth/auth.controller.ts"
click node_authservice "https://github.com/nazmul19/geofencing-app/blob/main/backend/src/auth/auth.service.ts"
click node_users "https://github.com/nazmul19/geofencing-app/blob/main/backend/src/users/users.service.ts"
click node_organizations "https://github.com/nazmul19/geofencing-app/blob/main/backend/src/organizations/organizations.service.ts"
click node_geofencecontroller "https://github.com/nazmul19/geofencing-app/blob/main/backend/src/geofences/geofences.controller.ts"
click node_geofences "https://github.com/nazmul19/geofencing-app/blob/main/backend/src/geofences/geofences.service.ts"
click node_routescontroller "https://github.com/nazmul19/geofencing-app/blob/main/backend/src/routes/routes.controller.ts"
click node_routes "https://github.com/nazmul19/geofencing-app/blob/main/backend/src/routes/routes.service.ts"
click node_assignmentcontroller "https://github.com/nazmul19/geofencing-app/blob/main/backend/src/route-assignments/route-assignments.controller.ts"
click node_assignmentservice "https://github.com/nazmul19/geofencing-app/blob/main/backend/src/route-assignments/route-assignments.service.ts"
click node_notificationservice "https://github.com/nazmul19/geofencing-app/blob/main/backend/src/notifications/notifications.service.ts"

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_authstate,node_dashboard,node_admin,node_manageusers,node_managegeo,node_manageroutes,node_assignments,node_myassignments,node_notificationspage,node_orgapi,node_map,node_authapi,node_user toneBlue
class node_authcontroller,node_authservice,node_users,node_organizations toneAmber
class node_geofencecontroller,node_geofences,node_routescontroller,node_routes,node_assignmentcontroller,node_assignmentservice,node_notificationservice toneMint
class node_postgres toneRose
```

## Components

### Web experience

- [App routes](https://github.com/nazmul19/geofencing-app/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Auth state](https://github.com/nazmul19/geofencing-app/blob/main/frontend/src/contexts/AuthContext.jsx): `frontend/src/contexts/AuthContext.jsx`
- [Dashboard](https://github.com/nazmul19/geofencing-app/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Admin dashboard](https://github.com/nazmul19/geofencing-app/blob/main/frontend/src/pages/AdminDashboard.jsx): `frontend/src/pages/AdminDashboard.jsx`
- [User management](https://github.com/nazmul19/geofencing-app/blob/main/frontend/src/pages/ManageUsers.jsx): `frontend/src/pages/ManageUsers.jsx`
- [Geofence management](https://github.com/nazmul19/geofencing-app/blob/main/frontend/src/pages/ManageGeofences.jsx): `frontend/src/pages/ManageGeofences.jsx`
- [Route management](https://github.com/nazmul19/geofencing-app/blob/main/frontend/src/pages/ManageRoutes.jsx): `frontend/src/pages/ManageRoutes.jsx`
- [Assignment management](https://github.com/nazmul19/geofencing-app/blob/main/frontend/src/pages/ManageAssignments.jsx): `frontend/src/pages/ManageAssignments.jsx`
- [My assignments](https://github.com/nazmul19/geofencing-app/blob/main/frontend/src/pages/MyAssignments.jsx): `frontend/src/pages/MyAssignments.jsx`
- [Notifications](https://github.com/nazmul19/geofencing-app/blob/main/frontend/src/pages/Notifications.jsx): `frontend/src/pages/Notifications.jsx`
- [Organization API client](https://github.com/nazmul19/geofencing-app/blob/main/frontend/src/services/orgApi.js): `frontend/src/services/orgApi.js`
- [Map view](https://github.com/nazmul19/geofencing-app/blob/main/frontend/src/components/MapComponent.jsx): `frontend/src/components/MapComponent.jsx`
- [Auth API client](https://github.com/nazmul19/geofencing-app/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### Identity and tenancy

- [Authentication endpoint](https://github.com/nazmul19/geofencing-app/blob/main/backend/src/auth/auth.controller.ts): `backend/src/auth/auth.controller.ts`
- [Authentication logic](https://github.com/nazmul19/geofencing-app/blob/main/backend/src/auth/auth.service.ts): `backend/src/auth/auth.service.ts`
- [User service](https://github.com/nazmul19/geofencing-app/blob/main/backend/src/users/users.service.ts): `backend/src/users/users.service.ts`
- [Organization service](https://github.com/nazmul19/geofencing-app/blob/main/backend/src/organizations/organizations.service.ts): `backend/src/organizations/organizations.service.ts`

### Geospatial operations

- [Geofence endpoint](https://github.com/nazmul19/geofencing-app/blob/main/backend/src/geofences/geofences.controller.ts): `backend/src/geofences/geofences.controller.ts`
- [Geofence service](https://github.com/nazmul19/geofencing-app/blob/main/backend/src/geofences/geofences.service.ts): `backend/src/geofences/geofences.service.ts`
- [Route endpoint](https://github.com/nazmul19/geofencing-app/blob/main/backend/src/routes/routes.controller.ts): `backend/src/routes/routes.controller.ts`
- [Route service](https://github.com/nazmul19/geofencing-app/blob/main/backend/src/routes/routes.service.ts): `backend/src/routes/routes.service.ts`
- [Assignment endpoint](https://github.com/nazmul19/geofencing-app/blob/main/backend/src/route-assignments/route-assignments.controller.ts): `backend/src/route-assignments/route-assignments.controller.ts`
- [Assignment service](https://github.com/nazmul19/geofencing-app/blob/main/backend/src/route-assignments/route-assignments.service.ts): `backend/src/route-assignments/route-assignments.service.ts`
- [Notification service](https://github.com/nazmul19/geofencing-app/blob/main/backend/src/notifications/notifications.service.ts): `backend/src/notifications/notifications.service.ts`

### API and persistence

- **PostgreSQL**

### Other components

- **User**

## Connections

- User → App routes: uses (evidence: `frontend/src/App.jsx`)
- App routes → Auth state: provides auth (evidence: `frontend/src/App.jsx`)
- App routes → Dashboard: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Admin dashboard: routes to (evidence: `frontend/src/App.jsx`)
- App routes → User management: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Geofence management: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Route management: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Assignment management: routes to (evidence: `frontend/src/App.jsx`)
- App routes → My assignments: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Notifications: routes to (evidence: `frontend/src/App.jsx`)
- Auth state → Auth API client: calls (evidence: `frontend/src/contexts/AuthContext.jsx`)
- Route management → Organization API client: calls (evidence: `frontend/src/pages/ManageRoutes.jsx`)
- Route management → Map view: renders (evidence: `frontend/src/pages/ManageRoutes.jsx`)
- Geofence management → Organization API client: calls (evidence: `frontend/src/pages/ManageGeofences.jsx`)
- Organization API client → Geofence endpoint: HTTP requests (evidence: `frontend/src/services/orgApi.js`)
- Organization API client → Route endpoint: HTTP requests (evidence: `frontend/src/services/orgApi.js`)
- Organization API client → Assignment endpoint: HTTP requests (evidence: `frontend/src/services/orgApi.js`)
- Auth API client → Authentication endpoint: HTTP requests
- Authentication endpoint → Authentication logic: delegates (evidence: `backend/src/auth/auth.controller.ts`)
- Authentication logic → User service: looks up users (evidence: `backend/src/auth/auth.service.ts`)
- Authentication logic → Organization service: finds or creates org (evidence: `backend/src/auth/auth.service.ts`)
- Geofence endpoint → Geofence service: delegates (evidence: `backend/src/geofences/geofences.controller.ts`)
- Route endpoint → Route service: delegates (evidence: `backend/src/routes/routes.controller.ts`)
- Route service → Geofence service: resolves geofences (evidence: `backend/src/routes/routes.service.ts`)
- Assignment endpoint → Assignment service: delegates (evidence: `backend/src/route-assignments/route-assignments.controller.ts`)
- Assignment service → Notification service: uses (evidence: `backend/src/route-assignments/route-assignments.service.ts`)
- Geofence service → PostgreSQL: reads and writes
- Route service → PostgreSQL: reads and writes
- User service → PostgreSQL: reads and writes
- Organization service → PostgreSQL: reads and writes
- Assignment service → PostgreSQL: reads and writes
- Notification service → PostgreSQL: reads and writes
