/perfumeshop

Java ecommerce

Primary LanguageHTMLMIT LicenseMIT

PerfumeShop: A Java Ecommerce App

PerfumeShop is a feature-rich ecommerce platform built with Spring Boot. It offers a comprehensive set of tools for managing an online perfume store, including a full suite of CRUD (Create, Read, Update, Delete) operations and easy database management through migrations.

Tech Stack:

  • Language: JDK 21
  • Framework: Spring Boot
  • Frontend: Thymeleaf
  • Databases: PostgreSQL
  • Migrations: Flyway
  • ORM: Hibernate, Jakarta Persistence
  • Security: Spring Security, JWT
  • Other: Spring Mail, ModelMapper,
  • Misc: No Lombok

Running with Docker

  1. Get the JAR: Download the JAR file from the GitHub releases and place it in the project's root directory.

  2. Stop Existing Containers:

    sudo docker-compose down
  3. Build and Run:

    sudo docker-compose up --build
  4. Access Your App: Visit http://localhost:8080 in your web browser.

How to Run PerfumeShop locally

1. Verify the environmental information you have

Click to expand!

Java

$ java --version
java 21.0.3 2024-04-16 LTS
Java(TM) SE Runtime Environment (build 21.0.3+7-LTS-152)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.3+7-LTS-152, mixed mode, sharing)

Maven

$ mvn -v
Apache Maven 3.9.7 (8b094c9513efc1b9ce2d952b3b9c8eaedaf8cbf0)
Maven home: /opt/apache-maven-3.9.7
Java version: 21.0.3, vendor: Oracle Corporation, runtime: /opt/jdk-21.0.3
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "6.1.0-21-amd64", arch: "amd64", family: "unix"

PostgreSQL

$ psql --version
psql (PostgreSQL) 15.6 (Debian 15.6-0+deb12u1)

System Information

OS version: Debian GNU/Linux 12 (bookworm)
RAM available: 14Gi (GiB, or gibibytes)
Hard disk: 28G (GiB)
Intel version: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
SSD model: Samsung SSD 860 EVO 500GB

2. Setup Database

Click to expand!
  1. Access the PostgreSQL command line:

    sudo -u postgres psql
  2. Create the perfume database:

    CREATE DATABASE perfume;
  3. Create a user:

    CREATE USER haven_app WITH ENCRYPTED PASSWORD '123456789';
  4. Grant privileges on the database:

    GRANT ALL PRIVILEGES ON DATABASE perfume TO haven_app;
  5. Connect to the teamflow database:

    \c perfume
  6. Create a new schema:

    CREATE SCHEMA perfume_migrations;
  7. Grant privileges on the new schema:

    GRANT ALL ON SCHEMA perfume_migrations TO haven_app;
  8. Run the Flyway migration script (Change perfume_migrations with schema's name you want.):

    mvn flyway:migrate -Dflyway.schemas=perfume_migrations -Dflyway.url=jdbc:postgresql://localhost/perfume -Dflyway.user=haven_app -Dflyway.password=123456789
  9. Run the application as described in the next section.

See StackOverflow Question for more information on why we need to create separate schemas.

3. Run the Application

Click to expand!
  1. Start the application:

    mvn clean spring-boot:run
  2. Open your browser and go to http://localhost:8080.

  3. Log in with the following credentials:

    or

    or

Screenshots

Menu page Product page
Menu page Product page
Cart Ordering
Cart Ordering
Email template List of orders
Email template List of orders
User profile page Add perfume page
User profile page Add perfume page

Code of Conduct

See NCOC.

Connect with Me