Skip to content

thedorCode-star/hotel-management

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

40 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Hotel Management System

A comprehensive hotel management system built with Next.js, TypeScript, Prisma, and Tailwind CSS. This application provides a complete solution for managing hotel operations including bookings, rooms, guests, and reviews.

Features

🏨 Core Features

  • User Authentication: Secure login/register system with JWT tokens
  • Room Management: Add, edit, and manage hotel rooms with status tracking
  • Booking System: Complete booking management with check-in/check-out dates
  • Guest Management: Track guest information and preferences
  • Reviews & Ratings: Collect and manage guest feedback
  • Dashboard: Comprehensive overview with key metrics and quick actions

πŸ›  Technical Features

  • Modern Stack: Next.js 15, TypeScript, Prisma ORM
  • Database: PostgreSQL with comprehensive schema
  • Authentication: JWT-based authentication with bcrypt password hashing
  • UI/UX: Beautiful, responsive design with Tailwind CSS
  • Form Handling: React Hook Form with Zod validation
  • Icons: Lucide React for consistent iconography

Database Schema

The system uses a well-structured database with the following main entities:

  • Users: Staff and guest accounts with role-based access
  • Rooms: Hotel rooms with types, capacity, pricing, and status
  • Bookings: Reservations linking users to rooms with dates and status
  • Reviews: Guest feedback and ratings for rooms

Getting Started

Prerequisites

  • Node.js 18+
  • PostgreSQL database
  • npm or yarn package manager

Installation

  1. Clone the repository

    git clone <repository-url>
    cd hotel-management
  2. Install dependencies

    npm install
  3. Set up environment variables Create a .env.local file in the root directory:

    DATABASE_URL="postgresql://username:password@localhost:5432/hotel_management"
    JWT_SECRET="your-secret-key-here"
  4. Set up the database

    # Generate Prisma client
    npx prisma generate
    
    # Run database migrations
    npx prisma db push
    
    # (Optional) Seed the database with sample data
    npx prisma db seed
  5. Start the development server

    npm run dev
  6. Open your browser Navigate to http://localhost:3000

Project Structure

hotel-management/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ api/                    # API routes
β”‚   β”‚   β”‚   └── auth/              # Authentication endpoints
β”‚   β”‚   β”œβ”€β”€ auth/                   # Authentication pages
β”‚   β”‚   β”‚   β”œβ”€β”€ login/
β”‚   β”‚   β”‚   └── register/
β”‚   β”‚   β”œβ”€β”€ dashboard/              # Dashboard and management pages
β”‚   β”‚   β”‚   β”œβ”€β”€ bookings/
β”‚   β”‚   β”‚   β”œβ”€β”€ rooms/
β”‚   β”‚   β”‚   └── ...
β”‚   β”‚   β”œβ”€β”€ globals.css            # Global styles
β”‚   β”‚   β”œβ”€β”€ layout.tsx             # Root layout
β”‚   β”‚   └── page.tsx               # Landing page
β”‚   └── generated/                 # Generated Prisma client
β”œβ”€β”€ prisma/
β”‚   └── schema.prisma              # Database schema
β”œβ”€β”€ public/                        # Static assets
└── package.json                   # Dependencies and scripts

API Endpoints

Authentication

  • POST /api/auth/register - User registration
  • POST /api/auth/login - User login
  • GET /api/auth/me - Get current user
  • POST /api/auth/logout - User logout

Rooms (Planned)

  • GET /api/rooms - List all rooms
  • POST /api/rooms - Create new room
  • GET /api/rooms/[id] - Get room details
  • PUT /api/rooms/[id] - Update room
  • DELETE /api/rooms/[id] - Delete room

Bookings (Planned)

  • GET /api/bookings - List all bookings
  • POST /api/bookings - Create new booking
  • GET /api/bookings/[id] - Get booking details
  • PUT /api/bookings/[id] - Update booking
  • DELETE /api/bookings/[id] - Cancel booking

User Roles

  • ADMIN: Full system access, can manage all aspects
  • STAFF: Can manage bookings, rooms, and guest information
  • GUEST: Can view available rooms and make bookings

Development

Available Scripts

  • npm run dev - Start development server
  • npm run build - Build for production
  • npm run start - Start production server
  • npm run lint - Run ESLint

Database Management

  • npx prisma studio - Open Prisma Studio for database management
  • npx prisma generate - Generate Prisma client
  • npx prisma db push - Push schema changes to database
  • npx prisma migrate dev - Create and apply migrations

Deployment

Environment Variables

Ensure the following environment variables are set in production:

  • DATABASE_URL: PostgreSQL connection string
  • JWT_SECRET: Secret key for JWT token signing
  • NODE_ENV: Set to "production"

Database Setup

  1. Create a PostgreSQL database
  2. Run npx prisma db push to apply the schema
  3. Optionally seed the database with initial data

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For support and questions, please open an issue in the GitHub repository or contact the development team.


Note: This is a work in progress. Some features are implemented with mock data and will be connected to the database in future updates.

About

A comprehensive hotel management system built with Next.js, TypeScript, and PostgreSQL

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors