A production-style REST API backend for managing parking lots, slot booking, vehicle check-in/check-out, fare calculation, and revenue reporting.
Built with Java 17 + Spring Boot 3 + MySQL.
| Layer | Technology |
|---|---|
| Language | Java 17 |
| Framework | Spring Boot 3.2 |
| ORM | Hibernate + Spring Data JPA |
| Database | MySQL 8 |
| Build Tool | Maven |
| API Testing | Postman |
- Create and manage parking lots and slots
- Vehicle check-in with automatic slot assignment
- Vehicle check-out with fare calculation (rounded up per hour)
- Different rates for two-wheelers (₹20/hr) and four-wheelers (₹40/hr)
- Payment recording (Cash / Card / UPI)
- Real-time slot availability checking
- Admin daily revenue report
- Global exception handling with meaningful HTTP status codes
- Full transactional integrity — slot and booking always in sync
parking_lots → lot details (name, location, capacity)
parking_slots → individual slots per lot (type, status)
vehicles → registered vehicles (number plate, type)
bookings → check-in/check-out records with fare
payments → payment per completed booking
- Java 17
- MySQL 8
- Maven
- Clone the repository
git clone https://github.com/YOUR_USERNAME/parking-management.git
cd parking-management- Create the database
CREATE DATABASE parking_db;- Update
src/main/resources/application.properties
spring.datasource.username=root
spring.datasource.password=YOUR_PASSWORD- Run the application
mvn spring-boot:runAPI is available at http://localhost:8080
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/lots |
Create a parking lot |
| GET | /api/lots |
Get all lots |
| GET | /api/lots/{id} |
Get lot by ID |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/slots |
Add a slot to a lot |
| GET | /api/slots/availability?lotId=&vehicleType= |
Check available slots |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/bookings/checkin |
Vehicle check-in |
| POST | /api/bookings/checkout |
Vehicle check-out + payment |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/admin/revenue?date= |
Daily revenue report |
@Transactional on check-in and check-out — slot status and booking record are always updated atomically. If anything fails, both roll back together.
Fare rounding — duration is rounded up to the next full hour using
Math.ceil(). 1hr 10min = 2 hours billed. Matches real-world parking behavior.
DTO separation — entities are never exposed directly from controllers. Request and response shapes are fully decoupled from the database model.
Global exception handling — every known failure returns a structured JSON error with the correct HTTP status code (400, 404, 409) instead of a raw 500.
- JWT authentication (admin vs user roles)
- Monthly revenue reports
- Pre-booking / slot reservation in advance
- Docker containerization
- Kafka event publishing on check-in/check-out
- Redis caching for slot availability