How dhirajb05/eclipse works
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 Express server · stations.js Discovery UI · station-details.js Detail and map UI · index.html Landing page
Components 17
Browser Client
Multi-page vanilla HTML, CSS, and JavaScript UI.
- Landing page
index.html - Station finder · Search and filter entry point.
stations.html - Discovery UI · Renders cards and applies client-side filters and sorting.
stations.js - Finder styles
stations.css - Station detail page
station-details.html - Detail and map UI · Resolves a selected station and renders its inventory and status.
station-details.js - Booking page
booking.html - Booking UI · Calculates pricing and submits reservation details.
booking.js - Reservations dashboard
bookings.html - Dashboard UI · Filters reservations and handles cancellation UX.
bookings.js - Shared UI shell · Shared page behavior and visual tokens.
script.js
Node/Express Runtime
Static hosting and REST API boundary.
- Express server · Serves static pages and owns station and booking REST endpoints.
server.js - In-memory bookings · Reservation state is lost when the server process restarts.
server.js
Station Data Pipeline
Offline normalization produces runtime station JSON.
- Source station dataset · Kaggle and Government of India source records.
data/ev-charging-stations-india.csv - Dataset normalizer · Transforms source records into the runtime station format.
scripts/normalize-dataset.js - Normalized stations · Runtime station catalog consumed by Express.
data/stations.json
Other components
- Google Maps API · Interactive station map provider.
Connections 19
- 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