# akshayp47/loc_track architecture

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

- Interactive diagram: https://gitdiagram.com/akshayp47/loc_track
- Repository: https://github.com/akshayp47/loc_track

## Overview

1. This repository is split into two main runtime boundaries: a Vite-powered React frontend in `src/` and a separate Node-based backend in `server/`. That division is the primary architectural seam.

2. The frontend is a single-page app bootstrapped through `index.html`, `src/main.jsx`, and `src/App.jsx`, with global styling in `src/index.css` and `src/App.css`. The UI appears intentionally lightweight and page-driven rather than using a large framework.

3. The domain UI is organized by role and workflow:
   - `src/pages/Auth/Login.jsx` for authentication entry
   - `src/pages/Driver/Dashboard.jsx` for driver-facing operations
   - `src/pages/Passenger/MapView.jsx` for passenger-facing location/map interaction  
   This strongly suggests role-based navigation after login.

4. Realtime behavior is isolated in `src/services/socket.js` and `src/services/realtime.js`. These services form a shared client-side integration layer for live updates, so pages do not communicate directly with transport details.

5. The backend entrypoint is `server/index.js`, with its own `server/package.json` and `server/.env.example`, indicating an independently runnable service with environment-based configuration. The server is the likely source of API responses and realtime event coordination.

6. The presence of socket/realtime services on the client and a dedicated server folder implies a bidirectional event flow: frontend pages emit user actions, the backend brokers or processes them, and updates are pushed back into the UI in real time.

7. The passenger map view is the clearest feature boundary in the app. It likely consumes location or trip state from the realtime layer, while the driver dashboard likely publishes or manages driver state that other clients observe.

8. Build and packaging are managed by standard Vite tooling (`vite.config.js`, `package-lock.json`, `eslint.config.js`), so the frontend is compiled separately from the backend rather than served from a monolithic framework.

9. Deployment is explicitly configured with Render artifacts: `render.yaml`, `README_RENDER.md`, and `.renderignore`. That means the app is intended to be deployed as a hosted frontend/backend pair, not just run locally.

10. At an architecture-diagram level, the key boxes are:
   - browser client
   - React page shell
   - role-specific pages
   - shared realtime/socket client layer
   - Node backend
   - deployment/runtime configuration  
   The important data paths are login/session flow, role-based page rendering, and live trip/location updates.

11. There are no obvious signs of a heavy state-management or backend-framework layer in the tree, so the system looks deliberately small and compositional: pages own UI, services own transport, and the server owns persistence/business coordination if any exists.

Main entry points: [`src/App.jsx`](https://github.com/akshayp47/loc_track/blob/main/src/App.jsx) (App Shell), [`server/index.js`](https://github.com/akshayp47/loc_track/blob/main/server/index.js) (Server), [`src/services/realtime.js`](https://github.com/akshayp47/loc_track/blob/main/src/services/realtime.js) (Realtime Layer), [`index.html`](https://github.com/akshayp47/loc_track/blob/main/index.html) (HTML Shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_browser(("Browser<br/>client runtime"))
  node_html["HTML Shell<br/>app host<br/>[index.html]"]
  node_main["Main Entry<br/>react bootstrap<br/>[main.jsx]"]
  node_app["App Shell<br/>react shell<br/>[App.jsx]"]
  node_auth["Login<br/>auth page<br/>[Login.jsx]"]
  node_driver["Driver Dashboard<br/>role page<br/>[Dashboard.jsx]"]
  node_passenger["Map View<br/>role page<br/>[MapView.jsx]"]
  node_socket["Socket Client<br/>transport service<br/>[socket.js]"]
  node_realtime["Realtime Layer<br/>state sync service<br/>[realtime.js]"]
  node_styles["Global Styles<br/>css bundle<br/>[index.css]"]
  node_appcss["App Styles<br/>css bundle<br/>[App.css]"]
end

subgraph group_backend["Backend"]
  node_server[("Server<br/>node service<br/>[index.js]")]
  node_serverpkg["Server Env<br/>runtime config<br/>[package.json]"]
end

subgraph group_ops["Deploy"]
  node_vitecfg["Vite Config<br/>build config<br/>[vite.config.js]"]
  node_render["Render Deploy<br/>deployment config<br/>[render.yaml]"]
end

node_browser -->|"loads"| node_html
node_html -->|"bootstraps"| node_main
node_main -->|"renders"| node_app
node_app -->|"routes to"| node_auth
node_app -->|"routes to"| node_driver
node_app -->|"routes to"| node_passenger
node_app -->|"uses"| node_styles
node_app -->|"uses"| node_appcss
node_driver -->|"subscribes"| node_realtime
node_passenger -->|"subscribes"| node_realtime
node_auth -->|"authenticates"| node_server
node_realtime -->|"delegates"| node_socket
node_socket -->|"connects"| node_server
node_server -->|"publishes"| node_realtime
node_serverpkg -->|"configures"| node_server
node_vitecfg -->|"builds"| node_main
node_render -->|"deploys"| node_server
node_render -->|"deploys"| node_html

click node_html "https://github.com/akshayp47/loc_track/blob/main/index.html"
click node_main "https://github.com/akshayp47/loc_track/blob/main/src/main.jsx"
click node_app "https://github.com/akshayp47/loc_track/blob/main/src/App.jsx"
click node_auth "https://github.com/akshayp47/loc_track/blob/main/src/pages/Auth/Login.jsx"
click node_driver "https://github.com/akshayp47/loc_track/blob/main/src/pages/Driver/Dashboard.jsx"
click node_passenger "https://github.com/akshayp47/loc_track/blob/main/src/pages/Passenger/MapView.jsx"
click node_socket "https://github.com/akshayp47/loc_track/blob/main/src/services/socket.js"
click node_realtime "https://github.com/akshayp47/loc_track/blob/main/src/services/realtime.js"
click node_styles "https://github.com/akshayp47/loc_track/blob/main/src/index.css"
click node_appcss "https://github.com/akshayp47/loc_track/blob/main/src/App.css"
click node_server "https://github.com/akshayp47/loc_track/blob/main/server/index.js"
click node_serverpkg "https://github.com/akshayp47/loc_track/blob/main/server/package.json"
click node_vitecfg "https://github.com/akshayp47/loc_track/blob/main/vite.config.js"
click node_render "https://github.com/akshayp47/loc_track/blob/main/render.yaml"

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_browser,node_html,node_main,node_app,node_auth,node_driver,node_passenger,node_socket,node_realtime,node_styles,node_appcss toneBlue
class node_server,node_serverpkg toneAmber
class node_vitecfg,node_render toneMint
```

## Components

### Frontend

Vite-powered React client and UI entrypoints

- **Browser**: client runtime · End-user browser executing the app
- [HTML Shell](https://github.com/akshayp47/loc_track/blob/main/index.html): app host · Vite HTML entry that mounts the React app · `index.html`
- [Main Entry](https://github.com/akshayp47/loc_track/blob/main/src/main.jsx): react bootstrap · Client-side bootstrap and render startup · `src/main.jsx`
- [App Shell](https://github.com/akshayp47/loc_track/blob/main/src/App.jsx): react shell · Top-level SPA composition and routing container · `src/App.jsx`
- [Login](https://github.com/akshayp47/loc_track/blob/main/src/pages/Auth/Login.jsx): auth page · Authentication entry point for users · `src/pages/Auth/Login.jsx`
- [Driver Dashboard](https://github.com/akshayp47/loc_track/blob/main/src/pages/Driver/Dashboard.jsx): role page · Driver-facing operational interface · `src/pages/Driver/Dashboard.jsx`
- [Map View](https://github.com/akshayp47/loc_track/blob/main/src/pages/Passenger/MapView.jsx): role page · Passenger-facing live map and trip view · `src/pages/Passenger/MapView.jsx`
- [Socket Client](https://github.com/akshayp47/loc_track/blob/main/src/services/socket.js): transport service · Client socket transport integration · `src/services/socket.js`
- [Realtime Layer](https://github.com/akshayp47/loc_track/blob/main/src/services/realtime.js): state sync service · Shared live-update orchestration for the UI · `src/services/realtime.js`
- [Global Styles](https://github.com/akshayp47/loc_track/blob/main/src/index.css): css bundle · Application-wide styling for the SPA · `src/index.css`
- [App Styles](https://github.com/akshayp47/loc_track/blob/main/src/App.css): css bundle · Component-level styling for the app shell · `src/App.css`

### Backend

Node service for API and realtime coordination

- [Server](https://github.com/akshayp47/loc_track/blob/main/server/index.js): node service · Independent backend runtime and realtime broker · `server/index.js`
- [Server Env](https://github.com/akshayp47/loc_track/blob/main/server/package.json): runtime config · Backend package and environment contract · `server/package.json`

### Deploy

Render and runtime deployment artifacts

- [Vite Config](https://github.com/akshayp47/loc_track/blob/main/vite.config.js): build config · Frontend build and dev-server configuration · `vite.config.js`
- [Render Deploy](https://github.com/akshayp47/loc_track/blob/main/render.yaml): deployment config · Hosted deployment configuration for the split app · `render.yaml`

## Connections

- Browser → HTML Shell: loads · Browser requests the SPA shell
- HTML Shell → Main Entry: bootstraps · HTML mounts the React entry
- Main Entry → App Shell: renders · Main entry renders the top-level app shell
- App Shell → Login: routes to · App shell can present authentication flow
- App Shell → Driver Dashboard: routes to · App shell can present driver workflow
- App Shell → Map View: routes to · App shell can present passenger workflow
- App Shell → Global Styles: uses · Global UI styling is applied from the app level
- App Shell → App Styles: uses · Shell-specific styles support the SPA
- Driver Dashboard → Realtime Layer: subscribes · Driver UI consumes shared live updates
- Map View → Realtime Layer: subscribes · Passenger map consumes shared live updates
- Login → Server: authenticates · Login flow communicates with backend services
- Realtime Layer → Socket Client: delegates · Realtime layer uses socket transport helpers
- Socket Client → Server: connects · Client socket transport connects to backend runtime
- Server → Realtime Layer: publishes · Backend coordinates live event updates back to clients
- Server Env → Server: configures · Server package and env contract define runtime setup
- Vite Config → Main Entry: builds · Vite config controls the frontend build entry
- Render Deploy → Server: deploys · Render artifacts define backend deployment
- Render Deploy → HTML Shell: deploys · Render artifacts also cover frontend hosting
