- Java 21
- Spring Boot 3.2.x
- PostgreSQL 16
- Flyway Migration
- Maven
- OpenAPI 3.0 / Swagger UI
- Spring Data JPA / Hibernate
- Lombok
- Docker & Docker Compose
Before you begin, ensure you have:
- Java 21+
- Maven
- Docker and Docker Compose
- PostgreSQL
This will start:
- PostgreSQL database (port 5432)
- SonarQube (port 9000)
- Access SonarQube:
- URL: http://localhost:9000
- Default credentials:
- Username: admin
- Password: admin
- Run SonarQube analysis:
mvn clean verify sonar:sonar \
mvn clean verify sonar:sonar \
-Dsonar.projectKey=gestao_vagas \
-Dsonar.host.url=http://localhost:9000 \
-Dsonar.login=your_sonar_token
obs: a sonar key é criada ao logar no sonarqube
- Clone the repository
git clone https://github.com/diegoporfirio01/gestao_vagas.git
- Navigate to the project directory
cd gestao_vagas
- Start PostgreSQL using Docker Compose
docker compose up -d
- Run the application
mvn spring-boot:run
The API documentation is available through Swagger UI. After running the application, access:
http://localhost:8080/swagger-ui/index.html
- Company registration
- Company profile management
- List all companies
- Candidate registration
- Profile management
- List all candidates
The application uses PostgreSQL with Flyway migrations for database versioning. Main tables:
-
companies
: Stores company information- id (UUID)
- name
- slug
- website
- password
- description
- created_at
- updated_at
-
candidates
: Stores candidate information- id (UUID)
- name
- username
- password
- description
- curriculum
- created_at
- updated_at
The API implements comprehensive validation for:
- Email formats
- Required fields
- Username patterns
- Password requirements
- Website format (for companies)
- Password encryption using BCrypt
- JWT Authentication
- Input validation and sanitization
- Unique constraints for emails and usernames
- Rate limiting
- CORS configuration
- Custom exception handling with proper HTTP status codes
POST /auth/login
- Authenticate userPOST /auth/refresh
- Refresh access token
POST /api/v1/companies
- Register a new companyGET /api/v1/companies
- List all companiesGET /api/v1/companies/{id}
- Get company detailsPUT /api/v1/companies/{id}
- Update companyDELETE /api/v1/companies/{id}
- Delete company
POST /api/v1/candidates
- Register a new candidateGET /api/v1/candidates
- List all candidatesGET /api/v1/candidates/{id}
- Get candidate detailsPUT /api/v1/candidates/{id}
- Update candidateDELETE /api/v1/candidates/{id}
- Delete candidate
# Application
spring.application.name=gestao_vagas
server.port=8080
# Database
spring.datasource.url=jdbc:postgresql://localhost:5432/gestao_vagas
spring.datasource.username=${DB_USERNAME:admin}
spring.datasource.password=${DB_PASSWORD:admin}
# JPA/Hibernate
spring.jpa.hibernate.ddl-auto=validate
spring.jpa.show-sql=false
spring.jpa.properties.hibernate.format_sql=true
# Flyway
spring.flyway.enabled=true
spring.flyway.baseline-on-migrate=true
# OpenAPI/Swagger
springdoc.api-docs.path=/api-docs
springdoc.swagger-ui.path=/swagger-ui.html
# Security
security.jwt.secret=${JWT_SECRET:your-secret-key}
security.jwt.expiration=3600000
The project includes Docker support with a docker-compose file for PostgreSQL:
services:
postgres:
container_name: gestao_vagas_postgres
image: postgres
ports:
5432:5432
environment:
POSTGRES_USER=admin
POSTGRES_PASSWORD=admin
POSTGRES_DB=gestao_vagas
This project implements a robust CI/CD pipeline using GitHub Actions and Docker for automated building, testing, and deployment.
- Automated builds on push to main branch
- Docker image creation and publishing
- Automated deployment to production
- Environment-specific configurations
- Continuous integration with test execution
name: Gestao de Vagas Application
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- Checkout code
- Setup Java 21
- Build project with Maven
- Login to Docker Hub
- Build and publish Docker image
deploy:
needs: build
runs-on: self-hosted
steps:
- Pull latest Docker image
- Deploy container with environment variables
The application is containerized using Docker for consistent deployment across environments:
FROM openjdk:21-jdk-slim
COPY target/*.jar app.jar
ENTRYPOINT ["java","-jar","/app.jar"]
The following environment variables are required for deployment:
DATABASE_URL
: Database connection URLDATABASE_USERNAME
: Database usernameDATABASE_PASSWORD
: Database passwordDATABASE_NAME
: Database nameDOCKER_USERNAME
: Docker Hub usernameDOCKER_PASSWORD
: Docker Hub password
- The pipeline is triggered on push to the main branch
- Maven builds and tests the application
- Docker image is built and pushed to Docker Hub
- The application is deployed to production server
- Environment variables are injected during container startup
Feel free to contribute to this project. Any contributions you make are greatly appreciated.
- 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
- Implement authentication and authorization
- Add job posting functionality
- Implement candidate application system
- Add search and filtering capabilities
- Implement email notifications
- Add role-based access control
- Implement API rate limiting
- Add caching mechanisms
- Implement file upload for resumes
- Add job matching algorithm
- Spring Boot Documentation
- PostgreSQL Documentation
- Swagger UI
- The Spring Boot Community
Made with ❤️ by Diego Porfirio