A desktop e-commerce application built with Java and JavaFX, featuring user accounts, a product catalog with categories and discounts, a shopping cart, purchase history, and a full admin/owner dashboard for managing products and users.
Beyond a typical shopping-cart demo, this project has two distinct roles: regular users who browse products, add them to a cart, and check out, and an owner/admin panel for managing the store itself — adding products, viewing sales analytics, and managing user/admin accounts. Product data (name, price, discount, stock count, category, image) and user accounts are persisted locally using Java serialization.
- User accounts — sign up, log in, "forgot password" flow, and profile editing, with passwords salted and hashed (PBKDF2) rather than stored in plaintext
- Product catalog — browse by category, view discounted vs. regular-priced items with distinct card layouts
- Shopping cart — add/remove items, quantities tracked per product
- Purchase history — past purchases are recorded per user
- Owner dashboard — live sales count, total sales, total profit, and total user count at a glance
- Admin management — add new admin accounts, manage/view existing users
- Product management — add new products with images, pricing, discount, and category from the UI
- Language: Java
- UI Framework: JavaFX (FXML + CSS for styling)
- Build tool: Maven
OnlineStore-JavaFX/
├── src/main/java/com/example/onlinestorejavafx/
│ ├── Main.java # Application entry point
│ ├── Moderator.java # Shared app state / screen navigation
│ ├── models/
│ │ ├── User.java # User account model (Serializable)
│ │ ├── Product.java # Product model (price, discount, stock, category)
│ │ ├── NewProduct.java
│ │ └── HistoryProduct.java
│ └── controllers/
│ ├── HomeController.java # Main storefront view
│ ├── CategoryController.java
│ ├── CartPageController.java
│ ├── ProductPageController.java
│ ├── ShoppingHistoryController.java
│ ├── LoginPageController.java
│ ├── SignUpPageController.java
│ ├── ForgetPasswordController.java
│ ├── ProfilePageController.java
│ ├── OwnerController.java # Owner dashboard (sales/profit/user stats)
│ ├── AddProductController.java
│ ├── AddAdmin.java
│ ├── AdminManagementController.java
│ ├── ProductViewController.java
│ └── UserViewController.java
├── src/main/resources/com/example/onlinestorejavafx/
│ ├── *.fxml # Screen layouts
│ └── styles/*.css # Per-screen styling
├── images/ # Product images
└── files/ # Local data (Products.dat, Users.dat — gitignored)
- Make sure you have JDK 17+ and Maven installed
- Clone this repository
- Run with Maven:
(or
./mvnw clean javafx:runmvnw.cmd clean javafx:runon Windows)
files/Users.dat(account data) is excluded from the repository (.gitignore) since it's local test data — passwords are salted and hashed with PBKDF2 (javax.crypto) before being stored, never kept in plaintext.files/Products.dat(demo product catalog) is included so the storefront has sample data to display out of the box.
A few things were cleaned up beyond the original feature set:
- File paths are now centralized in a single
FileStorageclass instead of being hardcoded (and Windows-only) in 13 different files — this also fixes the app failing to run on macOS/Linux - Fixed a
pom.xmlmisconfiguration that pointedmvn javafx:runat a non-existent class - Several file streams are now properly closed via try-with-resources instead of being left open if an exception occurred mid-read/write
- Removed leftover scratch/debug files that weren't part of the actual application
- Swapped raw
System.out.println/printStackTrace()calls in the controllers for properjava.util.loggingcalls, so the console isn't spammed during normal use and real errors are still traceable - Normalized line endings (LF) and added a
.gitattributesfile so the repo behaves consistently across Windows/macOS/Linux checkouts
- This is a frontend/desktop demo — there's no external backend or payment processing; all data is stored locally via Java serialization
- No real checkout/payment flow; the cart demonstrates the UI and data model rather than a live transaction
Splitting the app into a regular user flow and a separate owner/admin flow was a good exercise in structuring a multi-role JavaFX application with shared navigation (Moderator) and serialized local storage standing in for a real database.
This project is licensed under the MIT License.