How aniket-gawande/mahafort-guide works
1. Overall shape
- MahaFort is a two-part application: a React frontend for the user experience and an optional Node/Express backend for dynamic services.
- The repo is designed so the frontend can run standalone from static fort data, while the backend adds auth, chat, admin, and fort-data services.
2. Frontend is the primary product surface
- frontend/src/App.js and the pages/ directory define the main navigable app: Home, Fort listings, Fort detail pages, Trip Planner, About, Login/Register, Admin.
- react-router-style page routing is implied by the page/component structure and ProtectedRoute.
3. Content/data layer on the frontend
- The core fort catalog lives in frontend/src/data/staticForts.js and richer per-fort content in frontend/src/data/fortDetailedData.js.
- There are also static JSON assets in frontend/public/data/ and frontend/src/data/sinhagad.json, which suggests some pages can render from local content without backend calls.
4. UI component layer
- Reusable UI is concentrated in frontend/src/components/: fort cards, navbar, download/emergency buttons, weather widgets, crowd badges, chatbot, and several fort-specific map components.
- This is a presentation-first architecture: data is passed into these components, which handle the visuals and page-specific interactions.
5. Fort detail subpages are specialized
- The repo includes dedicated detail pages for important forts such as Sinhagad, Lohagad, Murud-Janjira, Sindhudurg, Tung, and Vishalgad.
- Some forts also have their own map components, which implies per-destination UX customization rather than a single generic detail template everywhere.
6. Interactive experience layer
- The app includes widgets for weather, trip forecasts, crowd status, downloads, and emergency actions.
- These are likely layered into detail pages and act as supporting services around the main fort content rather than forming separate subsystems.
7. Auth and protected areas
- frontend/src/context/AuthContext.js plus ProtectedRoute.jsx indicate client-side authentication state management.
- The user flows for login, registration, and admin access are isolated from the public browsing experience, with admin pages gated by route protection.
8. Backend API boundary
- The backend is organized as an Express app with route groups for auth, chat, forts, admin, agent, and emergency.
- backend/server.js is the central HTTP entrypoint, while controllers and middleware separate request handling, authorization, and domain logic.
9. Backend data model and persistence
- The backend contains model abstractions for User, FileUser, and Fort, but the repository also ships a large set of JSON data files under backend/data/forts/ and backend/data/users.json.
- This suggests a file-backed or hybrid persistence approach, where fort content may be stored as structured JSON rather than only in a traditional database.
10. AI/chat subsystem
- backend/controllers/chatController.js, backend/services/fortDataAgent.js, and the listGeminiModels.js / testGemini*.js files show a dedicated AI integration path.
- The Bahirji chatbot in the frontend likely talks to this backend layer, which in turn appears to integrate with Gemini-based model access for fort guidance and Q&A.
11. Operational and deployment boundaries
- The repo supports separate deployment targets: the frontend has vercel.json, while the root build artifacts and static/ output indicate a prebuilt/static hosting path such as GitHub Pages.
- In practice, the architecture splits into a static client delivery layer and a runtime backend API layer, with the chatbot/admin/auth features depending on the backend and the fort browsing experience usable from static data alone.
Main entry points: server.js Server · pages Pages · App.js App shell · api.js API client
Components 19
Frontend
React app for browsing forts, planning trips, and user/admin flows.
- App shell · Main frontend entry and routed application shell.
frontend/src/App.js - Pages · Top-level views for home, forts, details, planner, auth, and admin.
frontend/src/pages - UI components · Shared presentation components for cards, maps, weather, chat, and actions.
frontend/src/components - Auth state · Client-side authentication context and protected routing.
frontend/src/context/AuthContext.js - API client · Frontend service layer for calling backend endpoints.
frontend/src/services/api.js - Static forts · Primary fort catalog and detailed frontend data used for standalone browsing.
frontend/src/data - Map views · Specialized fort-specific map components embedded in detail pages.
frontend/src/components - Bahirji bot · Frontend chatbot experience for fort guidance and assistance.
frontend/src/components/BahirjiChatbot.jsx - Static build · Prebuilt static output used for file hosting or GitHub Pages style delivery.
static
Backend
Express API for auth, chat, fort services, and admin operations.
- Server · Backend HTTP entrypoint coordinating all API routes.
backend/server.js - Auth routes · Login, registration, and session-related endpoints.
backend/routes/authRoutes.js - Fort routes · Endpoints for fort content and related lookups.
backend/routes/forts.js - Chat routes · Chat and assistant endpoints used by the chatbot UI.
backend/routes/chatRoutes.js - Admin routes · Protected admin and management endpoints.
backend/routes/admin.js - Emergency routes · Emergency/support actions exposed by the backend.
backend/routes/emergencyRoutes.js - Auth guard · Authorization middleware for protected backend operations.
backend/middleware/auth.js - Fort agent · Backend service that assembles fort data and drives model-assisted chat.
backend/services/fortDataAgent.js - Models · User and fort model abstractions used by backend logic.
backend/models - File data · Large JSON-backed fort and user data set for hybrid persistence.
backend/data
Connections 24
- App shell → Pages: routes to · The app shell mounts the main page views.
- App shell → UI components: composes · Pages rely on shared reusable UI.
- App shell → Auth state: uses · Routing and access control depend on client auth state.
- Pages → Static forts: renders from · Public browsing and detail pages can use local fort content.
- Pages → Map views: embeds · Select detail pages include fort-specific map experiences.
- Pages → Bahirji bot: includes · Some views surface the assistant UI.
- UI components → API client: calls · Interactive widgets fetch backend data when needed.
- Bahirji bot → API client: messages · Chat UI sends prompts and receives responses through the API layer.
- Auth state → API client: authenticates via · Login and protected routes depend on backend session or token flows.
- Static build → App shell: hosts · The static build serves the frontend application.
- Server → Auth routes: mounts · Express mounts authentication endpoints.
- Server → Fort routes: mounts · Express mounts fort content endpoints.
- Server → Chat routes: mounts · Express mounts chat endpoints.
- Server → Admin routes: mounts · Express mounts admin endpoints.
- Server → Emergency routes: mounts · Express mounts emergency endpoints.
- Auth routes → Auth guard: protects · Sensitive auth and admin flows are guarded by middleware.
- Admin routes → Auth guard: protects · Admin actions require authorization.
- Chat routes → Fort agent: delegates to · Chat requests flow through the fort data agent.
- Fort agent → File data: reads · AI and content services use JSON fort data.
- Fort routes → File data: reads · Fort endpoints serve file-backed content.
- Auth routes → Models: uses · Authentication logic maps to user models.
- Admin routes → Models: uses · Administrative operations act on backend models.
- Fort routes → Models: uses · Fort domain logic is represented through models.
- API client → Server: requests · Frontend calls the backend API when dynamic services are needed.