Skip to content

A comprehensive Food Delivery System built with Spring Boot providing RESTful APIs for managing restaurants, menu items, orders, and users. Features JWT authentication, role-based authorization, order tracking, and complete restaurant management capabilities.

Notifications You must be signed in to change notification settings

khan-sk-dev/fooddelivery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” Food Delivery System

Food Delivery Spring Boot Java License

πŸ“ Description

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.

✨ Features

  • πŸ• 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 Stack

Technology Description
Java Core programming language
Spring Boot Application framework
Spring MVC Web framework
Spring Data JPA Data persistence
H2 Database In-memory database (configurable)
Maven Build tool
Swagger API documentation
JUnit Testing framework

πŸ“‹ Prerequisites

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)

βš™οΈ Installation & Setup

1. Clone the repository

git clone https://github.com/khan-sk-dev/fooddelivery.git
cd fooddelivery

2. Configure the database (Optional)

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

3. Build the project

mvn clean install

4. Run the application

mvn spring-boot:run

5. Access the application

The application will be running at http://localhost:8080

Swagger API documentation will be available at http://localhost:8080/swagger-ui.html

πŸ”Œ API Endpoints

Menu Items

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

Orders

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

Users

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

Restaurants

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

πŸ”’ Security & Authentication

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

πŸ§ͺ Testing

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

πŸ—οΈ Project Structure

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

πŸ“Š Database Schema

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"
Loading

πŸ“± Mobile App Integration

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

πŸš€ Future Enhancements

  • 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

πŸ”„ CI/CD Pipeline

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

πŸ‘₯ Contributing

Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“ž Contact

Khan - @github_username

Project Link: https://github.com/khan-sk-dev/fooddelivery


πŸ• Made with ❀️ by khan-sk-dev πŸ”

About

A comprehensive Food Delivery System built with Spring Boot providing RESTful APIs for managing restaurants, menu items, orders, and users. Features JWT authentication, role-based authorization, order tracking, and complete restaurant management capabilities.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages