Skip to content

Case Study : Parking Lot (Spring Boot, Java 17, Maven, JPA, Spring Security (JWT) Actuator, MySql, JUnit, Integration Test, Docker, Test Container, AOP, CI/CD, Prometheus, Grafana, Github Actions, Liquibase)

Notifications You must be signed in to change notification settings

Rapter1990/parkinglot

Repository files navigation

Case Study - Parking Lot

Main Information

📖 Information

  • Parking Lot is a Spring Boot application covering important and useful features related to managing parking areas, park check-ins and check-outs for drivers, user management, and vehicle management.
  • Roles:
    • Admin: Users with administrative privileges.
    • Driver: Users with driver privileges.
    Explanation:
    • AuthController: API for authentication operations such as register, login, refresh token, and logout.
    • ParkController: APIs related to park check-ins and check-outs for drivers.
    • ParkingAreaController: APIs for managing parking areas, including creating, updating, and deleting parking areas, as well as retrieving parking area information and daily income handled with admins
    • UserController: APIs for managing user information, including retrieving user information by ID for both admins and drivers.
    • VehicleController: APIs for managing vehicles, including assigning a vehicle to a user and retrieving parking details of a vehicle handled with drivers.

Explore Rest APIs

Method Url Description Request Body Header Valid Path Variable Request Param No Path Variable
POST /register Register a new user (Admin and Driver) SignupRequest request
POST /login Login user (Admin and Driver) LoginRequest request
POST /refreshtoken Refresh token (Admin and Driver) TokenRefreshRequest request
POST /logout Logout user (Admin and Driver) Authorization header with Bearer token
POST /parks/userId/{userId}/check-in Check in to a park (Driver) ParkCheckInRequest request Authorization header with Bearer token {userId} - Valid UUID
POST /parks/userId/{userId}/check-out Check out from a park (Driver) ParkCheckOutRequest request Authorization header with Bearer token {userId} - Valid UUID
POST /parking-area Create a new parking area (Admin) ParkingAreaCreateRequest request Authorization header with Bearer token
GET /parking-area/id/{parkingAreaId} Get a parking area by ID (Admin) Authorization header with Bearer token {parkingAreaId} - Valid UUID
GET /parking-area/name/{name} Get a parking area by name (Admin) Authorization header with Bearer token {name} - Non-empty string
GET /parking-area/income Get daily income for a parking area (Admin) date - Date in dd-MM-yyyy format
parkingAreaId - String
Authorization header with Bearer token parkingAreaId - Valid UUID , date - Valid Date
DELETE /parking-area/{parkingAreaId} Delete a parking area by ID (Admin) Authorization header with Bearer token {parkingAreaId} - Valid UUID
PUT /parking-area/{parkingAreaId} Update a parking area by ID (Admin) ParkingAreaUpdateRequest request Authorization header with Bearer token {parkingAreaId} - Valid UUID
GET /users/user/{user-id} Get user information by ID (Driver) Authorization header with Bearer token {user-id} - Valid UUID
GET /users/admin/{admin-id} Get admin information by ID (Admin) Authorization header with Bearer token {admin-id} - Valid UUID
POST /vehicles/assign/{user-id} Assign a vehicle to a user (Driver) VehicleRequest request Authorization header with Bearer token {user-id} - Valid UUID
GET /vehicles/get-parking-detail/{licensePlate} Get parking details of a vehicle (Driver) Authorization header with Bearer token {licensePlate} - String

Technologies

  • Java 17
  • Spring Boot 3.0
  • Spring Security
  • JWT
  • Restful API
  • Lombok
  • Maven
  • Junit5
  • Mockito
  • Integration Tests
  • Docker
  • Docker Compose
  • CI/CD (Github Actions)
  • Prometheus and Grafana
  • Postman
  • Actuator
  • Open Api (Swagger 3)
  • Liquibase

Postman

Import postman collection under postman_collection folder

Open Api (Swagger 3)

http://localhost:1222/swagger-ui/index.html

Prerequisites

Define Variable in .env file

DATABASE_USERNAME={DATABASE_USERNAME}
DATABASE_PASSWORD={DATABASE_PASSWORD}
PARKING_LOT_LIQUIBASE_ENABLE_DROP_FIRST=true

  • Maven or Docker

Docker Run

The application can be built and run by the Docker engine. The Dockerfile has multistage build, so you do not need to build and run separately.

Please follow directions shown below in order to build and run the application with Docker Compose file;

$ cd parkinglot
$ docker-compose up -d

If you change anything in the project and run it on Docker, you can also use this command shown below

$ cd parkinglot
$ docker-compose up --build

Maven Run

To build and run the application with Maven, please follow the directions shown below;

$ cd parkinglot
$ mvn clean install
$ mvn spring-boot:run

Docker Image Location

https://hub.docker.com/repository/docker/noyandocker/parkinglot/general

Prometheus

To open Prometheus running on Docker as Image , please go to the link shown below. Its screenshot is displayed in the Screenshots part.

http://localhost:9090

Grafana

To open Grafana running on Docker as Image , please go to the link shown below. Its screenshots is displayed in the Screenshots part.

http://localhost:3000

Screenshots

Click here to show the screenshots of project

Figure 1

Figure 2

Figure 3

Figure 4

Figure 5

Figure 6

Figure 7

Figure 8

Figure 9

Figure 10

Figure 11

Figure 12

Figure 13

Figure 14

Figure 15

Figure 16

Figure 17

Figure 18

Figure 19

Figure 20

Figure 21

Figure 22

Figure 23

Figure 24

Figure 25

Figure 26

Figure 27

Figure 28

Figure 29

Contributors

About

Case Study : Parking Lot (Spring Boot, Java 17, Maven, JPA, Spring Security (JWT) Actuator, MySql, JUnit, Integration Test, Docker, Test Container, AOP, CI/CD, Prometheus, Grafana, Github Actions, Liquibase)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •