Medication Service is a full-fledged SpringBoot microservice for maintaining a set of medications and related diseases
Type | Spring REST microservice |
Java Version | 11 |
Spring Boot | 2.5.6.RELEASE |
Authentication | Basic Authentication |
Persistence | SQLite |
Providing a better search capability for a set of medications and the diseases related is quite challenging. While persisting the related data, target is to provide a robust interface to do full text searches
REST Endpoint | Description |
---|---|
GET /medications |
For a given search term find the related medications |
PUT /medications |
Create / modify medications |
- Comprehensive API documentation is available via swagger (
<HOST_URL>/swagger-ui/index.html
) - Postman collection is available on path
/postman
- NOTE: API will require basic authentication
One step local orchestration script is provided for running the service locally. Docker is required.
Usage: ./infrastructure/scripts/start.sh -p port -u username -e password
-p Port for running the service
-u Username of the authenticated user - mandatory
-e Password of the authenticated user - mandatory
Issue following commands from root folder of the project. Needs to have environment variables exposed. refer: Environment Variables
- use
./gradlew build
to build the project. Will require java 11 and gradle. - use
./gradlew bootRun
to execute the program.
Issue following commands from root folder of the project
- Build :
docker build -t <image-name> -f infrastructure/docker/Dockerfile .
- Run:
docker run -e USER_NAME=<user_name> -e PASSWORD=<password> -p 8080:8080 -td <image-name>
Following environment variables will be used by the service.
Variable Name | Description |
---|---|
USER_NAME |
Authenticated user name |
PASSWORD |
Authenticated user password |
- SQLite database
- Custom SQL dialect as default dialect is not supported due to SQLite limitations
- Hibernate as the ORM (persistence framework)
- JDK 11 is required for development
- SpringBoot 2.5.6
- Gradle - refer the build.gradle for configurations
- Swagger - Swagger:2.0
- Available on path: <HOST_URL>/swagger-ui/index.html
Utilize unit and functional test to provide proper test harness.
- Junit5 framework with Mockito for mock support
- Execute the tests via
./gradlew test
- Coverage report will be generated upon successful completion
- JaCoCo is used for code coverage generation
- Use
./gradlew jacocoTestReport
command to generate the coverage report (report can be found in./build/coverage
) - Rest Assured is used for functional testing
- Project is version controlled and available in GitHub
- Automated Build pipeline for build and test the service
- CodeCov is used for coverage analysis and PR checks
- Add Swagger UI for API interactions
- Migrate to undertow from tomcat server
- Configure Log4j2 Async logging
- Improve security (token based, user controller)
- Improve data persistence ( Postgres or MySQL database )
- Static code analysis integration
- Cloud deployment configuration (kube) and infrastructure versioning (Helm)
- Initialization - https://start.spring.io/
- Swagger - http://springfox.github.io/springfox/docs/current/
- SQLite with JPA - https://www.baeldung.com/spring-boot-sqlite
- SQlite FTS - https://www.sqlite.org/fts3.html