# truptikhade/smartcitymap-server architecture

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

- Interactive diagram: https://gitdiagram.com/truptikhade/smartcitymap-server
- Repository: https://github.com/truptikhade/smartcitymap-server

## Overview

SmartCity Map is an urban transit and navigation backend exposing Express APIs and Socket.io updates. Users authenticate, discover places or transit options, and can book transit or request rides; drivers and administrators have separate workflows. The graph highlights those domain stages and the service/repository layer behind them. The README describes AI/LLM capability, and the source index shows its service’s database dependency. Some route-to-controller and service-to-repository links are supported by the index; unsampled internals and integrations are not inferred.

Main entry points: [`server.js`](https://github.com/truptikhade/smartcitymap-server/blob/main/server.js) (HTTP and sockets), [`src/modules/auth/auth.service.js`](https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/auth/auth.service.js) (Auth workflows), [`src/modules/ride/ride.service.js`](https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/ride/ride.service.js) (Ride lifecycle), [`src/config/prisma.js`](https://github.com/truptikhade/smartcitymap-server/blob/main/src/config/prisma.js) (Prisma client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_platform["API platform"]
  node_server["HTTP and sockets<br/>[server.js]"]
  node_authmw["Auth middleware<br/>[auth.middleware.js]"]
  node_ratelimit["Rate limiting"]
  node_prisma["Prisma client<br/>[prisma.js]"]
  node_database[("PostgreSQL")]
end

subgraph group_identity["Identity"]
  node_authapi["Auth API<br/>[auth.router.js]"]
  node_authcontroller["Auth handlers<br/>[auth.controller.js]"]
  node_authservice["Auth workflows<br/>[auth.service.js]"]
  node_authrepo["Account repository<br/>[auth.repository.js]"]
  node_email["Email delivery<br/>[email.service.js]"]
end

subgraph group_navigation["Places and transit"]
  node_places["Places discovery"]
  node_transit["Transit planning<br/>[transit.service.js]"]
  node_transitrepo["Transit data access"]
  node_ai["AI recommendations<br/>[ai.service.js]"]
  node_tracking["Transit tracking<br/>[tracking.socket.js]"]
  node_simulator["Trip simulator<br/>[trip.simulator.js]"]
end

subgraph group_mobility["Ride and booking"]
  node_booking["Transit bookings<br/>[booking.service.js]"]
  node_payment["Payments<br/>[payment.service.js]"]
  node_ride["Ride lifecycle<br/>[ride.service.js]"]
  node_rideapi["Ride handlers<br/>[ride.controller.js]"]
  node_drivers["Driver operations<br/>[driver.service.js]"]
  node_admin["Admin operations<br/>[admin.service.js]"]
  node_ridesocket["Ride updates<br/>[ride.socket.js]"]
end

node_client(("API clients"))

node_client -->|"sends requests"| node_server
node_server -->|"mounts routes"| node_authapi
node_server -->|"mounts routes"| node_places
node_server -->|"mounts routes"| node_transit
node_server -->|"mounts routes"| node_booking
node_server -->|"mounts routes"| node_payment
node_server -->|"mounts routes"| node_ai
node_server -->|"mounts routes"| node_drivers
node_server -->|"mounts routes"| node_admin
node_server -->|"mounts routes"| node_rideapi
node_server -.->|"uses auth"| node_authmw
node_server -->|"applies limits"| node_ratelimit
node_authapi -->|"routes to"| node_authcontroller
node_authcontroller -->|"calls"| node_authservice
node_authservice -->|"reads and writes"| node_authrepo
node_authservice -->|"sends messages"| node_email
node_authrepo -->|"uses database client"| node_prisma
node_prisma -->|"connects"| node_database
node_transit -->|"queries"| node_transitrepo
node_transitrepo -->|"queries"| node_prisma
node_server -->|"starts trips"| node_simulator
node_simulator -->|"loads stops"| node_transitrepo
node_server -->|"initializes socket"| node_tracking
node_server -->|"initializes socket"| node_ridesocket
node_rideapi -->|"calls"| node_ride
node_ride -->|"uses ride socket"| node_ridesocket
node_ride -.->|"checks driver model"| node_drivers
node_booking -.->|"coordinates payment"| node_payment

click node_server "https://github.com/truptikhade/smartcitymap-server/blob/main/server.js"
click node_authmw "https://github.com/truptikhade/smartcitymap-server/blob/main/src/middleware/auth.middleware.js"
click node_ratelimit "https://github.com/truptikhade/smartcitymap-server/blob/main/src/middleware/rateLimit.middleware.js"
click node_prisma "https://github.com/truptikhade/smartcitymap-server/blob/main/src/config/prisma.js"
click node_authapi "https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/auth/auth.router.js"
click node_authcontroller "https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/auth/auth.controller.js"
click node_authservice "https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/auth/auth.service.js"
click node_authrepo "https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/auth/auth.repository.js"
click node_email "https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/auth/email.service.js"
click node_places "https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/places/places.controller.js"
click node_transit "https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/transit/transit.service.js"
click node_transitrepo "https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/transit/transit.repository.js"
click node_ai "https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/ai/ai.service.js"
click node_booking "https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/booking/booking.service.js"
click node_payment "https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/payment/payment.service.js"
click node_ride "https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/ride/ride.service.js"
click node_rideapi "https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/ride/ride.controller.js"
click node_drivers "https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/driver/driver.service.js"
click node_admin "https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/admin/admin.service.js"
click node_ridesocket "https://github.com/truptikhade/smartcitymap-server/blob/main/src/sockets/ride.socket.js"
click node_tracking "https://github.com/truptikhade/smartcitymap-server/blob/main/src/sockets/tracking.socket.js"
click node_simulator "https://github.com/truptikhade/smartcitymap-server/blob/main/src/sockets/trip.simulator.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_server,node_authmw,node_ratelimit,node_prisma,node_database,node_client toneBlue
class node_authapi,node_authcontroller,node_authservice,node_authrepo,node_email toneAmber
class node_places,node_transit,node_transitrepo,node_ai,node_tracking,node_simulator toneMint
class node_booking,node_payment,node_ride,node_rideapi,node_drivers,node_admin,node_ridesocket toneRose
```

## Components

### API platform

- [HTTP and sockets](https://github.com/truptikhade/smartcitymap-server/blob/main/server.js): `server.js`
- [Auth middleware](https://github.com/truptikhade/smartcitymap-server/blob/main/src/middleware/auth.middleware.js): `src/middleware/auth.middleware.js`
- [Rate limiting](https://github.com/truptikhade/smartcitymap-server/blob/main/src/middleware/rateLimit.middleware.js): `src/middleware/rateLimit.middleware.js`
- [Prisma client](https://github.com/truptikhade/smartcitymap-server/blob/main/src/config/prisma.js): `src/config/prisma.js`
- **PostgreSQL**

### Identity

- [Auth API](https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/auth/auth.router.js): `src/modules/auth/auth.router.js`
- [Auth handlers](https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/auth/auth.controller.js): `src/modules/auth/auth.controller.js`
- [Auth workflows](https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/auth/auth.service.js): `src/modules/auth/auth.service.js`
- [Account repository](https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/auth/auth.repository.js): `src/modules/auth/auth.repository.js`
- [Email delivery](https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/auth/email.service.js): `src/modules/auth/email.service.js`

### Places and transit

- [Places discovery](https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/places/places.controller.js): `src/modules/places/places.controller.js`
- [Transit planning](https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/transit/transit.service.js): `src/modules/transit/transit.service.js`
- [Transit data access](https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/transit/transit.repository.js): `src/modules/transit/transit.repository.js`
- [AI recommendations](https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/ai/ai.service.js): `src/modules/ai/ai.service.js`
- [Transit tracking](https://github.com/truptikhade/smartcitymap-server/blob/main/src/sockets/tracking.socket.js): `src/sockets/tracking.socket.js`
- [Trip simulator](https://github.com/truptikhade/smartcitymap-server/blob/main/src/sockets/trip.simulator.js): `src/sockets/trip.simulator.js`

### Ride and booking

- [Transit bookings](https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/booking/booking.service.js): `src/modules/booking/booking.service.js`
- [Payments](https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/payment/payment.service.js): `src/modules/payment/payment.service.js`
- [Ride lifecycle](https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/ride/ride.service.js): `src/modules/ride/ride.service.js`
- [Ride handlers](https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/ride/ride.controller.js): `src/modules/ride/ride.controller.js`
- [Driver operations](https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/driver/driver.service.js): `src/modules/driver/driver.service.js`
- [Admin operations](https://github.com/truptikhade/smartcitymap-server/blob/main/src/modules/admin/admin.service.js): `src/modules/admin/admin.service.js`
- [Ride updates](https://github.com/truptikhade/smartcitymap-server/blob/main/src/sockets/ride.socket.js): `src/sockets/ride.socket.js`

### Other components

- **API clients**

## Connections

- API clients → HTTP and sockets: sends requests
- HTTP and sockets → Auth API: mounts routes (evidence: `server.js`)
- HTTP and sockets → Places discovery: mounts routes (evidence: `server.js`)
- HTTP and sockets → Transit planning: mounts routes (evidence: `server.js`)
- HTTP and sockets → Transit bookings: mounts routes (evidence: `server.js`)
- HTTP and sockets → Payments: mounts routes (evidence: `server.js`)
- HTTP and sockets → AI recommendations: mounts routes (evidence: `server.js`)
- HTTP and sockets → Driver operations: mounts routes (evidence: `server.js`)
- HTTP and sockets → Admin operations: mounts routes (evidence: `server.js`)
- HTTP and sockets → Ride handlers: mounts routes (evidence: `server.js`)
- HTTP and sockets → Auth middleware: uses auth
- HTTP and sockets → Rate limiting: applies limits (evidence: `server.js`)
- Auth API → Auth handlers: routes to (evidence: `src/modules/auth/auth.router.js`)
- Auth handlers → Auth workflows: calls (evidence: `src/modules/auth/auth.controller.js`)
- Auth workflows → Account repository: reads and writes (evidence: `src/modules/auth/auth.service.js`)
- Auth workflows → Email delivery: sends messages (evidence: `src/modules/auth/auth.service.js`)
- Account repository → Prisma client: uses database client (evidence: `src/modules/auth/auth.repository.js`)
- Prisma client → PostgreSQL: connects (evidence: `src/config/prisma.js`)
- Transit planning → Transit data access: queries (evidence: `src/modules/transit/transit.service.js`)
- Transit data access → Prisma client: queries (evidence: `src/modules/transit/transit.repository.js`)
- HTTP and sockets → Trip simulator: starts trips (evidence: `server.js`)
- Trip simulator → Transit data access: loads stops (evidence: `src/sockets/trip.simulator.js`)
- HTTP and sockets → Transit tracking: initializes socket (evidence: `server.js`)
- HTTP and sockets → Ride updates: initializes socket (evidence: `server.js`)
- Ride handlers → Ride lifecycle: calls (evidence: `src/modules/ride/ride.controller.js`)
- Ride lifecycle → Ride updates: uses ride socket (evidence: `src/modules/ride/ride.service.js`)
- Ride lifecycle → Driver operations: checks driver model
- Transit bookings → Payments: coordinates payment
