The application
Screenshots
Select an image to view it larger.
The need
Problem
Users submit disagreements and petty dilemmas for humorous courtroom rulings. Making that simple interaction reliable in a public serverless app meant handling variable model responses, bounded conversation context, input validation, provider failures, shared state, and verdicts that agree with the UI.
The build
Engineering approach
I built the React frontend on Azure Static Web Apps and a same-origin Python Azure Functions backend that calls Google GenAI. Credentials stay server-side; the backend validates input, bounds conversation history, and handles timeouts and provider errors. PostgreSQL holds the deployment-wide case counter outside serverless function memory.
After free-form replies proved brittle, I moved the model to structured verdict, ruling, and consequence fields. Python validates those fields and owns the final response structure; React derives the YTA/NTA badge from the validated verdict. User messages are treated as case material.
The result
Outcome
The app is live in production, turning submitted dilemmas into conversational courtroom rulings. Its validated verdict drives the displayed badge, and PostgreSQL keeps the case counter shared across serverless instances.
Looking back
Lessons & growth
Free-form model output is a poor application contract; validated fields are safer than parsing prose. External AI providers need validation and failure handling, and user content needs a clear boundary from system instructions. Shared serverless state belongs in persistent storage; optional features should not block a ruling.