A Spring Boot REST API for managing Companies, Jobs, and Reviews, backed by PostgreSQL and fully Dockerized using docker-compose.
This project demonstrates:
- RESTful API design
- Spring Boot + Spring Data JPA
- Entity relationships (One-to-Many, Many-to-One)
- PostgreSQL integration
- Docker & Docker Compose setup
- Clean layered architecture (Controller → Service → Repository)
SpringBootJobApplicationApp
├── src
│ ├── main
│ │ ├── java/com/springboot/jobapp
│ │ │ ├── company
│ │ │ │ ├── impl
│ │ │ │ │ └── CompanyServiceImpl.java
│ │ │ │ ├── Company.java
│ │ │ │ ├── CompanyController.java
│ │ │ │ ├── CompanyRepository.java
│ │ │ │ └── CompanyService.java
│ │ │ ├── job
│ │ │ │ ├── impl
│ │ │ │ │ └── JobServiceImpl.java
│ │ │ │ ├── Job.java
│ │ │ │ ├── JobController.java
│ │ │ │ ├── JobRepository.java
│ │ │ │ └── JobService.java
│ │ │ ├── review
│ │ │ │ ├── impl
│ │ │ │ │ └── ReviewServiceImpl.java
│ │ │ │ ├── Review.java
│ │ │ │ ├── ReviewController.java
│ │ │ │ ├── ReviewRepository.java
│ │ │ │ └── ReviewService.java
│ │ │ └── JobappApplication.java
│ │ └── resources
│ │ └── application.properties
├── docker-compose.yaml
├── pom.xml
├── mvnw
├── mvnw.cmd
└── README.md
One Company can have:
- Many Jobs
- Many Reviews
Each Job belongs to one Company
Each Review belongs to one Company
Entity relationships are managed using JPA annotations.
- Java 21
- Spring Boot
- Spring Web
- Spring Data JPA
- PostgreSQL
- Hibernate
- Docker & Docker Compose
- Maven
Make sure you have:
- Docker
- Docker Compose
Create a .env file in the project root:
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=jobappdbdocker-compose up -dThis will start:
- PostgreSQL
- pgAdmin
- Spring Boot Job Application
| Service | URL |
|---|---|
| Spring Boot API | http://localhost:8080 |
| pgAdmin | http://localhost:5050 |
| PostgreSQL | localhost:5432 |
| Method | Endpoint | Description |
|---|---|---|
| GET | /companies |
Get all companies |
| GET | /companies/{id} |
Get company by ID |
| POST | /companies |
Create a company |
| PUT | /companies/{id} |
Update a company |
| DELETE | /companies/{id} |
Delete a company |
Create Company
POST /companies{
"name": "Google",
"description": "Tech Company"
}| Method | Endpoint | Description |
|---|---|---|
| GET | /jobs |
Get all jobs |
| GET | /jobs/{id} |
Get job by ID |
| POST | /jobs |
Create a job |
| PUT | /jobs/{id} |
Update a job |
| DELETE | /jobs/{id} |
Delete a job |
Create Job
POST /jobs{
"title": "Backend Developer",
"description": "Spring Boot Developer",
"minSalary": "80000",
"maxSalary": "120000",
"location": "Remote"
}| Method | Endpoint | Description |
|---|---|---|
| GET | /companies/{companyId}/reviews |
Get all reviews |
| GET | /companies/{companyId}/reviews/{reviewId} |
Get review |
| POST | /companies/{companyId}/reviews |
Add review |
| PUT | /companies/{companyId}/reviews/{reviewId} |
Update review |
| DELETE | /companies/{companyId}/reviews/{reviewId} |
Delete review |
Add Review
POST /companies/1/reviews{
"title": "Great Place",
"description": "Amazing work culture",
"rating": 4.5
}This project uses Springdoc OpenAPI to provide interactive API documentation via Swagger UI.
Swagger automatically generates API documentation from the Spring Boot controllers and allows testing endpoints directly from the browser.
Once the application is running, access Swagger UI at:
http://localhost:8080/swagger-ui/index.html
- View all available REST endpoints
- Test API requests (GET, POST, PUT, DELETE) directly from the UI
- Inspect request/response schemas and HTTP status codes
- OpenAPI 3.0 compliant documentation
- Spring Boot 3.x
springdoc-openapi-starter-webmvc-ui- Custom OpenAPI configuration for project metadata (title, description, version)
Controller
↓
Service
↓
Repository
↓
Database (PostgreSQL)
- Controller → Handles HTTP requests
- Service → Business logic
- Repository → Database access
- Entity → JPA mapped objects
- Image:
postgres:latest - Port:
5432
- Image:
dpage/pgadmin4 - Port:
5050
- Built locally using Dockerfile
- Port:
8080
spring.jpa.hibernate.ddl-auto=updateautomatically updates DB schema- Circular references avoided using
@JsonIgnore - Constructor-based dependency injection is used
- REST API follows standard HTTP status codes