How sanjai-dev46/sanjoelite-airline-platform works
Purpose and Top-Level Shape
Sanjo is a two-process airline-booking demo: a React SPA provides search, booking, payment, authentication, and booking-history flows; an Express server exposes mock API endpoints. The repository explicitly identifies database, JWT authentication, and payment-provider integration as future production work.
Runtime Entry Points
• Frontend bootstraps the Vite/React application at frontend/src/main.tsx; route composition is centered in frontend/src/App.tsx.
• Backend starts a Node.js/Express HTTP server from backend/server.js, intended to run on port 5000.
• The frontend development server proxies /api traffic to the backend, separating browser UI delivery from API handling.
Client Routing and Journey Stages
The UI is organized as route-level stages:
• Discovery and results: frontend/src/pages/Home.tsx, frontend/src/pages/Search.tsx, frontend/src/pages/FlightDetails.tsx.
• Transaction flow: frontend/src/pages/Booking.tsx, frontend/src/pages/Payment.tsx, frontend/src/pages/Confirmation.tsx.
• Account-oriented flows: frontend/src/pages/Login.tsx, frontend/src/pages/Register.tsx, frontend/src/pages/BookingList.tsx.
These pages are the primary client control-flow boundary: user selection moves from flight search through booking and payment to confirmation, while authenticated-user screens support registration/login and retrieval of bookings.
Frontend Domain Boundary
frontend/src/services/api.ts is the client API boundary and should isolate pages/components from HTTP endpoint details. Shared TypeScript contracts in frontend/src/types/index.ts provide the frontend’s domain model for flights, bookings, users, and related API data. This is the main place to align future backend schemas and error/auth behavior with the UI.
Presentation Composition
Reusable UI and domain-display components keep page routes focused on orchestration:
• Flight discovery and selection: frontend/src/components/SearchBar.tsx, frontend/src/components/FlightCard.tsx.
• Booking presentation: frontend/src/components/BookingCard.tsx.
• Application shell: frontend/src/components/Navbar.tsx, frontend/src/components/Footer.tsx.
Styling is locally built with Tailwind and global CSS through frontend/tailwind.config.js and frontend/src/index.css.
API and Data Layer
backend/server.js currently concentrates the Express API surface—flight management, booking, authentication, and payment endpoints—in one server module. The README characterizes its data as mock data; no database, persistent repository layer, JWT issuer, or third-party payment SDK appears in the supplied tree. Consequently, API state and business behavior are presently bounded by that single process.
Infrastructure and External Boundaries
• Frontend runtime: React 18, TypeScript, Vite, React Router, Tailwind (frontend/package.json).
• Backend runtime: Node.js, Express, CORS, dotenv (backend/package.json, backend/.env.example).
• Deployment targets are static frontend hosting (Vercel/Netlify) and a Node host (Heroku/Railway/Render). Future external-service boundaries are a database, JWT-based identity, and Stripe/PayPal-class payment processing.
Main entry points: server.js Flight, booking, auth & payment APIs · api.ts Client API boundary · App.tsx Route composition · Home.tsx Discovery & results
Components 14
React SPA
- Vite bootstrap
frontend/src/main.tsx - Route composition
frontend/src/App.tsx - Discovery & results · Home, search, and flight-details journey stages.
frontend/src/pages/Home.tsx - Booking flow · Booking, payment, and confirmation stages.
frontend/src/pages/Booking.tsx - Account & history · Login, registration, and booking-history screens.
frontend/src/pages/Login.tsx - Reusable UI · Search, flight, booking-card, and shell presentation.
frontend/src/components/SearchBar.tsx - Domain contracts · Flight, booking, user, and API data models.
frontend/src/types/index.ts - Client API boundary · Isolates pages from HTTP endpoint details.
frontend/src/services/api.ts
Express API
- Express server · Node HTTP server on port 5000.
backend/server.js - Flight, booking, auth & payment APIs · All current API behavior is concentrated in the server module.
backend/server.js - Mock data & state · No persistent repository or database exists.
backend/server.js
Future production services
- Database · Planned production persistence boundary.
- JWT identity · Planned token-based authentication boundary.
- Payment provider · Planned Stripe/PayPal-class integration.
Connections 17
- Vite bootstrap → Route composition: boots
- Route composition → Discovery & results: routes
- Route composition → Booking flow: routes
- Route composition → Account & history: routes
- Discovery & results → Reusable UI: composes
- Booking flow → Reusable UI: composes
- Account & history → Reusable UI: composes
- Discovery & results → Client API boundary: searches flights
- Booking flow → Client API boundary: books and pays
- Account & history → Client API boundary: authenticates and loads bookings
- Client API boundary → Domain contracts: uses
- Client API boundary → Express server: proxies /api
- Express server → Flight, booking, auth & payment APIs: hosts
- Flight, booking, auth & payment APIs → Mock data & state: reads and updates
- Flight, booking, auth & payment APIs → Database: future persistence
- Flight, booking, auth & payment APIs → JWT identity: future token auth
- Flight, booking, auth & payment APIs → Payment provider: future payment processing