This solo project replicates the core functionalities of an online shopping application similar to Digikala or Amazon. Users can browse products, register and log into their accounts, add items to a cart, and place orders. Admins and sellers have their own login flows. The application is built in Java using JavaFX for the graphical user interface and MySQL for backend data persistence.
- Java (JavaFX)
- FXML (for layout via Scene Builder)
- MySQL (JDBC for connectivity)
- MVC pattern (Model-View-Controller)
- UUID for unique user IDs
- Multi-role Authentication: Login system for users, sellers, and admins
- Account Creation: Users can sign up and are stored with unique UUIDs
- Product Browsing: Items categorized into Mobiles, Laptops, TVs, Books, and Watches
- Cart & Orders: Add products to cart and track order history
- Comment System: Users can add and view comments tied to product IDs
- Search Functionality: Search for products by name
- Persistent Storage: Products and users are stored in a MySQL database
The app connects to a MySQL database using JDBC. Tables are used to store users, products, and comments. The application performs SQL queries to retrieve categorized product data and displays it in the GUI using JavaFX components like VBox
and Label
.
The following snippet initializes a database connection and executes a sample query:
public class ConnectDB {
static private Statement statement;
public ConnectDB() {
try {
Class.forName("com.mysql.cj.jdbc.Driver");
Connection connection = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/jdbc", "root", "********");
statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery("SELECT * FROM products WHERE Category = 'Mobile'");
} catch (Exception e) {
e.printStackTrace();
}
}
public ResultSet query(String sql){
try {
return statement.executeQuery(sql);
} catch (Exception e){
e.printStackTrace();
return null;
}
}
}
- Integrating frontend FXML with backend controller logic
- Dynamically rendering data from SQL queries into JavaFX UI
- Initial difficulties in showing product lists in JavaFX containers
- Designing a system for storing and retrieving product-specific comments
- Ensuring correct role-based login flows for different user types
- GUI design using JavaFX and Scene Builder
- Commenting system with a relational database table
- Product search functionality
- Data persistence using JDBC and MySQL
- History of sales and transactions
- UUID-based user identification
The Digikala Shop Simulator project demonstrates how a desktop application can simulate e-commerce functionality using JavaFX and MySQL. It includes a working GUI, database integration, and all major user flow logic — making it a great foundational project for full-stack desktop development.