README: technische Build- und Setup-Dokumentation

Ersetzt den Vite-Template-Default durch eine entwicklerorientierte Referenz:
Voraussetzungen, Dev-/Build-Befehle, Projektstruktur, Sicherheits-Notizen
und Release-Workflow.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-13 01:19:59 +02:00
parent 00f07d76f6
commit bcfdd85f54
+129 -9
View File
@@ -1,16 +1,136 @@
# React + Vite
# Rapport
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Desktop-App auf Basis von **Tauri 2** und **React 19**, gebaut mit **Vite**. Daten liegen ausschliesslich lokal im Browser-`localStorage` — es gibt kein Backend.
Currently, two official plugins are available:
## Voraussetzungen
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs)
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/)
| Tool | Version |
|---|---|
| Node.js | ≥ 20 (für Vite 8) |
| npm | ≥ 10 |
| Rust toolchain | ≥ 1.77.2 (`rustup`) |
| Plattform-Build-Tools | siehe [Tauri Prerequisites](https://v2.tauri.app/start/prerequisites/) |
## React Compiler
Plattform-spezifisch zusätzlich:
- **macOS**: Xcode Command Line Tools (`xcode-select --install`)
- **Windows**: Microsoft C++ Build Tools, WebView2
- **Linux**: `webkit2gtk-4.1`, `librsvg2-dev`, `libayatana-appindicator3-dev`, `build-essential`
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
## Setup
## Expanding the ESLint configuration
```bash
git clone http://192.168.1.247:3000/karim/RAPPORT.git
cd RAPPORT
npm install
```
If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
## Entwicklung
**Web-Modus** (HMR im Browser, schnellster Iteration-Loop für UI-Arbeit):
```bash
npm run dev # http://localhost:3000
```
**Native Window** (Tauri-Fenster mit echter Desktop-Integration):
```bash
npx tauri dev
```
Lint:
```bash
npm run lint
```
## Produktion-Build
**Nur Frontend** (statische Files für Web-Deployment):
```bash
npm run build # → dist/
```
**Desktop-Bundle** (vollständiges Installer-Paket):
```bash
npx tauri build
```
Output landet in `src-tauri/target/release/bundle/`:
| Plattform | Verzeichnis |
|---|---|
| macOS | `dmg/` und `macos/` (`.app`) |
| Windows | `msi/` (WiX) und `nsis/` |
| Linux | `deb/`, `appimage/`, `rpm/` |
Bundle-Name und -Version stammen aus [`src-tauri/tauri.conf.json`](src-tauri/tauri.conf.json) (`productName`, `version`).
## Versionierung
Beim Anheben der Version müssen drei Stellen synchron bleiben:
- [`package.json`](package.json) — `version`
- [`src-tauri/tauri.conf.json`](src-tauri/tauri.conf.json) — `version`
- [`src-tauri/Cargo.toml`](src-tauri/Cargo.toml) — `version`
Zusätzlich im UI-Changelog: [`src/App.jsx`](src/App.jsx) — Konstante `CHANGELOGS`, sowie `version`-Prop am `<Login>` und `localStorage`-Key `rapport_changelog_seen`.
## Projektstruktur
```
.
├── src/ Frontend (React)
│ ├── App.jsx Root-Komponente, Routing, Auth-State
│ ├── main.jsx React-Mount
│ ├── constants.js Default-Daten, SIA-Phasen, Statusfarben
│ ├── utils.js Hashing, Sanitizer, Formatter, Berechnungen
│ ├── components/UI.jsx Wiederverwendbare UI-Bausteine
│ ├── views/ Module (Dashboard, Time, Invoices, …)
│ └── print/ Print-Komponenten (PDF/QR-Rechnung)
├── src-tauri/ Tauri-Wrapper (Rust)
│ ├── src/ main.rs + lib.rs
│ ├── capabilities/ Permission-Definitionen
│ ├── icons/ App-Icons aller Plattformen
│ └── tauri.conf.json Window, Bundle, CSP
├── public/ Statische Assets (favicon, icons.svg)
├── index.html Vite-Entry
└── vite.config.js
```
## Daten & Persistenz
- Alles wird unter dem Key `rapport_data` in `localStorage` gehalten — siehe [`src/constants.js`](src/constants.js) → `STORAGE_KEY`.
- Beim ersten Start ohne Daten erscheint ein **Setup-Assistent** ([`src/views/Setup.jsx`](src/views/Setup.jsx)). Bestehende Daten ohne `setupCompleted`-Flag triggern den **Migrations-Screen** ([`src/views/MigrationScreen.jsx`](src/views/MigrationScreen.jsx)).
- Backup/Restore: **Einstellungen → Daten exportieren / importieren** — speichert/lädt den gesamten Store als JSON.
## Sicherheit
- **Passwörter**: PBKDF2-SHA-256 mit 100 000 Iterationen und zufälligem Salt; Verifikation in konstanter Zeit. Legacy-Klartext-Passwörter werden beim ersten erfolgreichen Login transparent zu Hashes migriert.
- **Login-Schutz**: 5 Fehlversuche → 60 s Sperre pro Tab (`sessionStorage`).
- **HTML-Sanitizer**: Brieftexte werden vor Print/Render durch eine Allowlist gefiltert (`sanitizeHtml` in [`src/utils.js`](src/utils.js)) — kein `javascript:`, kein `on*`-Handler.
- **Datenexport**: Legacy-Klartext-Passwörter werden beim Export gestrippt; nur Hashes verlassen die App.
- **CSP**: definiert in [`src-tauri/tauri.conf.json`](src-tauri/tauri.conf.json) — `default-src 'self'` plus Google-Fonts-Allowlist.
- **Tauri-Capabilities**: minimal (`core:default` + `core:webview:allow-print`) — siehe [`src-tauri/capabilities/default.json`](src-tauri/capabilities/default.json).
## Release-Workflow
```bash
# 1. Versionen anheben (package.json, tauri.conf.json, Cargo.toml)
# 2. Changelog in src/App.jsx ergänzen
# 3. Commit + Tag
git tag -a v0.6.0 -m "Rapport 0.6"
git push origin main v0.6.0
# 4. Bundle bauen
npx tauri build
# 5. Bundle als Release-Asset auf Gitea anhängen
# (nicht ins Repo committen)
```
## Lizenz
[GNU AGPL-3.0-or-later](https://www.gnu.org/licenses/agpl-3.0.html)