DEV Community

Olive Lawal
Olive Lawal

Posted on

Passion Pulse: A Dockerized Java 21 Microservice Powered by Google Gemini AI

This is a submission for Weekend Challenge: Passion Edition

What I Built

I built Passion Pulse APIβ€”a lightweight, containerized Java 21 microservice. You send it a piece of text about something you love, and it uses Google's Gemini 3.5 Flash AI to analyze your words, give your passion a score out of 100, and generate a custom "hype comment."
As someone transitioning from IT Ops to DevOps, my true passion right now is infrastructure. So, I didn't build a UI. I built a backend API, wrapped it in a multi-stage Docker container, and made sure the AI API key is securely injected via environment variables.

Demo

Terminal output demonstrating a successful API call. A curl POST request sends a text about coding to the Passion Pulse API, which responds with a JSON object containing a passionScore of 98 and a customized hypeComment from Google Gemini AI

Code

{{ github https://github.com/OJCodeCanvas/passion-pulse-api }}

How I Built It

I wanted to stick to my current learning path, so I built this using Java 21 (specifically using Recordsfor clean data transfer) and Spring Boot 3.2's new RestClient.
The Tech Journey:
Integration: I used the gemini-flash-latestendpoint. Google has been rapidly deprecating their 1.5 and 2.5 models, so using the auto-updating alias ensures the app routes to the newest GA model without breaking!
Parsing: Instead of brittle string manipulation, I used Spring's built-in Jackson ObjectMapper to safely extract the JSON payload from Google's deeply nested API response.
DevOps Focus: I wrote a multi-stage Dockerfile(Maven build phase -> JRE Alpine runtime phase) to keep the final image as tiny as possible.
Security: The app requires a Gemini API key, but I configured it to read from ${GEMINI_API_KEY}. You pass the key at runtime via docker run -e ... so it never touches the source code or Git history.

Prize Categories

Best Use of Google AI (I used the Gemini 3.5 Flash model via the native REST API to evaluate the user's text and generate the creative response JSON)

Top comments (0)