How harman7-hash/sih_2025 works
Purpose and entry points
This repository implements a bus-transit application centered on live bus tracking, route discovery, trip planning, schedules, delay estimation, and recommendations. It has separate frontend and backend applications plus legacy/server-rendered EJS views.
Primary entry points:
• Frontend SPA bootstrap: Frontend/src/main.jsx
• Frontend application shell: Frontend/src/Layout.jsx
• Backend HTTP server: Backend/server.js
• Server-rendered landing page assets: views/landingpage.ejs, views/partials/nav.ejs
Frontend application shell and navigation
The frontend is a Vite-based React application. Frontend/src/main.jsx mounts the client application, while Frontend/src/Layout.jsx likely defines persistent page structure around header, footer, and routed content.
The UI is organized as feature pages rather than a generic component library:
• Home and general information: Frontend/src/components/Home/Home.jsx, Frontend/src/components/About/About.jsx
• Global navigation and branding: Frontend/src/components/Header/Header.jsx, Frontend/src/components/Footer/Footer.jsx
• Shared application state boundary: Frontend/src/context/AppContext.jsx
Styling is split between global CSS and application/page styles: Frontend/src/index.css, Frontend/src/App.css.
Bus tracking and map experience
Live-tracking functionality is concentrated in the bus tracker feature:
• Tracker UI/controller: Frontend/src/components/Bustracker/Bustracker.jsx
• Map-facing screen: Frontend/src/components/Bustracker/MapPage.jsx
• Bus-specific UI/type component: Frontend/src/components/Bustracker/bus.tsx
The frontend also includes map animation support in Frontend/src/utils/map-animation.ts, suggesting position updates are rendered or interpolated client-side. A standalone public tracker page exists at Frontend/public/tracker.html, potentially serving an embeddable or separately launched tracker experience.
Route planning and rider-facing features
Trip planning and route lookup are distinct frontend capabilities:
• Trip-planning page: Frontend/src/components/Planyourtrip/Planyoutrip.jsx
• Route finder: Frontend/src/components/RouteFinder.jsx
• Schedule display: Frontend/src/components/Schedule/Schedule.jsx
Supporting rider-facing workflows include feedback and FAQ pages:
• Frontend/src/components/Feedback/Feedback.jsx
• Frontend/src/components/FAQs/faqs.jsx
These features form the primary user flow: select or search transit options, inspect routes/schedules, then follow a bus on the tracking map.
Backend transit-data pipeline
The Node backend contains focused modules for acquiring, transforming, persisting, and serving transit data:
• Data retrieval/import: Backend/fetchData.js, Backend/directImport.js
• Route extraction/assembly: Backend/gettingRoutes.js
• Static/local bus data: Backend/buses.json
• Persistence writing: Backend/writeData.js
This establishes a data boundary between external or imported transit feeds and frontend-consumable route/bus records. Backend/server.js is the likely integration point that exposes these capabilities over HTTP.
Location, prediction, and persistence services
Bus state and prediction logic are separated into backend modules:
• GPS/location handling: Backend/GPS.js
• Bus movement/state updates: Backend/moveBus.js
• Delay calculation: Backend/calcDelay.js
• Rider or route recommendations: Backend/recommendation.js
Persistence infrastructure is indicated by:
• Database connection abstraction: Backend/connectDB.js
• Firebase integration: Backend/firebase.js
The exact database engine and external transit/feed provider are not identifiable from the provided tree, but Firebase and at least one additional database connection layer are material service boundaries. Backend dependencies and runtime configuration are defined by Backend/package.json; the frontend build/runtime dependencies are in Frontend/package.json.
Main entry points: server.js HTTP server · Layout.jsx App shell · Bustracker.jsx Bus tracker · gettingRoutes.js Route assembly
Components 20
React frontend
- SPA bootstrap
Frontend/src/main.jsx - App shell
Frontend/src/Layout.jsx - App context
Frontend/src/context/AppContext.jsx - Header and footer
Frontend/src/components/Header/Header.jsx - Home and about
Frontend/src/components/Home/Home.jsx - Bus tracker
Frontend/src/components/Bustracker/Bustracker.jsx - Tracking map
Frontend/src/components/Bustracker/MapPage.jsx - Map animation
Frontend/src/utils/map-animation.ts - Trip planning
Frontend/src/components/Planyourtrip/Planyoutrip.jsx - Route and schedule
Frontend/src/components/RouteFinder.jsx - Feedback and FAQs
Frontend/src/components/Feedback/Feedback.jsx
Transit backend
- HTTP server · Exposes transit data and application services.
Backend/server.js - Transit import
Backend/fetchData.js - Route assembly
Backend/gettingRoutes.js - Bus state updates
Backend/moveBus.js - Delay and recommendations
Backend/calcDelay.js
Data services
- Transit records
Backend/buses.json - Database connection
Backend/connectDB.js - Firebase
Backend/firebase.js
Other components
- Legacy landing page
views/landingpage.ejs
Connections 22
- SPA bootstrap → App shell: mounts
- App shell → App context: uses
- App shell → Header and footer: renders
- App shell → Home and about: routes to
- App shell → Bus tracker: routes to
- App shell → Trip planning: routes to
- App shell → Route and schedule: routes to
- Bus tracker → Tracking map: renders
- Tracking map → Map animation: animates positions
- Bus tracker → HTTP server: live transit requests
- Trip planning → HTTP server: plans via
- Route and schedule → HTTP server: queries
- HTTP server → Route assembly: serves routes
- HTTP server → Bus state updates: serves live state
- HTTP server → Delay and recommendations: serves predictions
- Transit import → Route assembly: supplies feed data
- Route assembly → Transit records: writes records
- Bus state updates → Transit records: updates positions
- Delay and recommendations → Bus state updates: uses movement state
- HTTP server → Database connection: persists through
- HTTP server → Firebase: integrates with
- Legacy landing page → HTTP server: served by