DayBook: A private AI journal that learns my friend habits, patterns, and help him improve, powered by Gemma
What We Built
Daybook began with a simple problem: a friend of ours who was already journaling, but most of the time, the entries just stayed there. He could write about a stressful day, a productive week, a bad habit, or something that kept coming up, but noticing those patterns across dozens of entries was almost impossible manually. So we built Daybook for him.
Daybook is a private AI journal that reads your entries locally and helps surface patterns in your habits, mood, routines, and thoughts over time. Instead of just storing what you write, it helps you understand what keeps showing up.
The important part is where this happens. Your journal never needs to leave your device. Daybook uses a local LLM, so the AI can work with your personal entries without sending them to a cloud AI service.
We wanted to build something that was genuinely useful to one person, while also answering a question we kept coming back to: Can AI be helpful with something as personal as journaling without requiring you to give away your data? Daybook is our attempt at an answer.
Demo
DayBook UI Demo
Note: Local AI features are not available in the deployed demo because DayBook runs AI locally using Ollama. The backend requires a running Ollama instance on port 11434.
Video Demo
Code: greenbugx / Daybook - A private AI journal that learns your habits, finds patterns, and helps you improve, powered by a local LLM with your data staying on‑device.
A local‑first AI journal that learns your habits, finds recurring patterns, and helps you reflect on what you could improve. Everything happens on your own machine. Your writing never leaves your computer, and the AI that reads it runs locally through Ollama, so there is no account to create, no key to paste, and no company holding a copy of your thoughts.
Table of Contents
- Screenshots
- What DayBook Does
- Requirements
- AI Model
- Installation
- Running DayBook
- How the Project Works
- Project Structure
- Database
- How AI Answers Questions
- Journal Images
- Session and Ownership State That Lives Only in Memory
- Frontend Details
- Backend Details
- API Reference
- Data on Disk
- Development
- Privacy
- Troubleshooting
- License
Screenshots
Home, Journal, Spread, Analytics, Goals, Calendar, Library
What DayBook Does
DayBook is built around a few simple habits that turn into something useful over time.
- Write a page a day.
- Each date has one journal entry with a topic…
How We Built It
We wanted Daybook to be useful with genuinely personal data, which made the usual “send it to an AI API” approach feel wrong for this project. So we built it local‑first from the beginning.
At the core is Gemma 3 4B, an open‑weight model running locally through Ollama. There is no OpenAI API, Gemini API, or hosted AI service sitting between the journal and the model. The whole stack lives on the user's machine:
flowchart LR
U["You, in a browser"] -->|"localhost:5173"| V["Vite dev server"]
V -->|"React app"| U
V -->|"proxies /api to 3001"| B["Fastify backend"]
B -->|"SQL, WAL mode"| D[("SQLite<br/>data/daybook.db")]
B -->|"local HTTP"| O["Ollama"]
O --> G["Gemma 3 4B"]
The frontend is built with React 19 and TypeScript, while the local backend handles application logic and communication with Ollama. Journal data and personal memories are stored locally using SQLite.
That separation was intentional. The application can use an LLM for things like identifying recurring habits, finding patterns across entries, and pointing out areas for reflection, while the actual data stays on the same machine.
When a user asks Daybook to analyze their journal, the request stays within that local stack:
Journal → Backend → Ollama → Gemma → Analysis → Daybook
That's what allows Daybook to look for recurring habits, patterns, wins, struggles, and areas for improvement without requiring a cloud AI API.
To run Daybook, we only need three local processes:
- React + TypeScript for the interface
- Local backend for application logic
- Ollama + Gemma 3 4B for AI analysis
No API key required.
What Daybook Can Actually Do
- Daily entries with topic, mood, weather, location, and a rich text editor
- Goals tied to a date, so you can see what you meant to do next to what you wrote about
- A reflection chat where you ask in plain language and get an answer grounded in your actual entries
- Per‑entry observations the AI generates after you save
- Memory suggestions you approve or dismiss, so nothing is remembered without your say‑so
- A streak that counts unbroken days honestly
- One image per entry, stored as a real file on your disk
- Saved quotes collected in a Library
- A profile built through onboarding that shapes how reflections are written
The AI is grounded, not creative
This was the part we spent the most time on. A journal AI that invents things is worse than useless, because you cannot trust what it tells you about your own life.
The system prompt carries 18 explicit rules. The model is told that its only source of truth is the context handed to it, that it must never invent entries, dates, goals, or statistics, that it must separate a one‑time observation from a recurring pattern, and that it must say plainly when there is not enough evidence. It is also told to avoid diagnosing anything about mental or physical health, and to respect a thingsToAvoidAssuming list the user fills in during onboarding.
Eight reflection intents decide how the model reads the context:
| Intent | Looks for |
|---|---|
| RECURRING_PATTERNS | The same thing showing up again |
| MOOD_EMOTIONAL | Mood and emotional tone |
| STRUGGLES | What keeps getting in the way |
| WINS_PROGRESS | Wins, progress, momentum |
| GOALS | Goal follow‑through |
| HABITS_ROUTINES | Routines and timing |
| CHANGE_OVER_TIME | How things shifted over time |
| SELF_UNDERSTANDING | What Daybook knows about you |
Questions that never reach the model
We route every question before it costs anything. If a question can be answered from the database, Daybook answers it with SQL and skips the model entirely.
- Ask how many entries you have written, or what your goals are, and you get an exact answer instantly.
- Only questions that genuinely need interpretation go to Gemma.
flowchart TD
Q["Your question"] --> ROUTE["classifyAiIntent"]
ROUTE -->|"quote"| DQ["Return today's quote"]
ROUTE -->|"streak"| DS["Return the streak"]
ROUTE -->|"goals"| DG["Read goals from SQL"]
ROUTE -->|"journal"| DJ["Read entries from SQL"]
ROUTE -->|"reflection, or anything else"| LLM["Ask Gemma"]
LLM --> INTENT["classifyReflectionIntent"]
INTENT --> CTX["buildAiContext<br/>entries, goals, profile,<br/>stats, memories, observations"]
CTX --> PROMPT["buildAiSystemPrompt<br/>18 grounding rules plus context"]
PROMPT --> RUN["Ollama generates the answer"]
RUN --> OUT["Answer with its intent label"]
This keeps answers exact where exactness matters, and spends model time only where interpretation is actually needed.
The streak is not AI
The streak is plain arithmetic over your entry dates. It converts dates to day numbers, ignores the future, returns zero unless you wrote today, then counts backwards while days are unbroken. If you skip a day, it ends there. No model, no guessing, no being generous with dates.
High‑Level System Architecture
flowchart TB
subgraph USER["User Machine - 100% Local"]
BROWSER["Browser<br/>localhost:5173"]
subgraph FRONTEND["Frontend - React 19 + TS + Vite + Tailwind 4"]
APP["App.tsx<br/>Routing and shared state"]
VIEWS["Views<br/>InteractiveBook / JournalBook<br/>Calendar / Goals / Library<br/>AnalyticsAI / Settings / Onboarding"]
APICLIENT["lib/api.ts<br/>Typed fetch wrapper for /api/*"]
end
subgraph BACKEND["Backend - Fastify :3001"]
RO
Comments
No comments yet. Start the discussion.