A robust and scalable backend REST API for a Job Portal application. This project is built using Spring Boot, Spring Security, and PostgreSQL, designed to manage job postings and user authentication efficiently.
- 🔐 User Authentication: Secure user registration with BCrypt password hashing.
- 📄 Job Management: Full CRUD capabilities for job posts.
- 🔍 Search Functionality: Search for jobs by keywords in the description or profile.
- 🛡️ Secure Endpoints: Role-based access control and secured API endpoints using Spring Security (Basic Auth).
- 💾 Database Integration: Persistent data storage using PostgreSQL and Spring Data JPA.
- ⚡ Fast & Efficient: Built on the latest Spring Boot 4 version.
| Component | Technology | Description |
|---|---|---|
| Language | Java 21 | Latest LTS version for modern features. |
| Framework | Spring Boot 4.0.2 | Rapid application development framework. |
| Database | PostgreSQL | Advanced open-source relational database. |
| Security | Spring Security | Authentication and access control. |
| ORM | Spring Data JPA | Abstraction over JDBC/Hibernate. |
| Tools | Lombok | Boilerplate code reduction. |
| Build Tool | Maven | Dependency management and build automation. |
src/main/java/com/aayush/springbootrest
├── config/ # Security and App configurations
├── controller/ # REST Controllers (API Endpoints)
├── model/ # JPA Entities (DB Tables)
├── repo/ # Data Access Layer (Repositories)
├── service/ # Business Logic Layer
└── SpringbootrestApplication.java # Main Entry PointEnsure you have the following installed:
- Java 21 SDK
- Maven
- PostgreSQL Database
-
Clone the Repository
git clone https://github.com/your-username/springbootrest.git cd springbootrest -
Database Setup
- Create a database named
SpringJDBCDemoin PostgreSQL. - The tables will be auto-generated by Hibernate (
ddl-auto=update).
- Create a database named
Edit src/main/resources/application.properties to match your local environment.
Note: The
application.propertiesfile is not included in the repository for security reasons. You must create it manually or use environment variables.
Example application.properties:
spring.application.name=springbootrest
# Database Configuration
spring.datasource.url=jdbc:postgresql://localhost:5432/SpringJDBCDemo
spring.datasource.username=your_postgres_username
spring.datasource.password=your_postgres_password
spring.datasource.driver-class-name=org.postgresql.Driver
# Hibernate Configuration
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true- Build and Run
Server started at:
mvn spring-boot:run
http://localhost:8080
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
POST |
/register |
Register a new user account | ❌ |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
GET |
/jobPosts |
Retrieve all job listings | ✅ |
GET |
/jobPost/{id} |
Get details of a specific job | ✅ |
POST |
/jobPost |
Create a new job post | ✅ |
PUT |
/jobPost |
Update an existing job post | ✅ |
DELETE |
/jobPost/{id} |
Remove a job post | ✅ |
GET |
/jobPosts/keyword/{keyword} |
Search jobs by keyword | ✅ |
GET |
/load |
Load dummy data (testing only) | ✅ |
Note: All protected endpoints require Basic Authentication (Username/Password).
The application enforces security using Spring Security:
- Authentication: Usage of
DaoAuthenticationProviderwithBCryptPasswordEncoder. - Authorization: All endpoints are secured by default (
authenticated()), enabling a secure-by-default approach. - CSRF: Disabled (typical for non-browser-based REST APIs).
- Session: Stateless session policy to support REST architecture.
Contributions are welcome!
- Fork the project.
- Create your feature branch (
git checkout -b feature/AmazingFeature). - Commit your changes (
git commit -m 'Add some AmazingFeature'). - Push to the branch (
git push origin feature/AmazingFeature). - Open a Pull Request.
Distributed under the MIT License. See LICENSE for more information.