Validation Service is a Spring Boot application designed to handle multiple validations using various providers. The application follows Hexagonal Architecture principles and leverages Java 17 features.
- Multiple validations:
- Email format validation
- Disposable email check
- MX record check
- reCAPTCHA v2 and v3 validation
- Phone number validation
- Centralized configuration for validation providers.
- Logging of requests, responses, and exceptions.
- Java 17
- Spring Boot
- Maven
- Docker
- Hexagonal Architecture
- Java 17
- Maven 3.6+
- Docker
- Clone the repository:
git clone /~https://github.com/cemonal/validation-service.git cd validation-service
- Build the project:
mvn clean install -DskipTests
- Build the Docker image:
docker build -t validation-service .
- Run the Docker container:
docker run -p 9090:8080 validation-service
The application uses application.yml
for configuration:
springdoc:
api-docs:
path: /api-docs
swagger-ui:
path: /swagger-ui.html
enabled: true
recaptcha:
v2Endpoint: 'https://www.google.com/recaptcha/api/siteverify'
v2SecretKey: 'your-recaptcha-v2-secret-key'
v3Endpoint: 'https://www.google.com/recaptcha/api/siteverify'
v3SecretKey: 'your-recaptcha-v3-secret-key'
v3ScoreThreshold: 0.5
allowedIps:
- '*'
-
Email Validation Endpoint
- URL:
/api/v1/email-validation
- Method:
POST
- Request Body:
{ "email": "test@example.com" }
- Response:
{ "success": true, "messages": [] }
- URL:
-
reCAPTCHA v2 Validation Endpoint
- URL:
/api/v1/recaptcha/validate
- Method:
POST
- Request Body:
{ "provider": "recaptchav2", "token": "your-recaptcha-token", "context": { "remoteip": "user-ip-address" } }
- Response:
{ "success": true, "messages": [] }
- URL:
-
reCAPTCHA v3 Validation Endpoint
- URL:
/api/v1/recaptcha/validate
- Method:
POST
- Request Body:
{ "provider": "recaptchav3", "token": "your-recaptcha-token", "context": { "action": "homepage" } }
- Response:
{ "success": true, "messages": [] }
- URL:
-
Phone Number Validation Endpoint
- URL:
/api/v1/phone-number-validation
- Method:
POST
- Request Body:
{ "phoneNumber": "+14155552671", "regionIso2": "US" }
- Response:
{ "success": true, "messages": [ "Valid phone number" ] }
- URL:
The application includes Swagger UI for API documentation. You can access it at /swagger-ui.html
.
We welcome contributions! If you would like to contribute, please fork the repository, create a new branch, make your changes, and open a pull request.
Thank you for your contributions!