A Spring Boot microservice for managing volunteer needs and service coordination in the Sunbird ecosystem.
- Java 17 or higher
- PostgreSQL 12 or higher
- Gradle 7.6 or higher
-
Clone the repository
git clone <repository-url> cd sunbird-serve-need
-
Set up environment variables
cp env-template.txt .env # Edit .env with your database credentials
-
Run the application
# Development mode ./gradlew bootRun --args='--spring.profiles.active=dev' # Or using environment variable export SPRING_PROFILES_ACTIVE=dev ./gradlew bootRun
-
Access the application
- API Base URL:
http://localhost:9000/api/v1/serve-need/
- Swagger UI:
http://localhost:9000/api/v1/serve-need/swagger-ui.html
- API Base URL:
The application supports multiple environment profiles. See CONFIGURATION.md for detailed configuration instructions.
- dev: Development environment with debug logging
- prod: Production environment with optimized settings
- test: Testing environment with H2 in-memory database
Key environment variables:
DB_URL
: Database connection URLDB_USERNAME
: Database usernameDB_PASSWORD
: Database passwordSPRING_PROFILES_ACTIVE
: Active Spring profile
The application follows a layered architecture:
src/main/java/com/sunbird/serve/need/
βββ NeedService/ # Core need management
β βββ controllers/ # REST API endpoints
β βββ services/ # Business logic
β βββ repositories/ # Data access layer
βββ DeliverableService/ # Need deliverables management
βββ SearchAndDiscoveryService/ # Search and discovery features
βββ config/ # Configuration classes
βββ models/ # Domain models and DTOs
POST /need/raise
- Create a new needPUT /need/update/{needId}
- Update an existing needPUT /need/status/{needId}
- Update need status
GET /need/{needId}
- Get need by IDGET /need/
- Get needs by status with paginationGET /need/need-type/{needTypeId}
- Get needs by typeGET /need/user/{userId}
- Get needs by user
POST /need-deliverable/create
- Create need deliverablePUT /need-deliverable/update/{id}
- Update deliverableGET /need-deliverable/{needPlanId}
- Get deliverables by plan
# Run all tests
./gradlew test
# Run tests with specific profile
./gradlew test --args='--spring.profiles.active=test'
The application uses H2 in-memory database for testing to ensure fast and isolated test execution.
docker build -t sunbird-serve-need .
docker run -p 9000:9000 \
-e SPRING_PROFILES_ACTIVE=prod \
-e DB_URL=jdbc:postgresql://host.docker.internal:5432/serve-need \
-e DB_USERNAME=postgres \
-e DB_PASSWORD=password \
sunbird-serve-need
- Health endpoint:
GET /actuator/health
- Info endpoint:
GET /actuator/info
- Development: Console and file logging (
needLog-dev.log
) - Production: File logging only (
needLog-prod.log
) - Test: Console logging only
- β No authentication required - Easy setup for contributors
- β Swagger UI accessible - No login prompts
- β CORS enabled - All origins allowed
- β Open access - Perfect for development and testing
This is an open-source project designed for flexibility. For production deployment, see SECURITY.md for multiple security options:
- API Gateway Security (Recommended)
- Reverse Proxy with Authentication
- Environment-Based Security
- JWT Authentication (Advanced)
- π Transparency: Security through openness
- π§ Flexibility: Multiple deployment options
- π Documentation: Clear security guidance
- π€ Community: Easy contribution setup
We welcome contributions! Please see our contributing guidelines:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
- No authentication barriers for easy development
- Comprehensive documentation
- Clear configuration examples
- Test coverage requirements
This project is licensed under the terms specified in the LICENSE file.
For issues and questions:
- Check the CONFIGURATION.md for common issues
- Review the SECURITY.md for security guidance
- Review the API documentation at
/swagger-ui.html
- Check the application logs for error details
- Create a GitHub issue for bugs or feature requests
As an open-source project, we prioritize:
- Easy Onboarding: Contributors can start immediately
- Flexibility: Users choose their security approach
- Transparency: Security through openness
- Documentation: Clear guidance for all use cases
- Community: Welcoming environment for contributions
This approach follows open-source best practices while providing clear guidance for production deployments.