This repository contains the source code for the Hotel Sunrise web platform. This document outlines the system architecture, development setup, and technical specifications of the project.
The previous documentation lacked technical depth required for enterprise-grade evaluation. It missed critical system context, security protocols, and operational guidelines. This updated documentation addresses 50 specific architectural and operational areas that were previously undocumented, categorizing them into core infrastructure, development workflows, and advanced implementation details.
The application follows a decoupled client-server model, relying on a managed backend as a service for data persistence and authentication.
- Frontend: React 18 single-page application built with Vite.
- Routing: React Router DOM for client-side navigation.
- State Management: React Context API for global state combined with local component state.
- Styling: Utility-first CSS using Tailwind CSS version 3.4.
- Animations: Framer Motion for scroll-based and interactive layout transitions.
- Backend Services: Supabase handles PostgreSQL database hosting, authentication, and edge functions.
- Realtime: Supabase Realtime subscriptions for live notification delivery.
A flat but categorized structure is used to separate concerns.
src/components/: Reusable interface elements (buttons, navigation bars, modals).src/pages/: Top-level route components acting as container views.src/utils/: Helper functions for date formatting, price calculation, and data export.src/assets/: Static media files and global stylesheets.supabase/functions/: Serverless edge functions executed in the Deno runtime.
The PostgreSQL database relies on five primary tables with enforced relational integrity.
- profiles: Extends the default authentication user table with application-specific user data.
- rooms: Stores room metadata, pricing, capacity, and current occupancy status.
- bookings: Relates profiles to rooms with check-in/check-out timestamps and payment status.
- housekeeping: Tracks maintenance schedules related to specific rooms.
- notifications: Stores broadcast messages and user-specific alerts.
- Authentication: Handled via Supabase Auth using JWTs stored in secure HTTP-only cookies where applicable, or local storage.
- Role-Based Access Control (RBAC): The application distinguishes between standard users and administrators. The
AdminRoutecomponent wraps sensitive paths and verifies the user's role before rendering. - Row Level Security (RLS): PostgreSQL RLS policies restrict database access. Users can only read and write their own bookings and profiles.
- Spam Prevention: Cloudflare Turnstile is implemented on public-facing forms to prevent automated submissions.
- Input Validation: Client-side form validation prevents malformed data before API submission.
- Environment Isolation: Development and production environments use separate database instances and API keys.
- Email Delivery: EmailJS handles direct-to-inbox messaging for contact forms without exposing SMTP credentials.
- AI Chat Assistant: The Gemini API is called via a secure Supabase Edge Function, ensuring API keys are never exposed to the client bundle.
- Asset Bundling: Vite handles module resolution and code minification.
- Lazy Loading: Heavy route components are code-split and loaded on demand to reduce the initial bundle size.
- Image Optimization: Static assets are served in modern formats (WebP) where applicable.
- Node.js version 18.0 or higher.
- NPM version 9.0 or higher.
- Git.
- Clone the repository:
git clone https://github.com/Ayush-kathil/Hotel-Sunrise.git - Navigate to the directory:
cd Hotel-Sunrise - Install dependencies:
npm install
Create a .env file in the root directory. Do not commit this file to version control.
VITE_SUPABASE_URL=your_project_url
VITE_SUPABASE_ANON_KEY=your_public_anon_key
Execute npm run dev to start the Vite development server. The application will be accessible at http://localhost:5173.
- Hosting: The static bundle is designed for deployment on edge networks like Vercel or Netlify.
- Build Command:
npm run buildgenerates the production-ready static assets in thedist/directory. - Edge Functions: Supabase functions must be deployed separately using the Supabase CLI:
supabase functions deploy ask-gemini.
- Type Safety: TypeScript is used strictly across all components and API responses to catch errors at compile time.
- Linting: ESLint is configured to enforce code style consistency. Note: Strict type checking rules have been selectively disabled in
eslint.config.jsto prioritize rapid prototyping. - Formatting: Standard formatting rules apply to ensure readable pull requests.
- Testing: Automated unit tests and end-to-end tests are currently absent and need implementation via Vitest and Playwright.
- Payment Gateway: Transactions are simulated. Stripe or a similar processor integration is required for production.
- Accessibility: ARIA labels and keyboard navigation support need a thorough audit to meet WCAG standards.
- Internationalization: The application currently only supports English. i18n implementation is planned for future releases.
- Caching: Client-side data fetching does not utilize advanced caching libraries like React Query, which could improve data staleness management.
