DEV Community

Cover image for Personal Gemini Journal: A Secure AI Reflection App
Jidnya
Jidnya

Posted on

Personal Gemini Journal: A Secure AI Reflection App

🧠 Personal Gemini Journal: A Secure AI Reflection App with Gemini, Firebase & Cloud Run

Write β†’ Reflect β†’ Understand β†’ Act

I built Personal Gemini Journal as part of the Google Cloud Run AI Challenge.

Traditional journaling helps us record our thoughts, but it doesn't always help us understand them. I wanted to build a private AI-powered journaling experience where users can reflect, have meaningful conversations with AI, and turn their thoughts into actionable insights.

🎯 Problem Statement

Users often struggle with:

  • Understanding recurring thoughts
  • Identifying patterns in their reflections
  • Organizing complicated thoughts
  • Turning reflections into practical actions
  • Reviewing their personal growth
  • Keeping personal journal data private

Most AI chat applications also aren't designed around persistent, user-isolated reflection sessions.

πŸ’‘ Solution

Personal Gemini Journal combines private journaling with Google Gemini.

Users can create a reflection session and have a multi-turn conversation with Gemini. After reflecting, the application can generate structured insights from the complete session.

The core experience is:

Write β†’ Reflect β†’ Understand β†’ Act

✨ Key Features

πŸ’¬ Multi-Turn Gemini Conversations

Users can continue a contextual conversation with Gemini instead of receiving only a single AI response.

🧠 Reflection Insights

Gemini analyzes a completed reflection session and generates:

  • Key Insight β€” the central realization
  • Emotional Pattern β€” a strictly non-clinical observation
  • Recurring Theme β€” an important theme from the reflection
  • Action for Tomorrow β€” a practical next step
  • Growth Signal β€” a potential positive development or learning signal

✨ Session Synthesis

The Synthesis feature creates a higher-level understanding of the complete session, including:

  • Focus Title
  • Key Themes
  • Core Insight
  • Perspective
  • Actionable Takeaways

πŸ’Ύ Persistent Journal Sessions

Journal sessions and interactions are stored in Cloud Firestore, allowing users to:

  • Create multiple sessions
  • Reopen previous sessions
  • Continue conversations
  • Refresh the application
  • Sign out and sign back in
  • Access previous reflections

πŸ”Ž Search & Mood Filtering

Users can search previous reflections and organize them using mood categories.

πŸ“‹ One-Click Action Copy

The generated Action for Tomorrow can be copied instantly.

πŸ“€ Journal Export

Users can export their personal journal data as a JSON archive.

πŸ” Security

Privacy is a core part of the application because journal entries can contain personal information.

πŸ”‘ Firebase Authentication

Users authenticate through Firebase Authentication with Google Sign-In.

πŸ—„οΈ User-Isolated Firestore

Journal data is organized using Firebase UID-based paths:

/users/{uid}/sessions
/users/{uid}/interactions
/users/{uid}/insights
Enter fullscreen mode Exit fullscreen mode

Firestore Security Rules enforce that authenticated users can only access their own data.

πŸ”’ Server-Side Gemini API

Gemini requests are handled through the trusted Express backend.

The Gemini API key is kept server-side and is not hardcoded into frontend code.

πŸ” Secret Management

The deployment uses secure server-side secret handling with Google Cloud Secret Manager.

πŸ›‘οΈ Input Protection

The backend includes:

  • Request validation
  • JSON payload validation
  • Input length limits
  • Server-side sanitization

πŸ—οΈ Architecture

                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚      USER        β”‚
                    β”‚    BROWSER       β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚
                             β–Ό
                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                  β”‚   React Frontend    β”‚
                  β”‚ React + TypeScript  β”‚
                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚
               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
               β”‚                         β”‚
               β–Ό                         β–Ό
      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
      β”‚ Firebase Auth  β”‚       β”‚ Express Backend β”‚
      β”‚ Google Sign-In β”‚       β”‚      API        β”‚
      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜       β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                        β”‚
                                        β–Ό
                               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                               β”‚  Google Gemini  β”‚
                               β”‚                 β”‚
                               β”‚ Chat            β”‚
                               β”‚ Insights        β”‚
                               β”‚ Synthesis       β”‚
                               β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
               β”‚      Cloud Firestore        β”‚
               β”‚                             β”‚
               β”‚ UID-based private storage   β”‚
               β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

                         β”‚
                         β–Ό
                 Google Cloud Run
Enter fullscreen mode Exit fullscreen mode

πŸ”„ Application Flow

User
 β”‚
 β–Ό
Google Sign-In
 β”‚
 β–Ό
Private Dashboard
 β”‚
 β–Ό
Create Reflection
 β”‚
 β–Ό
Multi-Turn Gemini Conversation
 β”‚
 β–Ό
Save Session to Firestore
 β”‚
 β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
 β–Ό                  β–Ό
Reflection         Session
Insights           Synthesis
 β”‚                  β”‚
 β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          β–Ό
Actionable Takeaways
          β”‚
          β–Ό
Persistent Journal
Enter fullscreen mode Exit fullscreen mode

πŸ› οΈ Technology Stack

Technology Purpose
React 19 Frontend
TypeScript Application development
Tailwind CSS UI styling
Lucide React Icons
React Markdown AI response rendering
Express Backend API
Google Gemini AI reflection and analysis
@google/genai Gemini SDK
Firebase Authentication Google Sign-In
Cloud Firestore Persistent user data
Google Cloud Secret Manager Secret management
Google Cloud Run Deployment
Vite Frontend build
esbuild Backend bundling

☁️ Google Cloud Run

The application was deployed from Google AI Studio to Google Cloud Run.

Cloud Run Service

personal-gemini-journal
Enter fullscreen mode Exit fullscreen mode

Region

asia-southeast1
Enter fullscreen mode Exit fullscreen mode

Challenge Label

dev-tutorial=cloud-run-ai-challenge
Enter fullscreen mode Exit fullscreen mode

The Cloud Run deployment provides the production environment for the application, while the Express backend handles server-side Gemini requests.

πŸ§ͺ Testing & Verification

The application was tested for:

  • Google Sign-In
  • Multi-turn Gemini conversations
  • Firestore persistence
  • User data isolation
  • Reflection Insights
  • Session Synthesis
  • Search and filtering
  • Journal export
  • Reload persistence
  • Sign-out/sign-in persistence
  • Cloud Run deployment

🌐 Live Application

πŸš€ Live App:
https://personal-journal-491827.ai.studio

πŸ’» Source Code:
https://github.com/Jidnya-0926/personal-gemini-journal

πŸš€ Future Improvements

  • πŸ“Š Personal growth analytics
  • πŸ“ˆ Reflection trend visualization
  • 🧠 Long-term reflection pattern detection
  • πŸ” Semantic journal search
  • πŸ“± Enhanced mobile experience
  • πŸ“… Daily reflection reminders
  • πŸ—ΊοΈ Location-aware journal entries
  • πŸ”” External notifications

πŸ† Google Cloud Run AI Challenge

This project was built for the Google Cloud Run AI Challenge.

The application demonstrates how:

Google Gemini + Firebase Authentication + Cloud Firestore + Express + Google Cloud Run

can be combined to create a secure, authenticated and persistent AI application.

The focus was not just on connecting an AI model to a UI, but on building the surrounding architecture:

Authentication β†’ Authorization β†’ Data Isolation β†’ Secure API Access β†’ AI β†’ Persistent Experience

πŸ™Œ Final Thoughts

Personal Gemini Journal is designed to make journaling more than simply storing thoughts.

It helps users pause, explore what they're thinking, recognize meaningful patterns, and identify what they can do next.

Write. Reflect. Understand. Grow.


Top comments (0)