How daswsi-utp/hotelreservapp-front works
Project type and purpose
• This is a full-stack Hotel Booking System whose repository contains the React.js front-end (SPA) and a “bd” folder with SQL scripts for the hotel database.
• The README confirms it’s a web application built with React, Vite, Tailwind CSS, and it uses a SQL database (bd_hotel.sql).
File structure
• Top-level:
• public/index.html, public/img/… – static assets, favicon, logo
• src/main.jsx – entry point bootstrapping React/Vite
• src/App.jsx – root component and router setup
• src/components – reusable UI components (admin vs common vs guest)
• src/pages – page-level views (login, admin dashboard, guest booking, rooms, etc.)
• src/context/AuthContext.jsx – global auth state provider
• src/data/roomsData.js – static seed data or mock data
• bd folder: SQL schema and queries for the database.
README for additional insights
• Uses React Router for client-side routing
• Tailwind CSS for styling
• React Confetti for UI effect
• No back-end code here; expect a separate REST API and a SQL database.
a. Main components
• Client (Browser)
• React SPA (Vite build)
• Routes: /login, /guest/…, /admin/…
• Components: AuthContext, UI components, pages
• API Server (external microservice)
• REST endpoints for authentication, rooms CRUD, reservations, messages, promotions, users
• Security: JWT or session-based auth
• Database
• PostgreSQL (bd_hotel.sql) or another relational DB
• Tables: Users, Rooms, Reservations, Messages, Promotions, etc.
• (Optional) CDN / Static hosting
• Host built SPA assets on Netlify, Vercel, S3/CloudFront
• (Optional) Third-party services
• Email/SMS service for booking confirmations
• Analytics or monitoring (Sentry, LogRocket)
b. Relationships and interactions
• Browser → SPA (static files served over HTTPS)
• SPA → API Server (HTTP/HTTPS calls)
• AuthContext injects JWT into headers
• Pages call GET /rooms, POST /reservations, GET /admin/users, etc.
• API Server → Database (TCP connection)
• SQL queries defined in bd_hotel.sql
• (If used) CDN caches static assets; API calls bypass CDN to origin.
c. Architectural patterns & design principles
• SPA with client-side routing (React Router)
• Context API for state management (AuthContext)
• Component-based UI hierarchy (atoms, molecules, pages)
• RESTful API design on the back-end
• Layering: presentation (React), application (API), data (database)
d. Key technologies/frameworks
• Front-end: React, Vite, Tailwind CSS, React Router, React Context
• Build & deploy: npm scripts, Vercel/Netlify or S3 + CloudFront
• Back-end (assumed): Node.js/Express or Java/Spring Boot
• Database: PostgreSQL (bd_hotel.sql)