🔐 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
uidvia 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
2. Longitudinal Mood & Sentiment Trends Dashboard
3. Personal Screen-Privacy PIN Lock & Masked Entry Protection
4. AI Project Studio: Project Stage Lifecycle & 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). |
(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
🧠 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:
- Reflection Agent: Synthesizes a concise 3-to-5 word title and reflective summary of the entry's core narrative.
- Sentiment Agent: Assigns emotional valence, confidence scores, and primary mood tags (e.g. Inspired, Anxious, Grateful, Determined).
- Pattern Agent: Queries the user's historical Firestore timeline (strictly bound to the verified
uid) to identify recurring long-term emotional themes over time. - Coach Agent: Formulates an open-ended, Socratic coaching question designed to prompt deeper personal growth on the next entry.
💡 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:
- Idea Agent: Formulates a clear project title, target problem statement, and 1-line elevator pitch.
- Capability Agent: Recommends specific AI capabilities (e.g. Multimodal Vision, Structured JSON Output, Vector RAG) constrained strictly to a server-side allowlist.
- Blueprint Agent: Outlines the recommended system architecture, data models, and API endpoints.
- 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.
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:
- Zero Inbound Surface: No webhooks, polling loops, or bot commands exist.
- Instant Entry-Saved Push: Saving or updating an entry triggers an instant alert with non-sensitive summary metadata (title, mood tag, word count).
- Summary Metadata Only: Notifications transmit only suggested titles, mood tags, and coaching questions. No raw journal entries, conversation text, or locked content ever leaves the server.
- SSRF Prevention: Outbound requests destination URL is hardcoded strictly to
https://api.telegram.org/bot<token>/sendMessage.
🚀 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.
🔗 Live Prototype: journal-atelier.ai.studio
💻 Source Code: github.com/leshweyeewin/journal-atelier