A comprehensive booking management system for cricket turfs with user-facing booking interface and admin panel.
- User registration and login
- View available time slots for booking
- Book cricket turf slots
- View personal booking history
- Payment QR code generation
- Responsive design
- Admin authentication
- Dashboard with statistics
- View all bookings with filtering
- Manage booking status (Accept/Reject/Modify)
- View today's and tomorrow's bookings
- Generate payment QR codes
- User management
- Date-wise booking views
- Node.js with Express.js
- PostgreSQL database
- JWT authentication
- bcryptjs for password hashing
- QR code generation
- HTML5, CSS3, JavaScript (Vanilla)
- Responsive design
- Modern UI with gradients and animations
- Node.js (v14 or higher)
- PostgreSQL (v12 or higher)
- npm or yarn
-
Clone the repository
git clone <repository-url> cd cricket-turf-booking
-
Install dependencies
npm install
-
Set up PostgreSQL database
- Create a database named
cricket_turf_booking - Update the database configuration in
.envfile
- Create a database named
-
Configure environment variables Update the following variables in
.envfile:DB_HOST=localhost DB_PORT=5432 DB_NAME=cricket_turf_booking DB_USER=your_postgres_username DB_PASSWORD=your_postgres_password JWT_SECRET=your_jwt_secret_key -
Initialize database
# Option 1: Use the automated script (recommended) ./init-database.sh # Option 2: Manual setup psql -U your_username -d postgres -c "CREATE DATABASE cricket_turf_booking;" psql -U your_username -d cricket_turf_booking -f database/schema.sql npm run setup
-
Start the application
# For development npm run dev # For production npm start
-
Access the application
- Main site: http://localhost:3000
- Admin panel: http://localhost:3000/admin
- Email: admin@cricket.com
- Password: admin123
- Register a new account or login
- Select a date to view available slots
- Choose your preferred time slot
- Confirm booking
- Scan QR code for payment
- View your booking history
- Login with admin credentials
- View dashboard statistics
- Manage bookings (accept/reject/modify)
- Generate payment QR codes
- Filter bookings by date
- Manage users
POST /api/auth/register- Register new userPOST /api/auth/login- User login
GET /api/bookings/slots- Get all available slotsGET /api/bookings/available/:date- Get available slots for specific datePOST /api/bookings- Create new bookingGET /api/bookings/my-bookings- Get user's bookingsGET /api/bookings/:id- Get booking details
GET /api/admin/dashboard- Get dashboard statisticsGET /api/admin/bookings- Get all bookingsGET /api/admin/bookings/upcoming- Get today's and tomorrow's bookingsPUT /api/admin/bookings/:id/status- Update booking statusPUT /api/admin/bookings/:id- Update booking detailsDELETE /api/admin/bookings/:id- Delete bookingGET /api/admin/payment/qrcode/:bookingId- Generate payment QR codeGET /api/admin/users- Get all users
users- User information and authenticationturf_slots- Available time slots with pricingbookings- Booking recordspayments- Payment transaction records
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the ISC License.
For any issues or questions, please contact the development team.