A containerized Java 21 microservice that uses Google's Gemini AI to analyze text and score how "passionate" the user is about a topic. Built for the DEV.to Weekend Challenge: Passion Edition.
As an IT Operations student pivoting to DevOps, I focused less on a fancy UI and more on the infrastructure:
- Java 21 Records: For clean, immutable data transfer objects.
- Spring Boot RestClient: For modern, fluent HTTP calls to the Gemini API.
- Environment Variables: The API key is strictly injected via Docker (
-e GEMINI_API_KEY=...), ensuring zero secrets are leaked in the source code. - Multi-Stage Docker Build: Minimizes the final image size by building with Maven, then copying only the
.jarto a lightweight Alpine JRE image. - Jackson JSON Parsing: Used Spring's built-in
ObjectMapperto safely parse the nested Gemini API response.
- Language: Java 21
- Framework: Spring Boot 3.2
- AI Model: Google Gemini 3.5 Flash (
gemini-flash-latest) - Containerization: Docker
- Build Tool: Maven
Prerequisites: Docker installed on your machine.
- Clone the repository:
git clone https://github.com/OJCodeCanvas/passion-pulse-api.git cd passion-pulse-api