Welcome to the Next.js Chapa Booking System! This project is a simple, open-source hotel booking platform built with Next.js, MongoDB, and Chapa for payment processing. It allows users to browse available rooms, book them, and make payments securely.
- Room Listing: Browse and view details of available rooms.
- Room Booking: Book rooms by providing user details.
- Payment Integration: Secure payment processing with Chapa.
- Webhook Handling: Automated status updates via Chapa webhooks.
- Confirmation and Failure Pages: User feedback on booking status.
- Frontend & Backend: Next.js (React framework with server-side rendering capabilities)
- Database: MongoDB (NoSQL database for scalable data storage)
- Payment Gateway: Chapa (Ethiopian payment gateway for processing transactions)
- Styling: Tailwind CSS (Utility-first CSS framework for styling)
- Node.js (v14.x or higher)
- npm or yarn
- MongoDB (local or hosted)
-
Clone the repository:
git clone https://github.com/BashirMohamedAli/nextjs-chapa-booking-system.git cd nextjs-chapa-booking-system
-
Install dependencies:
npm install # or yarn install
Create a .env.local
file in the root directory of your project and add the following environment variables:
MONGO_URI=your_mongo_db_connection_string
NEXT_PUBLIC_CHAPA_PUBLIC_KEY=your_chapa_public_key
CHAPA_SECRET_KEY=your_chapa_secret_key
CHAPA_WEBHOOK_SECRET=your_chapa_webhook_secret
NEXT_PUBLIC_BASE_URL=http://localhost:3000
- MONGO_URI: MongoDB connection string.
- NEXT_PUBLIC_CHAPA_PUBLIC_KEY: Public key for Chapa.
- CHAPA_SECRET_KEY: Secret key for Chapa API.
- CHAPA_WEBHOOK_SECRET: Secret key for verifying webhook requests.
- NEXT_PUBLIC_BASE_URL: Base URL of your application.
-
Start the development server:
npm run dev # or yarn dev
The application will run at
http://localhost:3000
. -
Build for production:
npm run build npm start # or yarn build yarn start
nextjs-chapa-booking-system/
├── .env.local # Environment variables
├── package.json # Project dependencies and scripts
├── public/ # Static files like images, icons
├── components/ # Shared React components
│ ├── Layout.js # Layout component for consistent styling
│ ├── Navbar.js # Navigation bar component
│ ├── Footer.js # Footer component
├── pages/ # Next.js pages
│ ├── api/ # API routes
│ │ ├── booking.js # API route for creating bookings
│ │ ├── webhook.js # API route for webhook handling
│ │ ├── booking-history.js # API route for booking history
│ ├── rooms/ # Dynamic routing for rooms
│ │ ├── [id].js # Room detail page
│ ├── booked-list.js # Page for displaying booked rooms
│ ├── booking-history.js # Page for displaying booking history
│ ├── index.js # Home page
├── models/ # Mongoose models for MongoDB
│ ├── Booking.js # Booking model
│ ├── Room.js # Room model
├── lib/ # Utility functions
│ ├── dbConnect.js # MongoDB database connection
├── styles/ # CSS and styling files
│ ├── globals.css # Global styles (including Tailwind)
├── .gitignore # Git ignore file
└── README.md # Project documentation
We welcome contributions to improve the Next.js Chapa Booking System! Here's how you can contribute:
-
Fork the repository and create a new branch for your feature or bug fix.
-
Make your changes and ensure that the project builds and functions as expected.
-
Submit a pull request with a clear description of your changes and the problem you're solving.
-
Code of Conduct: Be respectful and considerate in all interactions.
This project is licensed under the MIT License. See the LICENSE file for details.