This repository contains the backend code for a white-label restaurant food delivery web application. The backend is built using Spring Boot, providing RESTful APIs to manage products, users, and orders for multiple restaurants.
- Spring Boot: A powerful framework for building Java-based enterprise applications.
- Spring Data JPA: Simplifies data access using the Java Persistence API.
- PostgreSQL: A powerful, open-source relational database.
- Maven: A build automation tool for managing project dependencies.
- Spring Security: Provides authentication and authorization for the APIs.
- Flyway: Manages database schema versioning.
The project follows a modular structure to organize different components:
- restaurant: Manages various aspects of restaurant functionalities, such as menus, products, categories.
- auth: Manages users, authentication, and authorization.
- order: Manages the order lifecycle.
- delivery: Manages the delivery process.
- payment: Integrates with payment gateways to handle payment transactions securely.
- transaction: Manages the transaction process.
- billing: Handle the billing portion.
- config: Contains configuration classes (e.g., security configuration).
Each module containes its own set of configurations, controllers, models, repositories, and services to facilitate separation of concerns:
- model: Contains entity classes (e.g.,
Product
,ProductCategory
). - repository: Defines Spring Data JPA repositories for database access.
- service: Implements business logic for products and categories.
- controller: Handles API requests and responses.
- payload: Contains request payload classes for API endpoints.
To run this project locally, follow these steps:
- Clone the repository:
git clone https://github.com/cded/foodhub.git
- Navigate to the project folder:
cd foodhub
- Build the project:
mvn clean install
- Run the application:
mvn spring-boot:run
The application will start on http://localhost:8080.
-
Product Management:
- GET
/api/products
: Get a list of all products. - GET
/api/products/{productId}
: Get details of a specific product. - POST
/api/products
: Create a new product. - PUT
/api/products/{productId}
: Update an existing product. - DELETE
/api/products/{productId}
: Delete a product.
- GET
-
Category Management:
- GET
/api/product-categories
: Get a list of all product categories. - GET
/api/product-categories/{categoryId}
: Get details of a specific product category. - POST
/api/product-categories
: Create a new product category. - PUT
/api/product-categories/{categoryId}
: Update an existing product category. - DELETE
/api/product-categories/{categoryId}
: Delete a product category.
- GET
-
Order Management:
- GET
/api/orders
: Get a list of all orders. - GET
/api/orders/{orderId}
: Get details of a specific order. - POST
/api/orders
: Create a new order. - PUT
/api/orders/{orderId}
: Update an existing order. - DELETE
/api/orders/{orderId}
: Delete an order.
- GET
Contributions are welcome! Feel free to open issues or pull requests for any improvements or bug fixes.
This project is licensed under the GNU General Public License v3.0.