Skip to content

MfFischer/briefklar

Repository files navigation


πŸ“¬ BriefKlar

Scan any German letter. Know exactly what to do. Never miss a deadline.


Version Platform Electron License Made with ❀️


Germany sends letters for everything β€” taxes, courts, landlords, immigration. Each one has a deadline. Most consequences are permanent if you miss it. BriefKlar tells you what the letter is, what to do, and how long you have.


BriefKlar β€” Welcome screen




The Problem

Germany sends official letters that look like this:

"GemÀß § 355 Abs. 1 AO steht Ihnen gegen diesen Bescheid der Einspruch zu. Der Einspruch ist innerhalb eines Monats nach Bekanntgabe dieses Bescheids einzulegen."

For millions of immigrants, expats, and international students β€” this is unreadable. And the consequences of ignoring it are severe:

Letter Ignored for Result
Steuerbescheid 1 month You permanently lose the right to contest β€” even if the amount is wrong
Mahnbescheid 14 days Automatic enforcement order β€” bank accounts and wages can be seized
KΓΌndigung (employer) 21 days You permanently lose the right to contest your dismissal
AuslΓ€nderbehΓΆrde 4 weeks Residence permit decisions become final

BriefKlar solves this.


How It Works

πŸ“± Scan with phone  β†’  πŸ” OCR + classify  β†’  βœ… Plain-language explanation
  1. Open BriefKlar on your desktop β€” a QR code appears
  2. Scan the QR with your phone β€” a camera viewfinder opens
  3. Photograph your letter β€” align it to the A4 guide frame
  4. Get instant results β€” letter type, deadline, what to do, free help resources

Everything runs locally on your computer. No cloud. No account. No subscription.


Features

πŸ” Smart Classification with OCR Tolerance

Identifies 26 German letter types using weighted keyword scoring with fuzzy matching β€” handles OCR errors like "F1nanzamt" β†’ Finanzamt, broken umlauts, and ligature splits. Confidence score shown so you always know how certain the result is.

⏰ Deadline Detection (§ 122 AO)

Extracts deadlines from letter text and applies the Β§ 122 AO 3-Tages-Fiktion β€” letters are legally deemed delivered 3 days after the postmark, not when you receive them.

🌍 Multilingual Interface

UI available in English, German, Turkish, Arabic, and Ukrainian β€” the five most common languages among people who need this app. Letter explanations are in plain English by default, with more languages coming.

πŸ†“ Free Help Resources

Each letter type links to the relevant free German counselling services β€” Caritas MBE, Schuldnerberatung, Mieterverein, VdK, and more.

πŸ“€ Share with Advisor

One-tap copy of a clean, advisor-friendly summary. Paste it into an email to your Migrationsberater, print it for Schuldnerberatung, or export as a professional PDF.

πŸ”’ 100% Offline

No data ever leaves your computer. OCR runs locally with Tesseract.js. Database is a local SQLite file. AI reply generation is optional BYOK (bring your own key).

πŸ“± Mobile Scan via QR

CamScanner-style viewfinder with A4 alignment frame. Phone and computer just need to be on the same WiFi.

πŸ”„ Misclassification Feedback

"Was this wrong?" button on every letter. Your corrections are saved locally and help improve classification accuracy over time.


Architecture

Why Desktop, Not Mobile?

BriefKlar is intentionally a desktop app. When people receive an official letter and need to respond β€” write a formal Einspruch, research their rights, compare with previous correspondence β€” they sit down at a computer. The desktop is where the real work happens. The phone's role is just the camera: scan the QR, snap a photo, done.

Why Keyword Matching, Not an LLM?

  1. Instant. Classification takes <100ms. No waiting for inference.
  2. Offline. No model download, no background service, no dependencies.
  3. Deterministic. Same letter always produces the same result.
  4. Lightweight. The entire knowledge base is a 40KB JSON file.

The classifier uses fuzzy matching with Levenshtein distance to tolerate OCR errors β€” "F1nanzamt" matches "Finanzamt", broken umlauts are normalised, and ligature splits are handled. For letters that truly need AI (reply generation), BriefKlar supports optional BYOK (Bring Your Own Key) with Gemini's free tier β€” no bundled model, no mandatory install, no background process.

Why BYOK Instead of a Bundled LLM?

The target audience (immigrants, non-technical users) should never have to install Ollama, download a 3–7 GB model, or debug why a background service isn't running. BYOK means:

  • Zero mandatory setup β€” the app works fully without any API key
  • Free tier available β€” Gemini's free tier handles 15 req/min, no credit card
  • No resource drain β€” no local LLM hogging RAM/CPU during a quick scan
  • No dependency conflicts β€” Ollama sets ELECTRON_RUN_AS_NODE=1 globally, which breaks Electron apps

AI reply generation is a power-user feature, not a core requirement. The built-in legally-verified German reply templates (Einspruch, Widerspruch, KΓΌndigung) work without any API key.


Letter Types

Tax (7 types)
Type German Urgency
Income Tax Assessment Einkommensteuerbescheid 🟠 High
VAT Assessment Umsatzsteuerbescheid 🟠 High
Property Tax Grundsteuerbescheid 🟑 Medium
Trade Tax Gewerbesteuerbescheid 🟠 High
Vehicle Tax Kfz-Steuer 🟒 Low
EU VAT ID Notice USt-IdNr (BZSt) 🟑 Medium
Personal Tax ID Steueridentifikationsnummer 🟒 Low
Debt & Enforcement (4 types)
Type German Urgency
Payment Reminder Mahnung πŸ”΄ Critical
Debt Collection Inkasso 🟠 High
Court Payment Order Mahnbescheid πŸ”΄ Critical
Bank/Wage Seizure PfΓ€ndungs- und Überweisungsbeschluss πŸ”΄ Critical
Social Benefits (7 types)
Type German Urgency
Benefit Approval Jobcenter – Bewilligungsbescheid 🟒 Low
Benefit Cancellation Jobcenter – Aufhebungsbescheid πŸ”΄ Critical
Benefit Sanction Jobcenter – Sanktionsbescheid πŸ”΄ Critical
Health Insurance Krankenkasse – Bescheid 🟑 Medium
Parental Benefit Elterngeld 🟠 High
Housing Benefit Wohngeld 🟑 Medium
Child Benefit Kindergeld – Familienkasse 🟑 Medium
Immigration & Family (3 types)
Type German Urgency
Immigration Notice AuslΓ€nderbehΓΆrde πŸ”΄ Critical
Naturalisation Einbürgerungsbescheid 🟠 High
Childcare Place Kita / Kindergarten Bescheid 🟠 High
Housing, Employment & Other (8 types)
Type German Urgency
Landlord Termination KΓΌndigung vom Vermieter πŸ”΄ Critical
Utility Bill Settlement Nebenkostenabrechnung 🟑 Medium
Employer Termination KΓΌndigung vom Arbeitgeber πŸ”΄ Critical
Court Notice Gerichtsbescheid πŸ”΄ Critical
Pension Insurance Deutsche Rentenversicherung 🟑 Medium
Student Aid BAfâG 🟠 High
Utility Provider Strom / Gas / Internet 🟒 Low
Broadcasting Fee Rundfunkbeitrag (GEZ) 🟒 Low

Tech Stack

Technology Purpose
πŸ–₯️ Electron 41 Desktop shell
⚑ electron-vite Build tooling
βš›οΈ React 18 + TypeScript Frontend
🎨 Tailwind CSS Styling
πŸ” Tesseract.js OCR (German deu.traineddata)
πŸ–ΌοΈ Sharp Image preprocessing
πŸ—„οΈ better-sqlite3 Local database
πŸ“¦ electron-builder + NSIS Windows installer
🌍 Custom i18n 5 languages: EN, DE, TR, AR, UK

Quick Start

1. Clone and install

git clone https://github.com/MfFischer/briefklar.git
cd briefklar
npm install

2. Get the German OCR model

BriefKlar needs deu.traineddata (~15 MB). Download it and place it at:

resources/tessdata/deu.traineddata

Download: github.com/tesseract-ocr/tessdata

On first launch, BriefKlar automatically copies it to the right place.

3. Run

# Development
npm run dev

# Build Windows installer
npm run build:win

Installer output: dist/BriefKlar Setup 0.2.0.exe


Project Structure

briefklar/
β”œβ”€β”€ knowledge-base/
β”‚   └── letters.json              # 26 letter type definitions
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ dev.js                    # Dev server launcher
β”‚   └── build.js                  # Installer build script
└── src/
    β”œβ”€β”€ main/                     # Electron main process
    β”‚   β”œβ”€β”€ pattern-matcher.ts        # Classification engine (fuzzy matching)
    β”‚   β”œβ”€β”€ image-processor.ts        # Sharp + Tesseract pipeline
    β”‚   β”œβ”€β”€ handoff-server.ts         # Mobile scan QR server
    β”‚   β”œβ”€β”€ feedback.ts               # Misclassification tracking
    β”‚   β”œβ”€β”€ db.ts                     # SQLite queries
    β”‚   └── ai-reply.ts              # Optional BYOK Gemini integration
    β”œβ”€β”€ renderer/src/             # React frontend
    β”‚   β”œβ”€β”€ i18n.ts                   # Multi-language translations
    β”‚   β”œβ”€β”€ pages/                    # Dashboard, LetterView, Settings
    β”‚   └── components/
    β”‚       β”œβ”€β”€ FeedbackButton.tsx     # "Was this wrong?" reporting
    β”‚       β”œβ”€β”€ ShareSummary.tsx       # One-tap advisor sharing
    β”‚       β”œβ”€β”€ ScanModal.tsx          # QR scan + review flow
    β”‚       └── ReplyEditor.tsx        # Template + AI reply generation
    └── shared/
        └── types.ts              # Shared TypeScript interfaces

Adding a Letter Type

All classification logic lives in knowledge-base/letters.json. Each entry follows this schema:

{
  "id": "my_letter_type",
  "label": "English label",
  "labelDe": "Deutscher Name",
  "urgency": "low | medium | high | critical",
  "senderPatterns": ["BehΓΆrde XY"],
  "subjectPatterns": ["Betreff keyword"],
  "bodyPatterns": ["Β§ 123 BGB", "specific phrase"],
  "whatItIs": "Plain-English explanation of what this letter is.",
  "whatToDo": ["Step 1", "Step 2"],
  "consequence": "What happens if ignored.",
  "deadlineRule": "explicit_or_1_month",
  "replyTemplateId": null,
  "freeHelp": ["Free resource β€” website.de"]
}

Scoring weights: senderPatterns Γ—3, subjectPatterns Γ—4, bodyPatterns Γ—2.

The fuzzy matcher tolerates OCR errors automatically: patterns with 6–10 characters allow 1 edit, 11–20 allow 2 edits, 21+ allow 3 edits. Short patterns (< 6 chars) require exact matches to avoid false positives.


Known Limitations

  • OCR quality depends on photo quality β€” good lighting and a flat letter make a big difference
  • Windows only for now (macOS/Linux builds are possible but untested)
  • App is unsigned β€” Windows SmartScreen shows a warning on first run: click More info β†’ Run anyway
  • German letters only (classification is German-specific; UI supports 5 languages)
  • AI reply generation requires a Gemini API key (free tier available)

Roadmap

Done

  • OCR + rule-based letter classification (26 types)
  • Fuzzy matching for OCR error tolerance (Levenshtein distance)
  • Β§ 122 AO 3-Tages-Fiktion deadline calculation
  • Betreff, reference number, and amount extraction
  • "Was this wrong?" misclassification feedback button
  • Multi-language UI (EN, DE, TR, AR, UK)
  • Share with advisor β€” copy summary + PDF export
  • Free help resources per letter type (Caritas, VdK, Mieterverein, etc.)
  • Windows installer (NSIS, no click-through)

Next

  • Reply template library β€” Einspruch, Widerspruch, KΓΌndigung variants
  • Windows calendar reminder β€” add deadline directly to Windows Calendar
  • Feedback-driven pattern boosting β€” misclassifications improve weights over time
  • Code signing β€” remove SmartScreen warning
  • macOS build

Future β€” PWA Companion App

The current mobile flow (QR β†’ same WiFi β†’ local HTTP) works well but requires the desktop to be on. A PWA companion would remove that constraint:

Current:  Phone β†’ QR code β†’ local HTTP β†’ Desktop (must be online)

With PWA: PWA on phone
             ↓
         Local API  ──── if desktop is online
             OR
         IndexedDB  ──── if offline (photos queued)
             ↓
         Desktop syncs + processes when it comes back online

This is a v2 feature β€” the right time to build it is when real users hit the "desktop was off" problem in practice.


License

MIT Β© 2026 Maria Fe Fischer


Built for everyone who has ever stared at a German letter and thought: "what does this even mean?"


Download Β· Report a Bug Β· Request a Letter Type

About

Free Windows app that reads German bureaucratic letters for you. OCR + smart classification. 26 letter types. 5 languages. 100% offline.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors