A Spring Boot microservice for managing volunteer need fulfillment and nominations in the Sunbird Serve platform.
- Volunteer need nomination management
- Fulfillment tracking and status updates
- Email notifications for nominations and status changes
- RESTful API with OpenAPI documentation
- PostgreSQL database integration
- Environment variable-based configuration
- Input validation with Bean Validation
- Proper CORS configuration
- Global exception handling
- Secure credential management
- Java 17 or higher
- Gradle 7.6.0 or higher
- PostgreSQL database
- SMTP server for email notifications
Copy the example environment file and configure your settings:
cp env.example .env
Edit .env
with your actual values:
# Database Configuration
DB_URL=jdbc:postgresql://your-db-host:5432/your-database
DB_USERNAME=your_db_username
DB_PASSWORD=your_secure_password
# External Service URLs
SERVE_URL=https://your-serve-url.com
SERVE_NEED_URL=https://your-need-service-url.com
SERVE_VOLUNTEERING_URL=https://your-volunteering-service-url.com
# Email Configuration
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=your_app_password
# CORS Configuration
CORS_ALLOWED_ORIGINS=http://localhost:3000,https://your-frontend-url.com
Create a PostgreSQL database and update the connection details in your environment variables.
# Build the application
./gradlew build
# Run in development mode
./gradlew bootRun
# Or run with specific profile
SPRING_PROFILES_ACTIVE=dev ./gradlew bootRun
# Build Docker image
docker build -t sunbird-serve-fulfill .
# Run with environment variables
docker run -p 8090:8090 \
-e DB_URL=jdbc:postgresql://host.docker.internal:5432/ev-vriddhi \
-e DB_USERNAME=postgres \
-e DB_PASSWORD=your_password \
sunbird-serve-fulfill
Once the application is running, access the Swagger UI at:
http://localhost:8090/api/v1/serve-fulfill/swagger-ui.html
- Never commit sensitive data to version control
- Use environment variables for all credentials
- Use different configurations for dev/staging/production
- Configure allowed origins based on your frontend URLs
- Avoid using
*
for production environments - Regularly review and update allowed origins
- All API endpoints validate input using Bean Validation
- Custom validation patterns for ID fields
- Proper error responses for validation failures
- Global exception handler provides consistent error responses
- Sensitive information is not exposed in error messages
- Proper logging for debugging without exposing secrets
./gradlew test
./gradlew check
- Set
SPRING_PROFILES_ACTIVE=prod
- Configure all required environment variables
- Use HTTPS for all external communications
- Set up proper monitoring and logging
- Configure database connection pooling
- Set up health checks
- Follow the existing code style
- Add tests for new features
- Update documentation as needed
- Ensure all security checks pass
[Add your license information here]