A full-stack restaurant table booking system built with Spring Boot and React, featuring role-based authentication, restaurant management, table reservations, and review functionality.
- 🔐 Role-Based Authentication - Separate registration for Users, Managers, and Admins with JWT
- 🍽️ Restaurant Management - Create, update, and view restaurants
- 🪑 Table Management - Manage tables for each restaurant with capacity and availability
- 📅 Booking System - Create, update, and track table reservations with status management
- ⭐ Review System - Users can leave reviews and ratings for restaurants
- 🔒 Secure Sessions - JWT tokens stored in HTTP-only cookies
- 👥 Multi-Role Support - Different access levels for Users, Managers, and Admins
- Spring Boot - REST API framework
- Spring Security - Authentication and authorization
- JWT - Token-based authentication with cookie storage
- MySQL/PostgreSQL - Database (assumed)
- Role-Based Access Control - USER, MANAGER, ADMIN roles
- React - UI library
- React Router - Client-side routing
- Axios - HTTP client (assumed)
- CSS - Styling
POST /api/v1/auth/register/users - User registration
POST /api/v1/auth/register/managers - Manager registration
POST /api/v1/auth/register/admins - Admin registration
POST /api/v1/auth/login - User login (all roles)
POST /api/v1/auth/logout - User logout
GET /api/v1/auth/users - Get all users
POST /api/v1/restaurants - Create restaurant
GET /api/v1/restaurants - Get all restaurants
GET /api/v1/restaurants/{id} - Get restaurant by ID
PUT /api/v1/restaurants/{id} - Update restaurant
POST /api/v1/tables/restaurant/{restaurantId} - Create table
GET /api/v1/tables - Get all tables
GET /api/v1/tables/restaurant/{restaurantId} - Get tables by restaurant
GET /api/v1/tables/{tableId}/restaurant/{restaurantId} - Get specific table
GET /api/v1/tables/{tableId}/restaurant/{restaurantId}/bookings - Get table bookings
PUT /api/v1/tables/{tableId}/restaurant - Update table
DELETE /api/v1/tables/{tableId} - Delete table
POST /api/v1/bookings/restaurant/{restaurantId} - Create booking
GET /api/v1/bookings - Get all bookings
GET /api/v1/bookings/{id} - Get booking by ID
GET /api/v1/bookings/user/{userId} - Get bookings by user
GET /api/v1/bookings/restaurant/{restaurantId} - Get bookings by restaurant
GET /api/v1/bookings/status?status={status} - Get bookings by status
PUT /api/v1/bookings/{id} - Update booking
PUT /api/v1/bookings/{id}/status?status={status} - Update booking status
DELETE /api/v1/bookings/{id} - Delete booking
POST /api/v1/reviews - Create review
GET /api/v1/reviews - Get all reviews
GET /api/v1/reviews/{id} - Get review by ID
GET /api/v1/reviews/restaurants/{restaurantId} - Get reviews by restaurant
GET /api/v1/reviews/users/{userId} - Get reviews by user
PUT /api/v1/reviews/{id} - Update review
DELETE /api/v1/reviews/{id} - Delete review
- Java 17+
- Node.js 16+
- MySQL/PostgreSQL
- Maven
- Clone the repository
git clone https://github.com/rgl456/book-my-table.git
cd book-my-table- Configure database in
application.properties
spring.datasource.url=jdbc:mysql://localhost:3306/bookmytable
spring.datasource.username=your_username
spring.datasource.password=your_password
# JWT Configuration
jwt.secret=your_jwt_secret_key
jwt.expiration=86400000- Run the application
mvn spring-boot:runThe API will be available at http://localhost:8080
- Navigate to frontend directory
cd frontend- Install dependencies
npm install- Start the development server
npm run devThe application will be available at http://localhost:5173
book-my-table/
├── src/main/java/
│ ├── controllers/
│ │ ├── UserController.java
│ │ ├── RestaurantController.java
│ │ ├── TableEntityController.java
│ │ ├── BookingController.java
│ │ └── ReviewController.java
│ ├── services/
│ ├── repositories/
│ ├── models/
│ │ ├── User.java
│ │ ├── Restaurant.java
│ │ ├── TableEntity.java
│ │ ├── Booking.java
│ │ └── Review.java
│ ├── security/
│ └── dto/
└── frontend/
├── src/
│ ├── pages/
│ │ ├── UserRegister.jsx
│ │ ├── ManagerRegister.jsx
│ │ ├── Login.jsx
│ │ ├── Home.jsx
│ │ ├── Restaurant.jsx
│ │ ├── Table.jsx
│ │ └── TableDetails.jsx
│ └── App.jsx
└── package.json
- Browse restaurants
- View available tables
- Create and manage bookings
- Leave reviews for restaurants
- All User permissions
- Create and manage restaurants
- Create and manage tables
- View all bookings for their restaurants
- Update booking status
- All Manager permissions
- Access to all system resources
- User management
- System-wide oversight
- Role-based registration (User/Manager/Admin)
- JWT token generated on successful login
- Token stored in secure HTTP-only cookie with SameSite=Strict
- Automatic logout functionality clears cookies
- Role-based access control on backend endpoints
- Create bookings for specific tables at restaurants
- Update booking details
- Track booking status (PENDING, CONFIRMED, CANCELLED, COMPLETED)
- Filter bookings by user, restaurant, or status
- Managers can update booking status
- Managers create tables with capacity and details
- Tables linked to specific restaurants
- View all bookings for a specific table
- Update table information and availability
- Users can review restaurants after booking
- Rating and comment functionality
- View reviews by restaurant or user
- Update or delete own reviews
PENDING → CONFIRMED → COMPLETED
↓
CANCELLED
- Passwords hashed using BCrypt
- JWT tokens with configurable expiration
- HTTP-only cookies prevent XSS attacks
- SameSite=Strict cookie attribute prevents CSRF
- Secure flag enabled for HTTPS
- Role-based authorization on sensitive endpoints
{
"id": "uuid",
"data": {},
"timestamp": "2024-01-01T00:00:00"
}{
"error": "Error message",
"status": 400,
"timestamp": "2024-01-01T00:00:00"
}- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Email notifications for booking confirmations
- Payment integration
- Real-time table availability
- Restaurant search and filtering
- Photo upload for restaurants and reviews
- Booking cancellation policies
- SMS notifications
- Admin dashboard analytics
This project is licensed under the MIT License - see the LICENSE file for details.
Email - ragul7690@gmail.com
Project Link: https://github.com/rgl456/book-my-table
Made with ❤️ using Spring Boot and React