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
-
Get the JAR: Download the JAR file from the GitHub releases and
place it in the project's root directory
. -
Stop Existing Containers:
sudo docker-compose down
-
Build and Run:
sudo docker-compose up --build
-
Access Your App: Visit http://localhost:8080 in your web browser.
Click to expand!
$ 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)
$ 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"
$ psql --version
psql (PostgreSQL) 15.6 (Debian 15.6-0+deb12u1)
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
Click to expand!
-
Access the PostgreSQL command line:
sudo -u postgres psql
-
Create the
perfume
database:CREATE DATABASE perfume;
-
Create a user:
CREATE USER haven_app WITH ENCRYPTED PASSWORD '123456789';
-
Grant privileges on the database:
GRANT ALL PRIVILEGES ON DATABASE perfume TO haven_app;
-
Connect to the
teamflow
database:\c perfume
-
Create a new schema:
CREATE SCHEMA perfume_migrations;
-
Grant privileges on the new schema:
GRANT ALL ON SCHEMA perfume_migrations TO haven_app;
-
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
-
Run the application as described in the next section.
See StackOverflow Question for more information on why we need to create separate schemas.
Click to expand!
-
Start the application:
mvn clean spring-boot:run
-
Open your browser and go to
http://localhost:8080
. -
Log in with the following credentials:
- Email: admin@gmail.com
- Password: admin
or
- Email: test123@test.com
- Password: admin
or
- Email: ivan123@test.com
- Password: admin
Menu page | Product page |
---|---|
Cart | Ordering |
---|---|
Email template | List of orders |
---|---|
User profile page | Add perfume page |
---|---|
See NCOC.
- Email: akmal.fir010@gmail.com
- Telegram: @akmxlfirdaus
- Twitter: @akmalfirdxus
- Instagram: @akmxlfirdaus