Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OnlineStore-JavaFX

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.

Overview

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.

Features

  • 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

Tech Stack

  • Language: Java
  • UI Framework: JavaFX (FXML + CSS for styling)
  • Build tool: Maven

Project Structure

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)

How to Run

  1. Make sure you have JDK 17+ and Maven installed
  2. Clone this repository
  3. Run with Maven:
    ./mvnw clean javafx:run
    
    (or mvnw.cmd clean javafx:run on Windows)

Note on Local Data

  • 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.

Under-the-Hood Improvements

A few things were cleaned up beyond the original feature set:

  • File paths are now centralized in a single FileStorage class 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.xml misconfiguration that pointed mvn javafx:run at 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 proper java.util.logging calls, so the console isn't spammed during normal use and real errors are still traceable
  • Normalized line endings (LF) and added a .gitattributes file so the repo behaves consistently across Windows/macOS/Linux checkouts

Known Limitations

  • 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

Key Takeaways

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.

Contributors

License

This project is licensed under the MIT License.

About

A JavaFX desktop e-commerce app with user/owner roles, product catalog, cart, purchase history, and local encrypted-password storage

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages