How tejas-india-hackathon-2026/team-4-loops works
Purpose and Topology
SETU is a Bihar tourism discovery platform plus travel marketplace: editorial destination/circuit/event content, maps, AI itinerary assistance, role-based vendor operations, bookings, and payments. It is a TypeScript monorepo with a React/Vite SPA and Express API. Root scripts coordinate local development; compiled artifacts are checked in under apps/web/dist/ and apps/api/dist/.
Runtime Entry Points
The browser application mounts from apps/web/src/main.tsx, composes application providers/UI in apps/web/src/App.tsx, and defines navigable views in apps/web/src/routes/AppRoutes.tsx. The API process starts in apps/api/src/server.ts, with Express assembly and route mounting in apps/api/src/app.ts. Development exposes the web client on port 5173 and API on port 5000.
Client Application Shell and State
The SPA is organized around feature pages—tourism discovery, maps, calendar, offerings, account, and admin—with shared navigation/drawers. Authentication state, language selection, and notifications are cross-cutting React contexts: apps/web/src/context/AuthContext.tsx, apps/web/src/context/LanguageContext.tsx, and apps/web/src/context/ToastContext.tsx. A shared HTTP boundary in apps/web/src/api/client.ts connects UI actions to the API and must preserve cookie-based authenticated sessions.
Tourism Discovery and Geographic Experience
Discovery content is rendered through dedicated listing/detail pages for circuits, destinations, districts, experiences, and cultural events; key routes/pages include apps/web/src/pages/circuits/CircuitDetailPage.tsx, apps/web/src/pages/destinations/DestinationDetailPage.tsx, and apps/web/src/pages/calendar/CalendarPage.tsx. Mapping is a separate visualization layer built around Leaflet components at apps/web/src/components/maps/InteractiveMap.tsx and apps/web/src/components/tourism/SpotInteractiveMap.tsx, while API tourism resources are handled through apps/api/src/routes/tourismRoutes.ts and apps/api/src/controllers/tourismController.ts.
Identity, Roles, and Platform Governance
One auth system supports Tourist, Vendor, and Admin users. API auth routes/controllers issue and validate JWT-backed HTTP-only cookie sessions, with authorization enforcement centralized in apps/api/src/middleware/auth.ts; relevant endpoints reside in apps/api/src/routes/authRoutes.ts and apps/api/src/controllers/authController.ts. Vendor onboarding/status and admin oversight are distinct controlled domains in apps/api/src/controllers/vendorController.ts and apps/api/src/controllers/adminController.ts, surfaced by the admin UI at apps/web/src/pages/admin/AdminDashboardPage.tsx.
Marketplace, Orders, and Payments
Approved vendors manage marketplace offerings; tourists can favorite, book, and track orders. The API separates offerings, orders, and payment orchestration in apps/api/src/routes/offeringRoutes.ts, apps/api/src/routes/orderRoutes.ts, and apps/api/src/routes/paymentRoutes.ts. Razorpay integration is isolated in apps/api/src/services/razorpayService.ts, including external order creation and payment-signature verification; this is the critical boundary between internal order state and payment-provider confirmation.
AI and Messaging Integrations
The travel-companion UI drawer at apps/web/src/components/ai/AiTravelCompanionDrawer.tsx calls AI endpoints in apps/api/src/routes/aiRoutes.ts. apps/api/src/services/geminiService.ts isolates Google Gemini interaction for itinerary generation. Tourist/vendor messaging is a separate API domain represented by apps/api/src/routes/messageRoutes.ts and apps/api/src/controllers/messageController.ts.
Persistence, Configuration, and Failure Boundary
Prisma defines the relational domain model and database compatibility boundary in apps/api/prisma/schema.prisma; local development uses the included SQLite database and seed workflow at apps/api/prisma/seed.ts. Runtime secrets and provider credentials are loaded through apps/api/src/config/env.ts (templated by .env.example). Controllers should consistently route failures through apps/api/src/middleware/errorHandler.ts and API error conventions in apps/api/src/utils/apiError.ts.
Main entry points: app.ts Express app · App.tsx App shell · AppRoutes.tsx Feature routes · schema.prisma Prisma data model
Components 23
React SPA
Browser tourism, marketplace, and operations experience.
- SPA entry
apps/web/src/main.tsx - App shell · Composes providers, shared UI, and routes.
apps/web/src/App.tsx - Feature routes · Navigates discovery, maps, calendar, account, and admin views.
apps/web/src/routes/AppRoutes.tsx - Cross-cutting contexts · Authentication, language, and toast state.
apps/web/src/context/AuthContext.tsx - HTTP client · Preserves cookie-authenticated API sessions.
apps/web/src/api/client.ts - Discovery & calendar · Circuit, destination, and event content views.
apps/web/src/pages/circuits/CircuitDetailPage.tsx - Interactive maps · Geographic visualization for tourism spots.
apps/web/src/components/maps/InteractiveMap.tsx - Admin dashboard
apps/web/src/pages/admin/AdminDashboardPage.tsx - Travel companion
apps/web/src/components/ai/AiTravelCompanionDrawer.tsx
Express API
Session-secured application and domain API.
- API server
apps/api/src/server.ts - Express app · Mounts API routes and middleware.
apps/api/src/app.ts - Auth & authorization · Issues sessions and enforces Tourist, Vendor, and Admin access.
apps/api/src/middleware/auth.ts - Tourism domain · Serves destinations, circuits, districts, experiences, and events.
apps/api/src/routes/tourismRoutes.ts - Vendor & admin · Controls vendor onboarding and platform oversight.
apps/api/src/controllers/vendorController.ts - Offerings, orders & payments · Manages vendor offerings, bookings, favorites, and order state.
apps/api/src/routes/orderRoutes.ts - Razorpay orchestration · Creates provider orders and verifies payment signatures.
apps/api/src/services/razorpayService.ts - Itinerary API
apps/api/src/routes/aiRoutes.ts - Gemini service
apps/api/src/services/geminiService.ts - Messaging domain · Tourist and vendor messaging.
apps/api/src/routes/messageRoutes.ts - Error boundary · Converts controller failures to API error conventions.
apps/api/src/middleware/errorHandler.ts
Persistence
Relational domain storage and local seed workflow.
- Prisma data model · Relational domain and database compatibility boundary.
apps/api/prisma/schema.prisma
External Services
AI and payment provider boundaries.
- Razorpay
- Google Gemini
Connections 25
- SPA entry → App shell: mounts
- App shell → Feature routes: renders
- App shell → Cross-cutting contexts: provides
- Feature routes → Discovery & calendar: navigates
- Feature routes → Interactive maps: navigates
- Feature routes → Admin dashboard: navigates
- App shell → Travel companion: hosts
- Cross-cutting contexts → HTTP client: supplies session
- HTTP client → API server: HTTPS API calls
- API server → Express app: starts
- Express app → Auth & authorization: applies
- Express app → Tourism domain: mounts
- Express app → Vendor & admin: mounts
- Express app → Offerings, orders & payments: mounts
- Express app → Itinerary API: mounts
- Express app → Messaging domain: mounts
- Tourism domain → Prisma data model: reads content
- Vendor & admin → Prisma data model: manages vendors
- Offerings, orders & payments → Prisma data model: persists orders
- Offerings, orders & payments → Razorpay orchestration: orchestrates payment
- Razorpay orchestration → Razorpay: creates and verifies
- Itinerary API → Gemini service: generates itineraries
- Gemini service → Google Gemini: requests generation
- Messaging domain → Prisma data model: stores messages
- Express app → Error boundary: routes failures