A Spring Boot application for managing volunteer services and user profiles.
- User Management (CRUD operations)
- Agency Management
- Volunteer Hours Tracking
- Email Notifications
- RESTful API with Swagger Documentation
- Java 17
- Spring Boot 3.2.1
- Spring WebFlux (Reactive programming)
- PostgreSQL (Database)
- Gradle (Build tool)
- Docker (Containerization)
- Swagger/OpenAPI (API Documentation)
- Java 17 or higher
- PostgreSQL 12 or higher
- Gradle 7.6 or higher
- Docker (optional)
- Copy the example environment file:
cp env.example .env
- Edit the
.env
file with your actual values:
# Database Configuration
DB_URL=jdbc:postgresql://localhost:5432/ev-vriddhi
DB_USERNAME=postgres
DB_PASSWORD=your_secure_password
# Email Configuration
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=your_app_password
# External Service Configuration
RC_SERVICE_URL=http://localhost:8081/api/v1/
Set the following environment variables:
export DB_URL=jdbc:postgresql://localhost:5432/ev-vriddhi
export DB_USERNAME=postgres
export DB_PASSWORD=your_secure_password
export MAIL_HOST=smtp.gmail.com
export MAIL_PORT=587
export [email protected]
export MAIL_PASSWORD=your_app_password
export RC_SERVICE_URL=http://your-service-url:8081/api/v1/
export JPA_SHOW_SQL=false
export INCLUDE_EXCEPTION=false
export INCLUDE_STACKTRACE=never
Variable | Description | Default | Required |
---|---|---|---|
DB_URL |
PostgreSQL connection URL | jdbc:postgresql://localhost:5432/ev-vriddhi |
Yes |
DB_USERNAME |
Database username | postgres |
Yes |
DB_PASSWORD |
Database password | - | Yes |
MAIL_HOST |
SMTP server host | smtp.gmail.com |
Yes |
MAIL_PORT |
SMTP server port | 587 |
Yes |
MAIL_USERNAME |
Email username | - | Yes |
MAIL_PASSWORD |
Email password/app password | - | Yes |
RC_SERVICE_URL |
External service base URL | http://localhost:8081/api/v1/ |
Yes |
JPA_SHOW_SQL |
Enable SQL logging | false |
No |
INCLUDE_EXCEPTION |
Include exception in error responses | false |
No |
INCLUDE_STACKTRACE |
Include stack trace in error responses | never |
No |
# Build the application
./gradlew build
# Run the application
./gradlew bootRun
# Build Docker image
docker build -t sunbird-serve-volunteering .
# Option 1: Run with .env file (Recommended)
docker run -p 9090:9090 \
--env-file .env \
sunbird-serve-volunteering
# Option 2: Run with individual environment variables
docker run -p 9090:9090 \
-e DB_URL=jdbc:postgresql://host.docker.internal:5432/ev-vriddhi \
-e DB_USERNAME=postgres \
-e DB_PASSWORD=your_password \
-e MAIL_HOST=smtp.gmail.com \
-e [email protected] \
-e MAIL_PASSWORD=your_app_password \
-e RC_SERVICE_URL=http://host.docker.internal:8081/api/v1/ \
sunbird-serve-volunteering
./gradlew test
# Unit tests only
./gradlew test --tests "*Test"
# Integration tests only
./gradlew test --tests "*IntegrationTest"
# Controller tests only
./gradlew test --tests "*ControllerTest"
./gradlew test jacocoTestReport
Once the application is running, you can access:
- Swagger UI: http://localhost:9090/api/v1/serve-volunteering/swagger-ui.html
- API Base URL: http://localhost:9090/api/v1/serve-volunteering/
- User Management:
/user/*
- Agency Management:
/agency/*
- Volunteer Hours:
/volunteer-hours/*
- All request models are validated using Bean Validation annotations
- Email format validation
- Phone number format validation
- Required field validation
- Global exception handler for consistent error responses
- Proper HTTP status codes
- Detailed error messages for debugging
- Security-conscious error responses (no sensitive data exposure)
- Environment variable-based configuration
- No hardcoded credentials
- Secure defaults for production
- Never commit credentials to version control
- Use environment variables for all sensitive configuration
- Enable HTTPS in production
- Implement proper authentication and authorization
- Regular security updates for dependencies
- Input validation on all endpoints
- Proper error handling without information leakage
- Structured logging with SLF4J
- Configurable log levels
- Separate log files for different environments
- Application health endpoint:
/actuator/health
- Database connectivity checks
- External service health monitoring
- Set all required environment variables
- Configure production database
- Set up email service
- Configure external service URLs
- Enable HTTPS
- Set up monitoring and alerting
- Configure backup strategies
- Set up CI/CD pipeline
# Production Docker run
docker run -d \
--name sunbird-volunteering \
-p 9090:9090 \
--env-file .env.production \
sunbird-serve-volunteering:latest
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Create an issue in the repository
- Contact the development team
- Check the API documentation
- v0.0.1-SNAPSHOT: Initial release with basic functionality