A production-style food order web application built using Java EE, JSP, Servlets, JDBC, and MySQL, following the MVC (ModelโViewโController) architecture. FoodXpress simulates a real-world online food ordering platform where users can discover restaurants ๐ฝ๏ธ, explore menus ๐, manage carts ๐, place orders ๐, and track order history ๐ฆ โ similar to popular platforms like Swiggy and Zomato.
FoodXpress is a full-stack food delivery web application designed to digitize the traditional restaurant ordering experience using core Java EE technologies.
-
The platform enables users to register and log in securely ๐
-
Browse restaurants ๐ฝ๏ธ
-
Explore dynamic menus ๐
-
Add items to a persistent cart ๐
-
Place orders ๐
-
Track their complete order history ๐ฆ through a clean, user-friendly interface
-
Built using a layered MVC architecture
-
FoodXpress demonstrates real-world backend engineering practices such as:
- Servlet-based request handling
- DAO abstraction
- JDBC-driven database interaction
- Session management
- Secure authentication
-
Making it a strong showcase of end-to-end Java full-stack development
Below is a visual walkthrough of FoodXpress, showcasing key user flows and core features of the application โ from authentication to order completion ๐ฆ๐
- ๐ Secure User Registration & Login with session management
- ๐ Personalized User Dashboard after authentication
- ๐ฝ๏ธ Browse available Restaurants with detailed listings
- ๐ View Dynamic Menus with real-time item data
- ๐ Add to Cart functionality with quantity management
- ๐ Manage Delivery Addresses for order placement
- ๐ Smooth Checkout Flow with order confirmation
- ๐ฆ View Order Success and detailed Order History
- ๐ค Update and manage User Profile information
- ๐งฑ Clean MVC (ModelโViewโController) architecture
- ๐ Servlet-based request handling and routing
- ๐๏ธ DAO pattern for database abstraction
- ๐ JDBC integration with MySQL for persistent storage
- ๐ Session tracking for authenticated user flows
โ ๏ธ Centralized validation & error handling- ๐งน Modular and maintainable project structure
- ๐จ Clean, intuitive, and user-friendly UI
- ๐ฑ Responsive layouts for different screen sizes
- โก Dynamic page rendering using JSP
- ๐งญ Simple navigation flow across all modules
- โ Clear user feedback for actions and status updates
%%{init: {
"theme": "default",
"themeVariables": {
"background": "#FFFFFF",
"primaryColor": "#FFE8D6",
"primaryTextColor": "#2D3436",
"primaryBorderColor": "#FF6B6B",
"lineColor": "#4ECDC4",
"secondaryColor": "#E3F2FD",
"tertiaryColor": "#E8F5E9",
"fontFamily": "Arial, sans-serif",
"fontSize": "14px"
}
}}%%
flowchart TB
subgraph PL["๐จ Presentation Layer"]
A["User Browser ๐"]
B["JSP / JSTL Views ๐ฑ"]
end
subgraph CL["๐ง Controller Layer"]
C["Servlets โก<br/>HTTP Request Handler"]
D["Business Logic โ๏ธ"]
end
subgraph DAL["๐๏ธ Data Access Layer"]
E["DAO Interfaces ๐"]
F["DAO Implementations ๐พ"]
G["JDBC API ๐"]
end
subgraph DB["๐พ Database Layer"]
H["MySQL Database ๐๏ธ"]
end
subgraph ML["๐ฆ Model Layer"]
I["POJO / Entity Classes ๐"]
end
A -- "HTTP Request" --> B
B -- "Form Submit" --> C
C -- "Process Logic" --> D
D -- "Data Operation" --> E
E -- "CRUD Contract" --> F
F -- "SQL Execution" --> G
G -- "Database Query" --> H
C -- "Create Objects" --> I
H -- "ResultSet" --> I
I -- "Populated Data" --> B
FoodApp/
โโโ ๐ฆ src/main/java/com/app
โ โโโ ๐ง ## controllers/ # Handles HTTP requests & responses
โ โ โโโ AddressServlet.java
โ โ โโโ AdminMenuServlet.java
โ โ โโโ AdminRestaurantServlet.java
โ โ โโโ CartServlet.java
โ โ โโโ CheckoutServlet.java
โ โ โโโ MenuServlet.java
โ โ โโโ OrderHistoryServlet.java
โ โ โโโ OrderSuccessServlet.java
โ โ โโโ OrderSummaryServlet.java
โ โ โโโ PaymentServlet.java
โ โ โโโ RestaurantServlet.java
โ โ โโโ UserServlet.java
โ โ
โ โโโ ๐ dao/ # DAO interfaces (contracts)
โ โ โโโ AddressDAO.java
โ โ โโโ CartDAO.java
โ โ โโโ MenuItemDAO.java
โ โ โโโ OrderDAO.java
โ โ โโโ RestaurantDAO.java
โ โ โโโ UserDAO.java
โ โ
โ โโโ ๐พ dao_implementation/ # DAO implementations (JDBC logic)
โ โ โโโ AddressDAOImpl.java
โ โ โโโ CartDAOImpl.java
โ โ โโโ MenuItemDAOImpl.java
โ โ โโโ OrderDAOImpl.java
โ โ โโโ RestaurantDAOImpl.java
โ โ โโโ UserDAOImpl.java
โ โ
โ โโโ ๐ฆ models/ # POJO / Entity classes
โ โ โโโ Address.java
โ โ โโโ Cart.java
โ โ โโโ CartItem.java
โ โ โโโ MenuItem.java
โ โ โโโ Order.java
โ โ โโโ OrderItem.java
โ โ โโโ Restaurant.java
โ โ โโโ User.java
โ โ
โ โโโ ๐ filters/ # Authentication & authorization
โ โ โโโ AuthFilter.java
โ โ
โ โโโ โ๏ธ utility/ # Common utilities
โ โ โโโ DBConnection.java
โ โ
โ โโโ ๐งช test/ # Unit & integration tests
โ โโโ TestDBConnection.java
โ โโโ TestUserDAO.java
โ
โโโ โ๏ธ src/main/resources
โ โโโ app.properties # Application configuration
โ
โโโ ๐ src/main/webapp # View layer (JSP + static assets)
โ โโโ ๐จ assets/
โ โ โโโ css/
โ โ โโโ images/
โ โ โโโ javascript/
โ โ
โ โโโ ๐ jsp/
โ โ โโโ ๐ก๏ธ admin/ # Admin UI
โ โ โ โโโ dashboard.jsp
โ โ โ โโโ addRestaurant.jsp
โ โ โ โโโ editRestaurant.jsp
โ โ โ โโโ menuListAdmin.jsp
โ โ โ โโโ restaurantListAdmin.jsp
โ โ โ
โ โ โโโ ๐ฅ customer/ # Customer UI
โ โ โ โโโ home.jsp
โ โ โ โโโ restaurantList.jsp
โ โ โ โโโ restaurantDetails.jsp
โ โ โ โโโ cart.jsp
โ โ โ โโโ checkout.jsp
โ โ โ โโโ order_summary.jsp
โ โ โ โโโ orderSuccess.jsp
โ โ โ โโโ orderHistory.jsp
โ โ โ โโโ profile.jsp
โ โ โ โโโ addresses.jsp
โ โ โ
โ โ โโโ ๐ shared/ # Reusable JSP fragments
โ โ โโโ header.jspf
โ โ โโโ footer.jspf
โ โ โโโ head.jspf
โ โ
โ โโโ ๐ login.jsp
โ โโโ ๐ register.jsp
โ โโโ ๐ index.jsp
โ โ
โ โโโ โ๏ธ WEB-INF/
โ โโโ web.xml # Servlet & filter configuration
โ
โโโ ๐ธ screenshots/ # Application UI screenshots
โ
โโโ ๐ฆ pom.xml # Maven dependencies & build config
โโโ ๐ README.md # Project documentation
FoodXpress uses a relational MySQL database with 8 normalized tables following 3rd Normal Form (3NF). The design ensures data integrity, scalability, and performance for handling thousands of concurrent food orders.
erDiagram
%% Styling for better GitHub visibility
classDef userEntity fill:#e8f5e9,stroke:#2e7d32,stroke-width:2px
classDef restaurantEntity fill:#fff3e0,stroke:#ef6c00,stroke-width:2px
classDef orderEntity fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
classDef cartEntity fill:#e3f2fd,stroke:#1565c0,stroke-width:2px
classDef bridgeEntity fill:#fce4ec,stroke:#c2185b,stroke-width:2px
users ||--o{ addresses : "has"
users ||--o{ orders : "places"
users ||--|| carts : "owns"
carts ||--o{ cart_items : "contains"
restaurants ||--o{ menu_items : "offers"
restaurants ||--o{ orders : "receives"
addresses ||--o{ orders : "used_for"
orders ||--o{ order_items : "contains"
menu_items ||--o{ cart_items : "added_to"
menu_items ||--o{ order_items : "ordered_as"
users {
int user_id PK
varchar(100) name
varchar(50) username UK
varchar(255) password
varchar(100) email UK
varchar(15) phone
varchar(255) address
enum role
datetime created_date
datetime last_login_date
}
addresses {
int address_id PK
int user_id FK
varchar(255) street
varchar(100) city
varchar(100) state
varchar(20) zip
varchar(255) landmark
timestamp created_at
}
restaurants {
int restaurant_id PK
varchar(100) name
text description
varchar(50) cuisine_type
varchar(255) address
varchar(100) city
varchar(100) state
varchar(20) zip
varchar(15) phone
varchar(100) email
decimal rating
int delivery_time
varchar(255) image_url
boolean is_active
timestamp created_at
}
menu_items {
int menu_item_id PK
int restaurant_id FK
varchar(150) name
text description
decimal price
varchar(50) category
boolean is_veg
boolean is_available
varchar(255) image_url
timestamp created_at
}
carts {
int cart_id PK
int user_id FK
timestamp created_at
timestamp updated_at
}
cart_items {
int cart_item_id PK
int cart_id FK
int menu_item_id FK
int quantity
timestamp added_at
}
orders {
int order_id PK
int user_id FK
int restaurant_id FK
int address_id FK
decimal total_amount
enum status
enum payment_method
enum payment_status
text delivery_instructions
timestamp created_at
timestamp updated_at
}
order_items {
int order_item_id PK
int order_id FK
int menu_item_id FK
int quantity
decimal price_at_order
timestamp created_at
}
Follow the steps below to set up and run FoodXpress locally on your system.
Ensure the following tools are installed before running the project:
- โ Java JDK 17
- ๐ Apache Tomcat 9
- ๐๏ธ MySQL Server
- ๐ ๏ธ Eclipse IDE (Recommended for Java EE projects)
- ๐ Git (for cloning the repository)
-
Clone the repository
git clone https://github.com/pratikp3280/FoodXpress.git
-
Import into Eclipse
- Open Eclipse
- Go to:
File โ Import โ Existing Maven Projects - Select the cloned
FoodXpress/FoodAppdirectory - Finish the import
-
Open MySQL and create the database:
CREATE DATABASE food_delivery_app;
-
Execute the provided SQL scripts to create tables:
usersaddressesrestaurantsmenu_itemscartscart_itemsordersorder_items
-
Ensure the database is running on:
- Host:
localhost - Port:
3306
- Host:
-
Open the configuration file:
src/main/resources/app.properties -
Update your MySQL credentials:
db.url=jdbc:mysql://localhost:3306/food_delivery_app db.username=your_mysql_username db.password=your_mysql_password
-
Save the file after updating the credentials.
- Right-click the project in Eclipse
- Select:
Run As โ Run on Server - Choose Apache Tomcat 9
- Finish and wait for deployment
Once the server starts, access the application at:
http://localhost:8080/FoodXpress/
flowchart LR
%% User Flow Diagram
subgraph UserFlow
direction LR
A[๐ Landing Page] --> B[๐ Register / Login]
B --> C[๐ฝ๏ธ Browse Restaurants]
C --> D[๐ Explore Menu]
D --> E[๐ Manage Cart]
E --> F[๐ Select Address]
F --> G[๐ Place Order]
G --> H[๐ฆ Order Confirmation]
H --> I[๐ Order History]
I --> J[๐ค Profile Management]
end
%% Admin Flow Diagram
subgraph AdminFlow
direction LR
A1[๐ Admin Login] --> B1[๐ช Manage Restaurants]
B1 --> C1[๐ฝ๏ธ Manage Menu Items]
C1 --> D1[๐ฆ Order Monitoring]
D1 --> E1[๐ System Oversight]
end
FoodXpress implements essential web application security practices to protect user data, restrict unauthorized access, and ensure safe request handling.
- Session-based authentication using
HttpSession - Maintains user identity across requests after login
- Role-based access control for:
- Customers
- Admins
- Unauthorized users are redirected to the login page
- Protected URLs secured using a custom
AuthFilter - Filter checks:
- Active user session
- Valid user role before allowing access
- Prevents direct access to:
- Admin JSP pages
- Order, cart, and checkout endpoints
- User credentials stored securely in the database
- Sensitive operations validated server-side
- Database access abstracted using DAO pattern
- No direct database access from JSP pages
- Server-side validation for:
- Login and registration forms
- Address and order data
- Graceful error handling for invalid inputs
- User-friendly error messages without exposing system details
- Automatic session invalidation on logout
- Prevents session fixation by regenerating sessions after login
- Proper closing of JDBC resources to avoid leaks
- Authentication handled at the controller level
- Authorization enforced via servlet filters
- MVC separation prevents logic leakage to views
- Database operations isolated from presentation layer
This section provides an overview of FoodXpress's backend design, request flow, and core implementation patterns.
- ๐ JSP UI: Users interact with JSPs for input.
- ๐ค Servlet Controllers: Handle HTTP requests, validate inputs, manage sessions, and execute business logic.
- ๐๏ธ DAO Layer: Delegates database operations using DAO interfaces and JDBC for MySQL interaction.
- ๐ Data Mapping: Retrieved data is converted to POJO/entity objects.
- ๐ฅ Response Rendering: Data is sent back to JSP views for the user.
- ๐ Interfaces: Define database operations for loose coupling and easy testing.
- ๐พ Implementations: Include SQL logic and handle JDBC operations (connections, statements, result sets).
- ๐ Flexibility: Switch persistence mechanisms without affecting the appโs controllers.
- ๐ Centralized
DBConnectionutility for managing database connections. - ๐ Connection properties loaded from
app.properties, ensuring flexibility. - ๐งน Proper resource handling to close:
- Connections
- Statements
- ResultSets
- ๐ User sessions established post-login, storing user IDs and roles (customer/admin).
- โฑ๏ธ Sessions validated for all protected routes.
- ๐ช Explicit session invalidation during logout.
- โ Server-Side Validation: Ensures inputs like login and registration data are properly checked.
- ๐ข Error messages are forwarded to JSPs with meaningful user feedback.
- ๐ซ Prevents invalid data submission and app crashes.
- ๐๏ธ Centralized Settings: Stored in
app.properties, including:- ๐ Database URL
- ๐ Credentials
- ๐ฆ Prevents hardcoding sensitive values into the codebase.
- ๐ง Separation of Concerns: MVC ensures clear modular design.
- ๐ Reusable Persistence Layer: DAO-based, easily testable and modular.
- ๐ Secure Design: Session-based authentication and validation for all routes.
- ๐งฑ Scalability: A maintainable, structured codebase tailored for real-world Java EE projects.
- ๐ ๏ธ Standard Practices: Built on robust Java EE design principles.
FoodXpress goes beyond a basic CRUD application โ it simulates a real-world food delivery platform with clean architecture, scalable design, and production-like workflows.
- ๐งฑ Java EE Core: Built with Servlets + JSP, avoiding heavy frameworks.
- ๐๏ธ Clean MVC Architecture: Enforces strict separation of concerns.
- ๐๏ธ Relational Database Schema: Inspired by real-world food delivery systems.
- ๐ DAO Abstraction: Interface-based database operations for flexibility.
- ๐ Session-Based Authentication: Secured using servlet filters.
- ๐ Persistent Cart: Database-backed cart storage for seamless user experience.
- ๐ฆ Order Management: Full order lifecycle implementation.
- ๐ Multiple Delivery Addresses: Support for multiple addresses per user.
- ๐งช Server-Side Validation: Ensures data integrity and robust error handling.
- ๐ Enterprise-Style Folder Structure: Organized for real-world development.
- ๐ง Clear RequestโResponse Lifecycle: Designed for maintainability and scalability.
- ๐ Centralized JDBC Management: Reusable connection utility for all database operations.
- ๐งฉ Modular, Maintainable Code: Encourages reuse and simplifies future development.
- โ๏ธ Externalized Configurations: Secure
app.propertiessetup for flexibility. - ๐ Extensible Design: Easy to add new features and scale the system.
The following enhancements focus on scalability, security, user experience, and production readiness, adding maximum real-world value to FoodXpress.
-
๐ Advanced Authentication & Security
- Password hashing (BCrypt)
- Forgot password & secure reset flow
- CSRF & XSS protection
-
๐ณ Online Payment Gateway Integration
- UPI / Card payment support
- Payment verification & status tracking
-
๐ด Delivery Partner Module
- Assign orders to delivery agents
- Real-time order status updates
-
โญ User Reviews & Ratings System
- Rate restaurants and food items
- Improve trust and discovery experience
-
๐ฑ Responsive & Mobile-First UI
- Optimized layouts for mobile & tablet
- Enhanced UI interactions & usability
-
๐ง Architecture Upgrade (Spring Boot + REST APIs)
- Migrate to Spring Boot
- Expose REST APIs for mobile app integration
๐จโ๐ป Developer: Pratik P Patil
๐ Role: Java Full Stack Developer
๐ฑ Mobile: +91-8217483820
๐ง Email: pattupammu123@gmail.com
โญ If you found this project useful, feel free to star the repository and connect with me! ๐









