"SmartPark" is a technology company developing an intelligent parking management system for urban areas. The company is aiming to optimize the use of parking spaces and facilitate easy navigation for drivers.
Follow these instructions to set up, build, and run the SmartPark application on your local machine.
Ensure you have the following installed on your system:
-
JDK 21: This project requires Java 21 (LTS). You can verify your installation by running
java -versionin your terminal. Set the project's SDK to Java 21. In IntelliJ go to: File > Project Structure > Project Settings > Project > SDK. -
Postman installed for API testing.
Move the provided .env file on the root directory
To compile the application and run the tests, navigate to the root directory of the project in your terminal and execute:
./mvnw clean install
You can start the application directly from your IDE or via the command line.
Via IDE (Recommended for Development):
- Open the project in your preferred IDE (e.g., IntelliJ IDEA, Eclipse, or VS Code).
- Navigate to the main entry point:
src/main/java/com/sethdev/smartpark/SmartparkApplication.java - Right-click the file and select Run 'SmartparkApplication'.
Via Command Line:
If you prefer running the application through the command line, use the following command from the project root:
./mvnw spring-boot:run
All service-layer tests are located in src/test/java/com/sethdev/smartpark/service.
Via IDE
- Navigate to
src/test/java/com/sethdev/smartpark/service - Right click then select
Run 'tests' in 'service'
Via Command Line
You can execute the tests using the Maven wrapper included in the project root. To run all tests:
./mvnw test
On app startup, default data are created
User
You can use this for signing in
{
"username": "admin",
"password": "@Passw0rd"
}
Vehicle
{
"id": 1,
"licensePlate": "ABC123",
"vehicleType": "CAR",
"vehicleStatus": "EXITED",
"owner": "Admin"
}
Parking Lot
{
"id": 1,
"lotId": "PK-......",
"location": "Bldg #1 Alfonso Cavite",
"capacity": 10,
"occupiedSpaces": 0,
"availableSpaces": 10,
"costPerMinute": 1.0,
"full": false
}
A Postman collection is provided for easier testing.
Import collection
- Open Postman and go to
File > Import... - Select the
SmartPark.postman_collection.jsonlocated at the root directory of this project.
Includes user registration, login, and logout.
Endpoint: /api/v1/auth/signup
Method: POST
Content Type: application/json
Body:
{
"username": "juanD",
"password": "@Del4CruZ",
"fullName": "Juan Dela Cruz"
}All these fields are required
-
username: Must only contain letters, numbers, spaces, underscores, and dots (3-30 characters) -
password: Must contain at least one uppercase letter, one lowercase letter, one number, and one special character (8-50 characters) -
fullName: Must contain only letters and spaces (1-100 characters)
Response:
201 Created
{"message":"User registered successfully!"}400 Bad Request
{
"status": 400,
"message": "Validation failed",
"errors": [
{
"field": "username",
"message": "Username must be 3-30 characters"
}
]
}Endpoint: /api/v1/auth/signin
Method: POST
Content Type: application/json
Body:
{
"username": "juanD",
"password": "@Del4CruZ"
}Response:
200 OK
{
"id": 2,
"username": "juanD",
"fullName": "Juan Dela Cruz",
"role": "USER"
}401 Unauthorized
{
"message": "Bad credentials"
}Endpoint: /api/v1/auth/signout
Method: POST
Body: None
Response:
200 OK
{
"message": "You've been signed out!"
}Register and view vehicle details
Endpoint: /api/v1/auth/vehicles
Method: POST
Content Type: application/json
Body:
{
"licensePlate": "XYZ123",
"vehicleType": "CAR"
}All these fields are required
-
licensePlate: Can only contain letters, numbers, and dashes -
vehicleType: Must be one of the following:CAR,MOTORCYCLE,TRUCK
Response:
201 Created
{
"id": 2,
"licensePlate": "XYZ123",
"vehicleType": "CAR",
"vehicleStatus": "EXITED",
"owner": "Juan Dela Cruz"
}400 Bad Request
{
"status": 400,
"message": "Validation failed",
"errors": [
{
"field": "licensePlate",
"message": "License plate can only contain letters, numbers, and dashes"
}
]
}Endpoint: /api/v1/auth/vehicles/{id}
Method: GET
Path Variable:
id: ID of the vehicle
Response:
200 OK
{
"id": 2,
"licensePlate": "XYZ123",
"vehicleType": "CAR",
"vehicleStatus": "EXITED",
"owner": "Juan Dela Cruz"
}422
{
"message": "Vehicle not Found"
}Register and view parking lot details which includes capacity and availability
Endpoint: /api/v1/parking-lots
Method: POST
Content Type: application/json
Body:
{
"location": "Alfonso Adventure Park",
"capacity": 15,
"costPerMinute": 1.5
}All these fields are required
-
location: The address (1-100 characters) -
capacity: Number of parking spots (Minimum 1) -
costPerMinute: Decimal. Can be 0.
Response:
201 Created
{
"id": 2,
"lotId": "PK-498E09-1780654212111",
"location": "Alfonso Adventure Park",
"capacity": 15,
"occupiedSpaces": 0,
"availableSpaces": 15,
"costPerMinute": 1.5,
"full": false
}400 Bad Request
{
"status": 400,
"message": "Validation failed",
"errors": [
{
"field": "capacity",
"message": "Capacity is required"
},
{
"field": "location",
"message": "Location is required"
},
{
"field": "costPerMinute",
"message": "Cost per minute is required"
}
]
}Endpoint: /api/v1/parking-lots/{id}
Method: GET
Path Variable:
id: ID of the parking lot
Response:
200 OK
{
"id": 2,
"lotId": "PK-498E09-1780654212111",
"location": "Alfonso Adventure Park",
"capacity": 15,
"occupiedSpaces": 0,
"availableSpaces": 15,
"costPerMinute": 1.5,
"full": false
}422
{
"message": "Parking lot not found"
}Check-in/out from a parking lot and view vehicles parked.
Endpoint: /api/v1/parking/check-in
Method: POST
Content Type: application/json
Body:
{
"parkingLotId": 2,
"licensePlate": "XYZ123"
}All these fields are required
-
parkingLotId: ID of the parking lot -
licensePlate: License plate of the vehicle
Response:
200 OK
{
"ticketNumber": "TN-20260605-13F68F",
"licensePlate": "XYZ123",
"lotId": "PK-498E09-1780654212111",
"checkInAt": "2026-06-05 18:13:16",
"checkOutAt": null,
"cost": null
}400
{
"message": "Vehicle is already parked"
}Endpoint: /api/v1/parking/check-out
Method: POST
Content Type: application/json
Body:
{
"ticketNumber": "TN-20260605-DDD7E5"
}ticketNumber: The ticket number generated after checking in
Response:
200 OK
{
"ticketNumber": "TN-20260605-DDD7E5",
"licensePlate": "XYZ123",
"lotId": "PK-2418B2-1780654982739",
"checkInAt": "2026-06-05 18:23:11",
"checkOutAt": "2026-06-05 18:25:16",
"cost": 3.0
}409
{
"message": "Vehicle has already checked out"
}