A comprehensive Food Delivery System built with Spring Boot, providing RESTful APIs to manage restaurants, menu items, orders, and users. Perfect for food delivery businesses seeking a robust backend solution.
-
π Menu Management
- Add, update, delete, and retrieve menu items
- Categorize items by restaurant and food type
- Support for pricing, descriptions, and availability status
-
π Order Processing
- Place new orders with multiple items
- Track order status (Placed, Preparing, Out for Delivery, Delivered)
- Order history and details retrieval
-
π€ User Management
- Customer registration and profile management
- Restaurant owner/partner registration
- Delivery personnel management
- User authentication and authorization
-
πͺ Restaurant Management
- Restaurant registration and profile
- Opening hours, location, and cuisine types
- Rating and review system
-
π Search Functionality
- Search restaurants by location and cuisine
- Filter menu items by category, price range, and rating
-
π Additional Features
- Global exception handling for consistent error responses
- Comprehensive logging and monitoring
- API documentation with Swagger
- Performance optimizations
Technology | Description |
---|---|
Core programming language | |
Application framework | |
Web framework | |
Data persistence | |
In-memory database (configurable) | |
Build tool | |
API documentation | |
Testing framework |
Before you begin, ensure you have met the following requirements:
- Java 17 or later
- Maven 3.6+
- Your favorite IDE (IntelliJ IDEA, Eclipse, etc.)
- Postman or any API testing tool (optional)
git clone https://github.com/khan-sk-dev/fooddelivery.git
cd fooddelivery
By default, the application uses H2 in-memory database. If you want to use a different database, update the src/main/resources/application.properties
file:
# For MySQL
spring.datasource.url=jdbc:mysql://localhost:3306/fooddelivery
spring.datasource.username=your_username
spring.datasource.password=your_password
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
# JPA/Hibernate properties
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
mvn clean install
mvn spring-boot:run
The application will be running at http://localhost:8080
Swagger API documentation will be available at http://localhost:8080/swagger-ui.html
Method | Endpoint | Description |
---|---|---|
POST | /api/menu-items |
Add a new menu item |
GET | /api/menu-items/{id} |
Retrieve a menu item by ID |
GET | /api/menu-items/restaurant/{restaurantId} |
Retrieve menu items by restaurant ID |
PUT | /api/menu-items/{id} |
Update a menu item |
DELETE | /api/menu-items/{id} |
Delete a menu item |
Method | Endpoint | Description |
---|---|---|
POST | /api/orders/place |
Place a new order |
GET | /api/orders/{id} |
Retrieve an order by ID |
GET | /api/orders/status/{status} |
Retrieve orders by status |
PUT | /api/orders/{id}/status |
Update order status |
GET | /api/orders/user/{userId} |
Retrieve orders by user |
Method | Endpoint | Description |
---|---|---|
POST | /api/users |
Create a new user |
GET | /api/users/{id} |
Retrieve a user by ID |
GET | /api/users/email/{email} |
Retrieve a user by email |
GET | /api/users |
Retrieve all users |
PUT | /api/users/{id} |
Update user details |
DELETE | /api/users/{id} |
Delete a user |
Method | Endpoint | Description |
---|---|---|
POST | /api/restaurants |
Add a new restaurant |
GET | /api/restaurants/{id} |
Get restaurant by ID |
GET | /api/restaurants/location/{location} |
Find restaurants by location |
GET | /api/restaurants/cuisine/{cuisine} |
Find restaurants by cuisine |
PUT | /api/restaurants/{id} |
Update restaurant details |
DELETE | /api/restaurants/{id} |
Delete a restaurant |
The system implements security features to protect user data and restrict access to API endpoints:
- JWT-based authentication
- Role-based authorization (CUSTOMER, RESTAURANT_OWNER, DELIVERY_PERSON, ADMIN)
- Password encryption using BCrypt
- HTTPS support for secure communication
The project includes comprehensive tests to ensure reliability:
# Run all tests
mvn test
# Run specific test category
mvn test -Dtest=*ControllerTest
# Generate test coverage report
mvn jacoco:report
Test coverage can be viewed at target/site/jacoco/index.html
fooddelivery/
βββ src/
β βββ main/
β β βββ java/com/khan/fooddelivery/
β β β βββ config/
β β β βββ controller/
β β β βββ dto/
β β β βββ exception/
β β β βββ model/
β β β βββ repository/
β β β βββ security/
β β β βββ service/
β β β βββ util/
β β β βββ FoodDeliveryApplication.java
β β βββ resources/
β β βββ application.properties
β βββ test/
β βββ java/com/khan/fooddelivery/
β βββ controller/
β βββ repository/
β βββ service/
βββ .gitignore
βββ mvnw
βββ mvnw.cmd
βββ pom.xml
βββ README.md
erDiagram
User {
Long id PK
String name
String email
String password
String phone
String address
String role
}
Restaurant {
Long id PK
String name
String location
String cuisine
String openingHours
Float rating
Long ownerId FK
}
MenuItem {
Long id PK
String name
String description
Double price
String category
Boolean available
Long restaurantId FK
}
Order {
Long id PK
DateTime orderTime
String status
Double totalAmount
String deliveryAddress
Long userId FK
Long deliveryPersonId FK
}
OrderItem {
Long id PK
Integer quantity
Double price
Long orderId FK
Long menuItemId FK
}
DeliveryPerson {
Long id PK
String name
String phone
String status
Long userId FK
}
User ||--o{ Order : "places"
User ||--o{ Restaurant : "owns"
Restaurant ||--o{ MenuItem : "offers"
Order ||--o{ OrderItem : "contains"
MenuItem ||--o{ OrderItem : "included in"
DeliveryPerson ||--o{ Order : "delivers"
User ||--|| DeliveryPerson : "is registered as"
The backend system is designed to support both mobile and web applications:
- RESTful API design enables easy integration
- Authentication tokens for secure mobile access
- Push notification support for order updates
- Real-time tracking capabilities
- Optimized for low-bandwidth scenarios
- Payment gateway integration
- Real-time order tracking with WebSockets
- AI-based food recommendations
- Multi-language support
- Restaurant analytics dashboard
- Customer loyalty program
- Scheduled orders and recurring deliveries
- Route optimization for delivery personnel
The project uses GitHub Actions for continuous integration and deployment:
- Automated builds on push
- Test suite execution
- Code quality checks
- Containerization with Docker
- Automatic deployment to staging environments
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- 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
Khan - @github_username
Project Link: https://github.com/khan-sk-dev/fooddelivery
π Made with β€οΈ by khan-sk-dev π