# dhirajb05/eclipse architecture

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

- Interactive diagram: https://gitdiagram.com/dhirajb05/eclipse
- Repository: https://github.com/dhirajb05/eclipse

## Overview

#### Purpose and Entry Points
Eclipse is a multi-page EV charging-station finder and reservation prototype. Express serves both the static Vanilla JS/CSS client and REST endpoints. The user journey begins at `index.html`, continues through discovery in `stations.html`, station inspection in `station-details.html`, booking in `booking.html`, and reservation management in `bookings.html`. Backend startup and API ownership are centralized in `server.js`.

#### Client Application Shell
The frontend is browser-native HTML, CSS, and JavaScript rather than a component framework. Shared visual tokens and utilities live in `style.css`; page-specific scripts own rendering, event handling, URL/state interpretation, and API calls. Primary client modules are `script.js`, `stations.js`, and `station-details.js`.

#### Station Discovery Pipeline
The finder loads station data through `GET /api/stations`, then renders a desktop-oriented card grid and applies search, state/city/charger filters, and price/power sorting in the client. This creates a boundary between server-side station retrieval/pagination and browser-side presentation/filter interaction. Core paths: `stations.html`, `stations.js`, `stations.css`, `server.js`.

#### Station Detail and Mapping
A selected station is resolved through `GET /api/stations/:id`; the detail page presents station metadata, charger inventory, amenities, and live/status-oriented information. Google Maps API is integrated at this page boundary to place the station in an interactive map, while station domain data remains supplied by the Express API. Core paths: `station-details.html`, `station-details.js`, `server.js`.

#### Booking Lifecycle
The booking page collects a station context, date/time-slot selection, and vehicle details, calculates pricing interactively, and submits reservations through `POST /api/bookings`. Reservations are not described as durable database records: the backend is an in-memory booking engine, so process restarts are an important persistence boundary. Core paths: `booking.html`, `booking.js`, `server.js`.

#### Reservation Dashboard
The dashboard retrieves reservations via `GET /api/bookings`, classifies them into all/upcoming/completed views, and cancels records through `DELETE /api/bookings/:id`. The browser controls dashboard tabs and cancellation UX; Express owns booking collection mutation. Core paths: `bookings.html`, `bookings.js`, `server.js`.

#### Data and Runtime Boundaries
Node.js with Express is the application runtime and REST/static-server boundary. Station records originate as Kaggle and Government of India source datasets, are transformed by the normalization stage, and are consumed from normalized JSON at runtime. Core paths: `data/ev-charging-stations-india.csv`, `data/stations.json`, `scripts/normalize-dataset.js`, `server.js`. Google Maps is the material external service; no persistent database or authentication service is represented in the repository.

Main entry points: [`server.js`](https://github.com/dhirajb05/eclipse/blob/main/server.js) (Express server), [`stations.js`](https://github.com/dhirajb05/eclipse/blob/main/stations.js) (Discovery UI), [`station-details.js`](https://github.com/dhirajb05/eclipse/blob/main/station-details.js) (Detail and map UI), [`index.html`](https://github.com/dhirajb05/eclipse/blob/main/index.html) (Landing page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser Client"]
  node_home["Landing page<br/>HTML page<br/>[index.html]"]
  node_finder["Station finder<br/>HTML page<br/>[stations.html]"]
  node_stations_ui["Discovery UI<br/>browser module<br/>[stations.js]"]
  node_station_styles["Finder styles<br/>CSS<br/>[stations.css]"]
  node_detail["Station detail page<br/>HTML page"]
  node_detail_ui["Detail and map UI<br/>browser module<br/>[station-details.js]"]
  node_booking["Booking page<br/>HTML page<br/>[booking.html]"]
  node_booking_ui["Booking UI<br/>browser module<br/>[booking.js]"]
  node_dashboard["Reservations dashboard<br/>HTML page<br/>[bookings.html]"]
  node_dashboard_ui["Dashboard UI<br/>browser module<br/>[bookings.js]"]
  node_shared_ui["Shared UI shell<br/>browser assets<br/>[script.js]"]
end

subgraph group_server["Node/Express Runtime"]
  node_express["Express server<br/>Node.js application<br/>[server.js]"]
  node_booking_store[("In-memory bookings<br/>transient store<br/>[server.js]")]
end

subgraph group_data["Station Data Pipeline"]
  node_source_csv["Source station dataset<br/>CSV dataset"]
  node_normalizer["Dataset normalizer<br/>Node.js script"]
  node_stations_data["Normalized stations<br/>JSON dataset<br/>[stations.json]"]
end

node_maps{{"Google Maps API<br/>external service"}}

node_home -->|"discovery navigation"| node_finder
node_finder -->|"loads"| node_stations_ui
node_stations_ui -->|"styled by"| node_station_styles
node_stations_ui -->|"GET /api/stations"| node_express
node_stations_ui -->|"select station"| node_detail
node_detail -->|"loads"| node_detail_ui
node_detail_ui -->|"GET /api/stations/:id"| node_express
node_detail_ui -->|"places station"| node_maps
node_detail_ui -->|"begin reservation"| node_booking
node_booking -->|"loads"| node_booking_ui
node_booking_ui -->|"POST /api/bookings"| node_express
node_dashboard -->|"loads"| node_dashboard_ui
node_dashboard_ui -->|"GET /api/bookings; DELETE /api/bookings/:id"| node_express
node_express -->|"creates, reads, cancels"| node_booking_store
node_source_csv -->|"input"| node_normalizer
node_normalizer -->|"writes normalized JSON"| node_stations_data
node_express -->|"reads station catalog"| node_stations_data
node_express -.->|"serves static client"| node_home
node_shared_ui -.->|"shared behavior"| node_home

click node_home "https://github.com/dhirajb05/eclipse/blob/main/index.html"
click node_finder "https://github.com/dhirajb05/eclipse/blob/main/stations.html"
click node_stations_ui "https://github.com/dhirajb05/eclipse/blob/main/stations.js"
click node_station_styles "https://github.com/dhirajb05/eclipse/blob/main/stations.css"
click node_detail "https://github.com/dhirajb05/eclipse/blob/main/station-details.html"
click node_detail_ui "https://github.com/dhirajb05/eclipse/blob/main/station-details.js"
click node_booking "https://github.com/dhirajb05/eclipse/blob/main/booking.html"
click node_booking_ui "https://github.com/dhirajb05/eclipse/blob/main/booking.js"
click node_dashboard "https://github.com/dhirajb05/eclipse/blob/main/bookings.html"
click node_dashboard_ui "https://github.com/dhirajb05/eclipse/blob/main/bookings.js"
click node_shared_ui "https://github.com/dhirajb05/eclipse/blob/main/script.js"
click node_express "https://github.com/dhirajb05/eclipse/blob/main/server.js"
click node_booking_store "https://github.com/dhirajb05/eclipse/blob/main/server.js"
click node_source_csv "https://github.com/dhirajb05/eclipse/blob/main/data/ev-charging-stations-india.csv"
click node_normalizer "https://github.com/dhirajb05/eclipse/blob/main/scripts/normalize-dataset.js"
click node_stations_data "https://github.com/dhirajb05/eclipse/blob/main/data/stations.json"

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_home,node_finder,node_stations_ui,node_station_styles,node_detail,node_detail_ui,node_booking,node_booking_ui,node_dashboard,node_dashboard_ui,node_shared_ui toneBlue
class node_express,node_booking_store toneAmber
class node_source_csv,node_normalizer,node_stations_data toneMint
class node_maps toneNeutral
```

## Components

### Browser Client

Multi-page vanilla HTML, CSS, and JavaScript UI.

- [Landing page](https://github.com/dhirajb05/eclipse/blob/main/index.html): HTML page · `index.html`
- [Station finder](https://github.com/dhirajb05/eclipse/blob/main/stations.html): HTML page · Search and filter entry point. · `stations.html`
- [Discovery UI](https://github.com/dhirajb05/eclipse/blob/main/stations.js): browser module · Renders cards and applies client-side filters and sorting. · `stations.js`
- [Finder styles](https://github.com/dhirajb05/eclipse/blob/main/stations.css): CSS · `stations.css`
- [Station detail page](https://github.com/dhirajb05/eclipse/blob/main/station-details.html): HTML page · `station-details.html`
- [Detail and map UI](https://github.com/dhirajb05/eclipse/blob/main/station-details.js): browser module · Resolves a selected station and renders its inventory and status. · `station-details.js`
- [Booking page](https://github.com/dhirajb05/eclipse/blob/main/booking.html): HTML page · `booking.html`
- [Booking UI](https://github.com/dhirajb05/eclipse/blob/main/booking.js): browser module · Calculates pricing and submits reservation details. · `booking.js`
- [Reservations dashboard](https://github.com/dhirajb05/eclipse/blob/main/bookings.html): HTML page · `bookings.html`
- [Dashboard UI](https://github.com/dhirajb05/eclipse/blob/main/bookings.js): browser module · Filters reservations and handles cancellation UX. · `bookings.js`
- [Shared UI shell](https://github.com/dhirajb05/eclipse/blob/main/script.js): browser assets · Shared page behavior and visual tokens. · `script.js`

### Node/Express Runtime

Static hosting and REST API boundary.

- [Express server](https://github.com/dhirajb05/eclipse/blob/main/server.js): Node.js application · Serves static pages and owns station and booking REST endpoints. · `server.js`
- [In-memory bookings](https://github.com/dhirajb05/eclipse/blob/main/server.js): transient store · Reservation state is lost when the server process restarts. · `server.js`

### Station Data Pipeline

Offline normalization produces runtime station JSON.

- [Source station dataset](https://github.com/dhirajb05/eclipse/blob/main/data/ev-charging-stations-india.csv): CSV dataset · Kaggle and Government of India source records. · `data/ev-charging-stations-india.csv`
- [Dataset normalizer](https://github.com/dhirajb05/eclipse/blob/main/scripts/normalize-dataset.js): Node.js script · Transforms source records into the runtime station format. · `scripts/normalize-dataset.js`
- [Normalized stations](https://github.com/dhirajb05/eclipse/blob/main/data/stations.json): JSON dataset · Runtime station catalog consumed by Express. · `data/stations.json`

### Other components

- **Google Maps API**: external service · Interactive station map provider.

## Connections

- Landing page → Station finder: discovery navigation
- Station finder → Discovery UI: loads
- Discovery UI → Finder styles: styled by
- Discovery UI → Express server: GET /api/stations
- Discovery UI → Station detail page: select station
- Station detail page → Detail and map UI: loads
- Detail and map UI → Express server: GET /api/stations/:id
- Detail and map UI → Google Maps API: places station
- Detail and map UI → Booking page: begin reservation
- Booking page → Booking UI: loads
- Booking UI → Express server: POST /api/bookings
- Reservations dashboard → Dashboard UI: loads
- Dashboard UI → Express server: GET /api/bookings; DELETE /api/bookings/:id
- Express server → In-memory bookings: creates, reads, cancels
- Source station dataset → Dataset normalizer: input
- Dataset normalizer → Normalized stations: writes normalized JSON
- Express server → Normalized stations: reads station catalog
- Express server → Landing page: serves static client
- Shared UI shell → Landing page: shared behavior
