AI & Privacy · Meet the Builders

Journal Atelier: Building a Secure, Private "Personal Gemini Journal" on Google Cloud

🛠️ Google Tech Stack & Security Architecture
Google Gemini 3.6 Flash Google Cloud Run Cloud Firestore Firebase Authentication Secret Manager reCAPTCHA v3 App Check Recharts Visualizations Telegram Bot API PBKDF2-SHA256 Encryption

🔐 The Inspiration: Why "AI Journaling" Makes Us Nervous

Journaling is one of the most deeply personal things a human being does. It is where we confess private fears, document delicate milestones, and explore unpolished thoughts. The moment you type a private reflection into an AI text box, an honest question immediately surfaces:

"Where does this text go, who has access to it, and what holds the key?"

Too many AI applications answer that question poorly—shipping model API keys to client browsers, storing entries in unisolated buckets, or quietly using private reflections as training or prompt injection surfaces. But privacy is only half the problem. The other half is what we wished a digital journal could do: not just hold isolated entries, but surface how a mood or a theme evolves over weeks, and give half-formed ideas somewhere meaningful to grow.

I built Journal Atelier for the Google Cloud GenAI Academy (APAC) — Cohort 3 Ideathon Challenge (#AccelerateAIwithCloudRun) to prove the opposite is achievable on Google Cloud: an AI journal that is genuinely insightful and verifiably private.

🛡️ Security-First Guarantee: Every architectural choice started from a threat model. The Gemini API key never leaves Google Cloud Secret Manager on Cloud Run, every entry is isolated to its owner's verified uid via Firebase Authentication and Firestore Security Rules, and model outputs are treated as untrusted data before reaching the DOM.

📸 Feature Walkthrough & Real App Interface

Below is a visual walkthrough of Journal Atelier's core user interface surfaces captured directly from the live application, showing how reflective conversation, longitudinal analytics, AI project engineering, and privacy controls work together in harmony.

1. Reflective Journal Editor & Multi-Agent Synthesis

Journal Atelier Reflective Editor and Multi-Agent Reflection Summary Cards
📸 Reflective Journal Editor: Writing an entry, conversing with Gemini 3.6 Flash, and viewing 1-click synthesized cards from Reflection, Sentiment, Pattern, and Coach specialist agents.

2. Longitudinal Mood & Sentiment Trends Dashboard

Journal Atelier Live Trends Dashboard with Recharts Mood Timeline
📸 Live Trends Dashboard: Interactive emotional valence timeline, 30-day sentiment tallies, coverage statistics, and click-to-filter mood cards computed entirely in-browser.

3. Personal Screen-Privacy PIN Lock & Masked Entry Protection

Journal Atelier Live Personal PIN Privacy Lock Screen and Masked Entries
📸 Live Privacy Lock Screen: Active entry locking featuring top lock bar ("This entry is locked"), center PIN unlock button, and masked sidebar entry titles ("Personal Feelings Reflection [Locked]", "Navigating Unexpected Stock Market Loss [Locked]") backed by browser PBKDF2-SHA256 hashing.

4. AI Project Studio: Project Stage Lifecycle & Build Specs

Journal Atelier AI Project Studio Surface and Provider-Agnostic Build Spec Export
📸 AI Project Studio: Turning seed ideas into structured AI project concepts (GastroChronicle Historic Recipe Synthesizer), refining with Gemini, tracking lifecycle stages, and exporting provider-agnostic Markdown build specs.

🏛️ System Architecture: Three Integrated Surfaces

Journal Atelier is built around three complementary surfaces, bridging personal reflection, longitudinal analytics, and creative engineering:

Surface Core Capability Privacy & AI Implementation
✍️ Journal Editor & Chat Multi-turn reflective dialogue with Gemini, 30s debounced autosave, & 1-click multi-agent synthesis. Context-preserving chat over server-side Gemini 3.6 Flash; entry text bound to token-derived uid with optimized 30s Firestore write batching.
📈 Trends Dashboard Longitudinal mood timelines, 30-day sentiment tallies, & coverage metrics. Computed 100% in-browser via Recharts from already-loaded user entries. Zero new server endpoints or data exposure.
💡 AI Project Studio Turns half-formed journal ideas into structured project build specs with stage lifecycle tracking. Multi-agent ideation pipeline generating provider-agnostic Markdown specs with stage progression (Seed Idea → Concept → Build Spec → Deployed).
flowchart TB subgraph Client["Client Tier (React + Vite + TypeScript)"] UI["Journal Editor / Trends / Project Studio"] AUTH["Firebase Auth (Google Sign-In)"] PIN["Personal PIN (PBKDF2-SHA256 Hash)"] APPCHECK["reCAPTCHA v3 App Check Attestation"] end subgraph Server["Backend Tier (Google Cloud Run · server.ts)"] API["Express API Server"] VERIFY["Firebase Admin verifyIdToken"] FALLBACK["Gemini Resilient Fallback Ladder
(3.6 Flash → 3.1 Flash-Lite → 3.7 Flash)"] SAN["OWASP LLM01 / A03 Sanitizer"] end subgraph GCP["Google Cloud Managed Infra"] SM["Secret Manager (GEMINI_API_KEY)"] FS["Cloud Firestore (/users/{uid}/interactions)"] TG["Telegram Bot API (Outbound Summaries)"] end UI -- "Bearer JWT + AppCheck Token" --> API API --> VERIFY API <--> SM API <--> FALLBACK API <--> FS API -- "Sanitized Metadata Only" --> TG
📊 Security & System Architecture: Client authentication, Cloud Run server-side key isolation, Gemini fallback ladder, and owner-bound Firestore security rules.

🧠 Multi-Agent Reflection Brain: 4 Specialist Agents

When a user requests a reflection synthesis on a journal entry, Journal Atelier does not send a plain prompt. Instead, the server routes the text through a 4-agent multi-agent pipeline orchestrated behind a single /api/reflect endpoint:

sequenceDiagram participant U as User (React UI) participant S as Cloud Run (server.ts) participant A as Firebase Admin Auth participant G as Gemini 3.6 Flash participant F as Cloud Firestore U->>S: POST /api/reflect (Bearer JWT + Entry Content) S->>A: verifyIdToken(idToken) A-->>S: Verified uid par 4-Agent Reflection Pipeline S->>G: 1. Reflection Agent (Title & Summary) S->>G: 2. Sentiment Agent (Valence & Mood Tag) S->>F: Query /users/{uid}/interactions (Historical Context) F-->>S: User History S->>G: 3. Pattern Agent (Recurring Themes) S->>G: 4. Coach Agent (Growth Question) end S->>F: Save /users/{uid}/interactions/{id} S-->>U: Synthesized Reflection Cards
🔄 Multi-Agent Reflection Sequence: Token verification, parallel agent execution, history-bound pattern matching, and Firestore persistence.

💡 AI Project Studio: Project Stage Lifecycle & Refinement

Reflective journaling and software building frequently start from the same place: a half-formed idea written down late at night. The AI Project Studio surface provides an explicit bridge between personal reflection and software execution.

Users enter a raw seed idea (or click "Surprise Me" to generate one). The server routes the prompt through four ideation specialists behind /api/ideate:

  1. Idea Agent: Formulates a clear project title, target problem statement, and 1-line elevator pitch.
  2. Capability Agent: Recommends specific AI capabilities (e.g. Multimodal Vision, Structured JSON Output, Vector RAG) constrained strictly to a server-side allowlist.
  3. Blueprint Agent: Outlines the recommended system architecture, data models, and API endpoints.
  4. First-Step Agent: Generates concrete, executable setup steps to launch the prototype.

Existing project ideas can be refined with custom instructions (via /api/ideate/refine) and tracked through active project lifecycle stages (Seed Idea → Concept Architecture → Prototype Spec → In Build → Deployed) directly inside history—updating existing documents rather than creating duplicate entries.

📄 Provider-Agnostic Build Spec Export: Once refined, a project idea can be saved to history and exported as a complete, provider-agnostic Markdown build specification—ready to hand straight to Gemini, Claude, OpenAI, or local Ollama models in your favorite IDE.

🛡️ Rigorous Threat Modeling & Hardened Defenses

To ensure Journal Atelier satisfies strict security audits, the architecture implements defense-in-depth across five key threat vectors:

Threat Vector Attack Surface Hardened Architectural Defense
API Key Exposure Client-side bundle inspection or network proxying. GEMINI_API_KEY is held exclusively in Cloud Secret Manager on Cloud Run. Zero keys exist in client code.
Cross-Tenant Leaks Direct Firestore access or forged user IDs. Firestore Security Rules enforce request.auth.uid == userId. Backend endpoints verify JWTs via Firebase Admin SDK.
Indirect Prompt Injection Malicious instructions inside user journal entries (OWASP LLM01). User text is delimited inside <journal_entry> tags and treated purely as data, never as system instructions.
XSS & Malicious Markdown Rendered AI output containing script tags or javascript: links (OWASP LLM05 / A03). react-markdown strips script, iframe, img, svg elements, and blanks non-HTTPS link protocols.
Shoulder Surfing Visual inspection on shared or unlocked devices. Screen-privacy PIN lock backed by PBKDF2-SHA256 (100,000 iterations) client-side hashing; entry text masked in UI.

📲 Outbound-Only Telegram Summaries & Instant Entry Alerts

Journal Atelier supports optional Telegram notifications so users can receive instant reflection summaries, saved entry alerts, saved project specs, or an on-demand weekly digest on their phones.

Journal Atelier Telegram Notifications Modal
📲 Telegram Integration Panel: Configuring Chat ID, managing connection status, and triggering on-demand weekly reflection digests directly inside Journal Atelier.
Journal Atelier Real Telegram Bot Push Notifications
💬 Live Telegram Bot Push Alerts: Receiving instant saved project specs and weekly reflection summaries directly inside the Telegram chat app.

To protect user privacy, the notification endpoints (/api/notify/entry-saved, /api/notify/project-saved, /api/notify/weekly-digest) are strictly outbound-only and closed-loop:

🚀 Key Takeaways & Live Links

Journal Atelier demonstrates that building with generative AI does not require sacrificing user privacy or architectural rigor. By pairing Google Cloud Run, Secret Manager, Firebase Auth, and Cloud Firestore with Gemini 3.6 Flash, developers can create deeply personal, multi-agent AI applications that users can trust completely.