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.
- 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
- 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
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
- Node.js 18+
- PostgreSQL database
- npm or yarn package manager
-
Clone the repository
git clone <repository-url> cd hotel-management
-
Install dependencies
npm install
-
Set up environment variables Create a
.env.localfile in the root directory:DATABASE_URL="postgresql://username:password@localhost:5432/hotel_management" JWT_SECRET="your-secret-key-here"
-
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
-
Start the development server
npm run dev
-
Open your browser Navigate to http://localhost:3000
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
POST /api/auth/register- User registrationPOST /api/auth/login- User loginGET /api/auth/me- Get current userPOST /api/auth/logout- User logout
GET /api/rooms- List all roomsPOST /api/rooms- Create new roomGET /api/rooms/[id]- Get room detailsPUT /api/rooms/[id]- Update roomDELETE /api/rooms/[id]- Delete room
GET /api/bookings- List all bookingsPOST /api/bookings- Create new bookingGET /api/bookings/[id]- Get booking detailsPUT /api/bookings/[id]- Update bookingDELETE /api/bookings/[id]- Cancel booking
- ADMIN: Full system access, can manage all aspects
- STAFF: Can manage bookings, rooms, and guest information
- GUEST: Can view available rooms and make bookings
npm run dev- Start development servernpm run build- Build for productionnpm run start- Start production servernpm run lint- Run ESLint
npx prisma studio- Open Prisma Studio for database managementnpx prisma generate- Generate Prisma clientnpx prisma db push- Push schema changes to databasenpx prisma migrate dev- Create and apply migrations
Ensure the following environment variables are set in production:
DATABASE_URL: PostgreSQL connection stringJWT_SECRET: Secret key for JWT token signingNODE_ENV: Set to "production"
- Create a PostgreSQL database
- Run
npx prisma db pushto apply the schema - Optionally seed the database with initial data
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
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.