This food delivery application was developed as part of a mentorship program, where I worked closely with a team to implement various features and backend functionalities using Spring Boot and MySQL. The project simulates a real-world food delivery system, allowing users to browse restaurants, menus, and manage orders.
- Spring REST
- Spring Data JPA
- Spring Security
- JWT
- MySQL
- Docker
- Designed the flowchart and sequence diagram for the "Place Order" function to ensure a clear understanding of the process flow between the user, system, and database.
- Wrote a detailed flow and pseudocode to describe the logic behind placing an order with the scenario and actions provided, covering scenarios like inventory checks, payment validation, and order confirmation.
View detailed flow of the functionality
View pseudocode
- Developed the deleteRestaurantById method to enable soft deletion of restaurants from the system which is useful for historical records, reports, analytics, customer records or auditing purposes..
- The method checks if the restaurant exists and whether it has already been deleted, preventing duplicate delete actions.
- It ensures that the restaurant’s latest order status is valid before proceeding (no active orders).
- Deletes related data such as menu items and cart items associated with the restaurant, ensuring data consistency.
View process implementation
Dealing with large datasets or a high volume of orders will affect the performance when finding the latest order or validating active orders in the method. Sorting by
order_date
can be expensive because the > > database has to scan and order all the records that match therestaurant_id
.
Solution:
We can improve performance by creating a composite index onrestaurant_id
andorder_date
.
- Functionality: Implemented a user registration method that checks if the username or email already exists in the database before registering a new user.
- Process:
- Validates the username and email.
- Encrypts the password using
BCryptPasswordEncoder
and sets registration details (e.g., registration date, last login, and enabling the user by default). - Assigns roles to the user based on the roles provided in the registration request, then saves them.
- Functionality: Implemented a login system to authenticate users based on username and password.
- Process:
- User provides login credentials.
- The system authenticates the user using
AuthenticationManager
andUsernamePasswordAuthenticationToken
. - Upon successful authentication, the system stores the user's authentication in the security context using
SecurityContextHolder
. View process implementation
- Functionality: Implemented role-based authorization to protect specific endpoints based on user roles.
- Process:
- The system checks the user's role before allowing access to certain resources.
- Configured
HttpSecurity
to permit or restrict access to endpoints based on roles. - For instance, only Restaurant Owners or Admins can manage restaurant data, while Customers can manage orders and cart. View process implementation