https://github.com/pflegra/core
Self-hosted care management platform for German care benefits (SGB XI)
https://github.com/pflegra/core
caregiving fastapi germany healthcare home-assistant open-source pflege pwa self-hosted sgb-xi sqlite
Last synced: 28 days ago
JSON representation
Self-hosted care management platform for German care benefits (SGB XI)
- Host: GitHub
- URL: https://github.com/pflegra/core
- Owner: Pflegra
- License: other
- Created: 2026-05-27T13:25:43.000Z (30 days ago)
- Default Branch: main
- Last Pushed: 2026-05-29T16:43:05.000Z (28 days ago)
- Last Synced: 2026-05-29T17:06:42.558Z (28 days ago)
- Topics: caregiving, fastapi, germany, healthcare, home-assistant, open-source, pflege, pwa, self-hosted, sgb-xi, sqlite
- Language: Python
- Homepage:
- Size: 1.69 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Pflegra
**A self-hosted care management platform for planning, organizing and tracking German care benefits (SGB XI).**
Pflegra helps families and care providers manage Verhinderungspflege, Kurzzeitpflege, and all related benefits — without spreadsheets, without data leaving your home.
---
## Features
- **Care record tracking** — log Verhinderungspflege entries with date, time, duration and care type
- **Budget management** — real-time VP+KZP budget status, 56-day limit tracking, annual prognosis
- **Budget simulator** — plan your full year across all benefit types (§ 36, § 37, § 39, § 40, § 41, § 45b SGB XI)
- **Rules engine** — all legal benefit amounts centralized in `pflege_rules.py`, updated per year
- **Ausfüllhilfe** — KK-independent data sheet for filling out your Pflegekasse's own forms
- **PDF exports** — care records, budget reports, application letters, Ausfüllhilfe
- **Ersatzpflegekräfte** — manage substitute carers in Stammdaten, select per entry
- **Entlastungsbetrag tracking** — monthly budget, Vorjahresguthaben indicator (§ 45b SGB XI)
- **Automatic backups** — daily, configurable retention, with restore
- **Multi-user support** — per-user data isolation, roles (admin/user), user management
- **Demo system** — built-in `demo/demo` account with sample data, auto-reset on logout
- **HTTPS / Tailscale** — built-in Tailscale integration for secure remote access
- **Home Assistant Add-on** — runs natively on HA OS, no extra hardware needed
- **Docker deployment** — for standalone server or VM
---
## Screenshots
| Login | Dashboard |
|---|---|
|  |  |
| Pflege-Einträge | Budgetplanung |
|---|---|
|  |  |
| Anträge & Dokumente | Versicherten-Stammdaten |
|---|---|
|  |  |
---
## Quick Start
### Option A — Docker Desktop (empfohlen für Windows/Mac/Linux)
Kein Server-Wissen, kein Git, kein Build. Nur Docker Desktop und ein Doppelklick.
#### A1 — Ohne Repository (schnellster Einstieg)
1. [Docker Desktop](https://www.docker.com/products/docker-desktop) installieren und starten
2. Diese drei Dateien herunterladen (z.B. als [ZIP von GitHub](https://github.com/Pflegra/core/archive/refs/heads/main.zip)):
- `docker-compose.quickstart.yml`
- `quickstart.bat` (Windows) **oder** `quickstart.sh` (Mac/Linux)
- `quickstop.bat` (Windows) **oder** `quickstop.sh` (Mac/Linux)
3. Alle drei Dateien in einen gemeinsamen Ordner legen
4. **Windows:** Doppelklick auf `quickstart.bat`
**Mac/Linux:** Im Terminal: `chmod +x quickstart.sh && ./quickstart.sh`
5. Browser öffnet sich automatisch — Pflegra ist bereit ✅
> **Beim ersten Start** wird das Image (~150 MB) von GitHub heruntergeladen. Das dauert je nach Verbindung 1–2 Minuten. Danach startet Pflegra in Sekunden.
**Stoppen:** Doppelklick auf `quickstop.bat` / `./quickstop.sh`
**Daten:** Werden dauerhaft im Docker-Volume `pflegra_data` gespeichert — auch nach dem Stoppen.
---
**Oder als Einzeiler** (kein Script nötig):
```bash
docker run -d -p 8000:8000 -v pflegra_data:/data ghcr.io/pflegra/core:latest
```
Dann `http://localhost:8000` im Browser öffnen.
---
#### A2 — Mit Repository (für Entwickler)
```bash
git clone https://github.com/Pflegra/core.git
cd core
```
**Windows:** Doppelklick auf `start.bat`
**Mac/Linux:** `chmod +x start.sh && ./start.sh`
---
### Option B — Home Assistant Add-on
1. Copy the add-on folder to `/addons/pflegra/` on your HA instance
2. Install via **Settings → Add-ons → Local Add-ons**
3. Start and open the Web UI on port `8000`
4. For remote HTTPS access install the Tailscale Add-on separately
**First login:** an `admin` account is created automatically from your existing config, or set up via `/setup` on first run.
**Demo access:** `demo` / `demo` — resets automatically on logout.
### Option C — Docker Compose (Server/VM)
```bash
git clone https://github.com/Pflegra/core.git
cd core
cp .env.example .env
# Edit .env — set a secure PFLEGRA_SECRET
docker compose up -d
```
Open `http://localhost:8000` in your browser.
### Option D — Direct (Python 3.11+)
```bash
cd app
pip install -r requirements_web.txt
uvicorn web.app:app --host 0.0.0.0 --port 8000 --app-dir app
```
---
## Requirements
| Component | Minimum |
|---|---|
| Python | 3.11+ |
| RAM | 256 MB |
| Disk | 500 MB |
| OS | Linux, HA OS, macOS, Windows (via Docker) |
---
## Supported benefit types (2026)
| Benefit | Legal basis | Amount |
|---|---|---|
| VP + KZP (shared pool) | § 39 SGB XI | 3.539 €/year |
| Pflegegeld PG 2–5 | § 37 SGB XI | 347 – 990 €/month |
| Pflegesachleistungen PG 2–5 | § 36 SGB XI | 796 – 2.299 €/month |
| Tagespflege PG 2–5 | § 41 SGB XI | 721 – 2.085 €/month |
| Entlastungsbetrag | § 45b SGB XI | 131 €/month |
| Pflegehilfsmittel | § 40 SGB XI | 42 €/month |
| Wohnumfeldverbesserung | § 40 SGB XI | 4.180 € per measure |
| Hausnotruf | — | 25,50 €/month |
| DiPA App | § 40a SGB XI | 40 €/month |
| DiPA Unterstützung | § 40a SGB XI | 30 €/month |
All amounts live in `app/pflege_rules.py` — one file to update when the law changes.
---
## Architecture
```
app/
├── pflege_rules.py # Central rules engine — all legal amounts per year
├── calculations.py # Budget calculations, prognosis logic
├── models.py # DB schema v12, migrations, repositories
├── demo_reset.py # Demo user reset (on logout + every 60 min)
├── ausfuellhilfe_vp.py # Ausfüllhilfe PDF generator
├── antrag_vp.py # Antrag VP PDF generator
├── web/
│ ├── auth.py # Multi-user auth, sessions, roles
│ ├── routers/
│ │ ├── deps.py # get_db, get_owner_id, get_user_settings
│ │ ├── eintraege.py # Care entries (owner_id filtered)
│ │ ├── versicherte.py # Insured persons + Ersatzpflegekräfte
│ │ ├── antraege.py # PDF generation (user_settings aware)
│ │ ├── einstellungen.py # Per-user + global settings
│ │ ├── login.py # Login, logout, setup, demo reset
│ │ └── admin.py # User management (admin only)
│ ├── templates/ # Jinja2 HTML templates
│ └── static/js/
│ └── budget_planung.js
├── services/ # BudgetService, ExportService, BackupService
└── tests/ # 388+ pytest tests
```
**Stack:** FastAPI · Jinja2 · SQLite · ReportLab · Python 3.11+
**DB schema versioning:** automatic migration on every startup (currently v12)
**Health endpoint:** `GET /health` — returns status, DB integrity, schema version, uptime
**Auth:** bcrypt · CSRF protection · rate limiting · secure cookies · per-user data isolation
---
## Multi-user & Security
Pflegra supports multiple users with full data isolation:
- Each user sees only their own records, persons and settings
- Roles: `admin` (full access, user management) and `user`
- Sessions via signed cookies (`pflegra_session`), 12h lifetime
- Secure cookies automatically enabled over HTTPS
- Demo account (`demo/demo`) resets on logout and every 60 minutes
---
## Remote Access (Tailscale)
Pflegra supports secure remote access via [Tailscale](https://tailscale.com) — without exposing ports to the internet.
**On Home Assistant OS:**
1. Install the official [Tailscale Add-on](https://github.com/hassio-addons/addon-tailscale) from the HA Add-on Store
2. Authenticate with your Tailscale account
3. Enable Funnel for port 8000
4. Pflegra will be available at `https://.ts.net:8443`
**On Docker / standalone:**
Install Tailscale on the host and set up Funnel manually.
---
## Configuration
Copy `.env.example` to `.env`:
```bash
cp .env.example .env
```
| Variable | Default | Description |
|---|---|---|
| `PORT` | `8000` | HTTP port |
| `TZ` | `Europe/Berlin` | Timezone |
| `PFLEGRA_DATA` | `/share/pflegra` | Data directory |
| `PFLEGRA_SECRET` | *(auto-generated)* | Session secret — set this in production |
| `PFLEGRA_DEBUG` | `0` | Enable debug logging |
| `PFLEGRA_HTTPS` | `0` | Set to `1` behind HTTPS reverse proxy |
| `BACKUP_STUNDE` | `2` | Hour for daily auto-backup (0–23) |
---
## Development
```bash
# Install dependencies
pip install -r app/requirements_web.txt
# Run all tests
cd app && pytest tests/ -v
# Run dev server with auto-reload
uvicorn web.app:app --reload --port 8000 --app-dir app
```
---
## Roadmap
### v44 — released ✅
- [x] Multi-user support with data isolation
- [x] HTTPS / Tailscale integration
- [x] Demo system with auto-reset
- [x] Per-user settings
- [x] Tests Phase H — auth, isolation, roles, demo (38/38)
- [x] Screenshots in README
- [x] Entlastungsbetrag actual consumption tracking
- [x] PWA — installable on mobile homescreen
- [x] AGPLv3 + Dual Licensing
- [x] PRIVACY.md
### v45 — planned
- [x] Public Docker image — `ghcr.io/pflegra/core:latest`
- [x] Docker Desktop Quick Start — `quickstart.bat` / `quickstart.sh` — Doppelklick-Start ohne Server-Kenntnisse
- [ ] Multi-language / i18n support (English UI)
- [ ] Mobile UI improvements (PWA full offline)
- [ ] Entlastungsbetrag dedicated booking view
---
## Legal
This software is for informational and organizational purposes only. It does not constitute legal or financial advice. Benefit amounts are maintained based on publicly available law (SGB XI) and may not reflect the most recent legal changes. Always verify with your Pflegekasse.
---
## License
Copyright © 2024–2026 Stefan Neu
Pflegra is licensed under the [GNU Affero General Public License v3.0](LICENSE) (AGPLv3).
Commercial use under the terms of the AGPLv3 is permitted. Organizations requiring alternative licensing terms may contact the copyright holder to discuss commercial licensing options.
**Key points of AGPLv3:**
- ✅ Use, modify and self-host freely
- ✅ Commercial use permitted under AGPLv3 terms
- ✅ Fork and contribute under the same license
- ⚠️ Any modification or derivative work must also be released under AGPLv3 with full source code
- ⚠️ Network use (SaaS) also triggers the source disclosure requirement
For licensing inquiries: [s.l.neu@web.de](mailto:s.l.neu@web.de)
---
*Built for families navigating the German care system.*