53 lines
1.5 KiB
Markdown
53 lines
1.5 KiB
Markdown
|
|
# BadNote Server (Optional)
|
||
|
|
|
||
|
|
This directory contains an **optional** Python/FastAPI backend. The BadNote desktop app does **not** depend on it.
|
||
|
|
|
||
|
|
The Flutter client is local-first:
|
||
|
|
|
||
|
|
- Notes and documents are stored in SQLite on device
|
||
|
|
- OCR runs locally via Windows built-in OCR
|
||
|
|
- Full-text search uses on-device FTS5
|
||
|
|
|
||
|
|
## Why this exists
|
||
|
|
|
||
|
|
This server was an early experiment for:
|
||
|
|
|
||
|
|
- Multi-device note sync (push/pull)
|
||
|
|
- Server-side OCR with EasyOCR
|
||
|
|
- JWT authentication
|
||
|
|
|
||
|
|
These features are **not wired into the current client**. The client previously had incomplete sync/OCR scaffolding that has been removed in favor of local processing.
|
||
|
|
|
||
|
|
## Running (if you want to experiment)
|
||
|
|
|
||
|
|
```bash
|
||
|
|
cd server
|
||
|
|
python -m venv .venv
|
||
|
|
source .venv/bin/activate # Windows: .venv\Scripts\activate
|
||
|
|
pip install -r requirements.txt
|
||
|
|
uvicorn badnote_server.main:app --host 0.0.0.0 --port 8080
|
||
|
|
```
|
||
|
|
|
||
|
|
API docs: http://localhost:8080/docs
|
||
|
|
|
||
|
|
The OCR worker has heavy extra dependencies (EasyOCR + torch). Install them only
|
||
|
|
if you want to run it:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
pip install -r requirements-ocr.txt
|
||
|
|
python -m badnote_server.ocr.worker
|
||
|
|
```
|
||
|
|
|
||
|
|
### Security notes
|
||
|
|
|
||
|
|
- Set `BADNOTE_JWT_SECRET` in production. If unset, a secret is generated once
|
||
|
|
and persisted to `<data>/.jwt_secret` so tokens survive restarts.
|
||
|
|
- Restrict origins with `BADNOTE_CORS_ORIGINS` (comma-separated). The default is
|
||
|
|
permissive (`*`, without credentials) for local development.
|
||
|
|
|
||
|
|
## Status
|
||
|
|
|
||
|
|
- Kept for reference and future optional sync work
|
||
|
|
- Not part of the primary development path
|
||
|
|
- No guarantee of API compatibility with future client versions
|