How aneekbiswas/irctc-train-search-and-booking-prototype works
1. Project type
- This is a static, browser-side prototype for train search and booking, modeled after an IRCTC-style flow.
- There is no sign of a backend, database, authentication service, or build pipeline in the repo structure.
2. Entry points
- index.html is the main landing/search page.
- booking/booking.html is the booking/details page reached after selecting a train or itinerary.
- The application appears to be split into two screen-level experiences rather than a single SPA route system.
3. Presentation layer
- Styles are separated by page:
- styles/indexStyle.css for the search/home screen
- styles/bookingStyle.css for the booking screen
- This suggests each page owns its own UI layout and visual behavior rather than sharing a large common stylesheet.
4. Client-side logic
- script.js likely drives the search/home page behavior.
- booking/booking.js likely handles the booking page interactions and any passenger/confirmation flow.
- The architecture is therefore JavaScript-enhanced static pages, with logic running entirely in the browser.
5. Data layer
- data/trains.json and data/stations.json are local JSON datasets used by the UI.
- These files imply the search experience is backed by static reference data, not live API calls.
- The app likely filters trains by station pairs and uses the station list for lookup/autocomplete or validation.
6. Primary data flow
- User enters search criteria on index.html.
- script.js reads station/train data from data/*.json, computes candidate trains, and renders results.
- A selected train then moves the user into booking/booking.html, where booking/booking.js likely consumes the chosen train context and completes the mock booking flow.
7. Boundary between pages
- The handoff from search to booking is a key architectural boundary.
- Since there is no server-side session layer visible, state is probably passed through the browser using URL parameters, local storage, or in-memory navigation state.
8. Functional subsystems
- Search subsystem: station input, train matching, result rendering.
- Booking subsystem: itinerary display, passenger or booking confirmation interactions.
- Reference data subsystem: station and train catalogs in JSON.
- UI styling subsystem: page-specific CSS files.
9. External dependencies
- No external services are visible in the repository structure.
- If any libraries are used, they are not evident from the file tree; the architecture should be treated as self-contained and offline-capable unless the HTML reveals otherwise.
10. Likely runtime model
- The entire app runs in a standard web browser.
- There is no evidence of a server, framework runtime, or compiled artifact generation.
- This makes deployment likely a simple static hosting setup.
11. Repository organization
- Root-level files provide the landing/search experience.
- The booking/ directory isolates the booking page assets.
- The data/ directory centralizes reusable domain data, keeping train and station definitions separate from UI code.
12. Architecture diagram implication
- A good diagram would show:
- Browser users interacting with two HTML pages
- Each page loading its own CSS and JavaScript
- JavaScript consuming local JSON datasets
- A page-to-page transition from search to booking
- The dominant pattern is static front-end app with local data-driven UI, not client-server architecture.
Main entry points: script.js Search logic · index.html Search page · booking.html Booking page · booking.js Booking logic
Components 12
Search page
Landing and train search experience.
- Search page · Main landing page for searching trains.
index.html - Search logic · Client-side behavior for station input, filtering, and results rendering.
script.js - Search styles · Visual styling for the search/home screen.
styles/indexStyle.css - Search results · Computed list of candidate trains produced by the search experience.
Booking page
Passenger and booking flow after selection.
- Booking page · Booking/details page reached after selecting a train.
booking/booking.html - Booking logic · Client-side booking interactions and confirmation flow.
booking/booking.js - Booking styles · Visual styling for the booking screen.
styles/bookingStyle.css
Reference data
Static JSON catalogs used by the UI.
Browser runtime
Client-side execution in a static web browser.
- Browser · End user runs the prototype in a standard web browser.
- Static site · Self-contained static front-end prototype with no visible backend.
- Booking context · Selected itinerary state passed from search to booking, likely via URL or browser storage.
Connections 16
- Browser → Search page: opens · User starts at the search page.
- Search page → Search logic: drives · The page loads its browser-side search behavior.
- Search page → Search styles: styles with · Search page uses its dedicated stylesheet.
- Search logic → Stations: reads · Search logic uses station reference data.
- Search logic → Trains: reads · Search logic uses train reference data.
- Search logic → Search results: renders · Search logic computes and displays matching trains.
- Search results → Booking context: selects · Choosing a train creates handoff state for booking.
- Booking context → Booking page: opens · Selected itinerary is carried into the booking page.
- Booking page → Booking logic: drives · The booking page loads its browser-side logic.
- Booking page → Booking styles: styles with · Booking page uses its dedicated stylesheet.
- Booking logic → Booking context: consumes · Booking logic consumes the selected itinerary context.
- Booking logic → Browser: updates · All interaction stays within the browser runtime.
- Static site → Search page: hosts · Static hosting serves the HTML entry pages.
- Static site → Booking page: hosts · Static hosting serves the booking page.
- Static site → Stations: serves · Static hosting makes local data files available to scripts.
- Static site → Trains: serves · Static hosting makes local data files available to scripts.