<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nawini on Medium]]></title>
        <description><![CDATA[Stories by Nawini on Medium]]></description>
        <link>https://medium.com/@na19wini?source=rss-60b060c35f5c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*OmsW_wsgRb0TBDW1</url>
            <title>Stories by Nawini on Medium</title>
            <link>https://medium.com/@na19wini?source=rss-60b060c35f5c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 15:54:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@na19wini/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Building a Secure AI Journal: Time Capsules & Mood Analytics with Gemini on Cloud Run]]></title>
            <link>https://medium.com/@na19wini/building-a-secure-ai-journal-time-capsules-mood-analytics-with-gemini-on-cloud-run-500b4587e330?source=rss-60b060c35f5c------2</link>
            <guid isPermaLink="false">https://medium.com/p/500b4587e330</guid>
            <category><![CDATA[gemini]]></category>
            <category><![CDATA[google-cloud-functions]]></category>
            <dc:creator><![CDATA[Nawini]]></dc:creator>
            <pubDate>Sun, 06 Sep 2026 18:07:33 GMT</pubDate>
            <atom:updated>2026-09-06T18:07:33.948Z</atom:updated>
            <content:encoded><![CDATA[<p>When building the Personal Gemini Journal for the Google Cloud Run AI Challenge, I wanted to go beyond a simple text-generation wrapper. The goal was to build a truly introspective, secure space that leverages AI to understand our emotions, while utilizing strict zero-trust security and cloud-native resilience.</p><p>Here is how I built a full-stack Vanilla JS and Express application, deployed on Google Cloud Run, featuring Contextual Mood Analytics and Future-Self Time Capsules.</p><h3>Architecture &amp; Security First</h3><p>Before writing the application logic, I established a strict security baseline. This isn’t just a prototype; it’s designed to protect personal data:</p><ul><li><strong>Zero Hardcoded Secrets:</strong> The Gemini API key is dynamically resolved at runtime using Google Cloud Secret Manager.</li><li><strong>Owner-Isolated Data:</strong> Cloud Firestore security rules strictly enforce request.auth.uid == userId at the database level.</li><li><strong>Defensive Parsing:</strong> The Express backend recursively strips undefined payloads and limits body sizes to prevent database crashes and DoS.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6XzjR062Xu7-UZY98G7VSw.png" /></figure><h3>Feature 1: Contextual Mood Analytics</h3><p>Instead of just chatting with an LLM, I utilized Gemini’s structured JSON schema generation (responseSchema) to act as an objective, empathetic psychologist.</p><p>When a user submits a journal entry, Gemini doesn’t just reply with text. It returns a strictly typed JSON object containing:</p><ol><li>An introspective reflection.</li><li>A quantitative Mood Score (1 to 10).</li><li>The Primary Emotion detected.</li><li>A customized array of topic tags.</li></ol><p>This structured data powers a real-time analytics dashboard, calculating average sentiment and tracking dominant emotions over time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*veUroph9jjdkFK75SaYqQQ.png" /></figure><h3>Feature 2: Future-Self Time Capsules</h3><p>Sometimes we need to write things down but aren’t ready to process them yet. The Time Capsule feature allows users to set a custom ISO 8601 unlock timestamp.</p><p>While the capsule is sealed, the backend isolates the data, and the client UI completely masks the raw text and the AI reflection, replacing it with an amber “Isolated Memory Vault” and a live ticking countdown clock.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q82oSY-IOFTfsvRvkpaVPg.png" /></figure><h3>Feature 3: The Resilient Fallback Ladder</h3><p>What happens when you run out of API credits or hit rate limits? I engineered a cascading 4-tier model fallback ladder (gemini-3.6-flash -&gt; gemini-3.1-flash-lite -&gt; gemini-flash-latest -&gt; gemini-3.7-flash).</p><p>If a primary model returns a recoverable error (like a 429 Resource Exhausted), the server automatically cascades down the ladder to fulfill the request without crashing. If all models fail, the frontend gracefully preserves the user’s draft and provides a “Retry Save” mechanism.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YHWeW3Hr1Tj482Bu4M_ezg.png" /></figure><p>Building this for the <strong>#AccelerateAIwithCloudRun</strong> challenge pushed me to deeply integrate AI Studio, Cloud Run, and Firebase into a cohesive, secure product.</p><p><strong>Source Code:</strong> <a href="https://github.com/naswini-na/personal-gemini-journal-na">naswini-na/personal-gemini-journal-na: A secure, introspective journaling platform featuring **Time Capsule isolation** and **Contextual Mood Analytics**, powered by the Google Gemini API, Express, Vanilla JavaScript, Firebase Auth, and Google Cloud Secret Manager.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=500b4587e330" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>