Skip to content

Singheskan/JournalAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JournalAI — Personal Journal with Local AI

A self-hosted journaling app with local AI-powered theme extraction, weekly reflections, and handwriting OCR. Built with FastAPI + vanilla JS. All data stays on your machine.

Features

  • Markdown-based daily journal entries with auto-save
  • AI-powered theme extraction (Ollama, llama3.1:8b)
  • Handwriting OCR via camera/scan upload (Ollama, minicpm-v)
  • Full-text search across all entries
  • Weekly AI-generated reflections
  • Entry statistics and theme tracking
  • Multi-user support with cookie-based session auth
  • File-based storage (no database needed)
  • Export entries as markdown
  • Fully self-hosted and private

Prerequisites

  1. Python 3.8+
  2. Ollama — local AI inference engine
    # Install Ollama (see https://ollama.ai)
    curl https://ollama.ai/install.sh | sh
    
    # Pull required models
    ollama pull llama3.1:8b      # text (themes, reflections)
    ollama pull minicpm-v         # vision (handwriting OCR)
    
    # Start Ollama (if not already running)
    ollama serve

Installation

  1. Clone the repo:

    git clone git@github.com:Singheskan/JournalAI.git
    cd JournalAI
  2. Create a virtual environment and install dependencies:

    python3 -m venv venv
    source venv/bin/activate
    pip install -r requirements.txt

Running

  1. Ensure Ollama is running:

    ollama serve
  2. Start the server:

    cd backend
    python main.py
  3. Open http://localhost:8000 in your browser.

Usage

Writing Entries

  • The app opens to today's date
  • Start typing — entries auto-save after 2 seconds of inactivity
  • AI automatically extracts 3-5 themes from your entry

Navigation

  • Today: click "Go to Today" in the sidebar
  • Browse: click any date in "Recent Entries"
  • Prev/Next: arrow buttons in the editor header
  • Search: full-text search across all entries

Handwriting OCR (Scan)

  1. Click "Scan" in the header
  2. Pick a target date and upload a photo of handwritten text
  3. Preview the transcribed text
  4. Click "Add to Entry" to append it to the selected date's entry

Weekly Reflection

Click "Weekly Reflection" — AI analyzes your last 7 days and generates reflection questions.

Statistics

Click "Stats" for entry count, unique themes, and most common themes.

Project Structure

JournalAI/
├── backend/
│   ├── main.py            # FastAPI app, all API endpoints
│   ├── ai_service.py      # Ollama integration (themes, reflections, OCR)
│   ├── auth.py            # Session-based authentication
│   ├── storage.py         # File-based entry storage
│   ├── models.py          # Pydantic models
│   ├── process_entries.py # Entry processing utilities
│   └── test_reflection.py # Reflection tests
├── frontend/
│   └── index.html         # Single-page app (HTML + CSS + JS)
├── data/                  # Created at runtime, gitignored
│   └── users/<name>/      # Per-user entries and metadata
├── requirements.txt
├── .gitignore
└── README.md

API Endpoints

Method Endpoint Description
POST /api/register Register a new user
POST /api/login Log in
POST /api/logout Log out
GET /api/entry/{date} Fetch entry for a date
POST /api/entry/{date} Save entry (triggers theme extraction)
GET /api/entries List all entry dates with themes
GET /api/search?q={query} Full-text search
GET /api/themes Unique themes with counts
GET /api/reflection/weekly Generate weekly reflection
GET /api/stats Entry statistics
POST /api/ocr Transcribe handwritten text from image
GET /api/export Export all entries as markdown

Troubleshooting

Ollama Connection Issues

  1. Check if Ollama is running: ps aux | grep ollama
  2. Start it: ollama serve
  3. Verify models: ollama list
  4. Test: ollama run llama3.1:8b "Hello"

Port Already in Use

Change the port in backend/main.py:

uvicorn.run(app, host="0.0.0.0", port=8001)

License

MIT

About

MD Editor with AI features to help identifying patterns, scan hand-written notes, weekly/monthly/yearly reflections

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors