How okkale/yaatrasarthi works
Project type and purpose
• This is a full-stack web application named MonumentPass for booking tickets to historical monuments in India.
• Frontend is built with React + TypeScript + Vite + Tailwind CSS, served as a single-page app (SPA).
• Backend is a RESTful API in Node.js + Express + TypeScript, using MongoDB via Mongoose.
• Key features: user authentication (JWT), monument discovery, ticket booking, user dashboard.
File structure
• Top-level directories and files:
• src/ – React source code (App.tsx, pages, components, contexts, main.tsx)
• server/ – Express API (index.ts, config.ts, routes, controllers likely under the hood)
• dist-server/ – Compiled backend (JS + maps + declarations) and config for production
• index.html, Vite and Tailwind config, package.json, tsconfigs, netlify.toml, vercel.json, DEPLOYMENT.md
• Patterns:
• Frontend uses component-based architecture with React Router for pages, Context API for auth state.
• Backend likely follows MVC or layered service pattern (config → routes → controllers → models).
• Separate build targets: Vite dev server on 3000, Express server on 5000; production builds in dist-server.
• Deployment configs hint at hosting SPA on Netlify/Vercel and serverless or Dockerized API.
README for additional insights
• Tech stack spells out the major frameworks/libraries: React, Express, MongoDB, JWT, bcryptjs, express-validator.
• README lists API endpoints for auth, monuments, bookings.
• Database schemas (User, Monument, Booking) define core data components.
• Scripts: concurrent dev of client+server, separate builds, production previews.
a. Main components
1. Client (Browser)
2. Frontend SPA (React/Vite)
3. API Gateway / Express Server
4. Database (MongoDB)
5. External services/libraries (JWT auth, bcrypt hashing, express-validator)
6. Deployment platform (Netlify/Vercel)
b. Relationships & interactions
• User → Browser UI → HTTP(S) to Frontend assets (index.html + JS bundle).
• Frontend issues AJAX calls (Axios) to backend API on /api/*.
• Express middleware verifies JWT, validates inputs, routes to controllers.
• Controllers interact with MongoDB via Mongoose models (User, Monument, Booking).
• On startup, backend seeds sample data if DB is empty.
c. Architectural patterns
• Separation of concerns: UI vs. business logic vs. data access
• Component hierarchy on frontend (pages → components → context providers)
• RESTful API design with resource-based endpoints
• Token-based stateless authentication (JWT)
d. Key technologies
• React 18, TypeScript, Vite, Tailwind CSS, React Router, Context API
• Node.js, Express, TypeScript, Mongoose, MongoDB, JWT, bcryptjs, express-validator
Detail without over-splitting
• Logical layers: Presentation (UI), Application (API), Data (DB).
• Auth flow: login/signup → JWT issuance → protected routes.
• Sample-data seeding as part of backend startup.
• Don’t omit deployment targets and environment config (netlify.toml, vercel.json, .env).