Files
Thomas KarnerandClaude Opus 5 6907d9a014 Add a front door, a user guide in two languages, and an honest list of what is broken
Four documents and two fixes to the deploy directory that the documents
exposed while being written.

The repo had no root README. Cloning it landed you on a 40 KB spec and a 24 KB
plan with nothing to orient you, which mattered more once main stopped being
an empty branch. The new one links rather than duplicates, and its status table
says plainly what has never run on hardware and that there are no backups.

docs/README.USER.md and its German twin are written for someone who will use
this, not build it: what radar buys over a PIR sensor, why there is no sign-up
page, what "pre-trigger" means, what to do when the six-digit code is refused.
Every POORBIRD_* setting is described in plain language, including the two that
cost an hour each the first time they bite. The German version is a
translation, not a mechanical flip of the English.

docs/OPEN-TOPICS.AI.md is the list nobody writes: unfixed security issues,
traps, and test debt, each labelled ACCEPTED, OPEN or TRAP, because the
difference between "known trade-off" and "not done yet" is the only thing that
makes such a list usable. It ends with a section of things that are NOT
problems -- the SHA-256/Argon2id split, the frozen 0001 migration, the finite
pool_timeout -- so they stop being rediscovered and "fixed".

Two real defects surfaced while documenting the install:

Nothing served the WebUI in production. The Caddyfile's human-facing block
only reverse-proxied to FastAPI, and FastAPI mounts no static files, so a
by-the-book install produced a working API and no gallery. It now has a
file_server with a try_files fallback, because the router does client-side
routing and without it only the entry page survives a reload.

INSTALL.md never created an account. With no sign-up endpoint, following it
end to end left you at a login form with no credentials that work -- the exact
wall hit on the dev machine today, and worse on a headless host. It also never
built or copied the UI, so a git pull on the server silently kept the old
bundle; that is now its own step, with --delete spelled out because Vite emits
content-hashed filenames.

Verified: caddy validate via the official caddy:2 image reports "Valid
configuration" (with the cloudflare-DNS block stripped, since that plugin is
not in the stock image and the block is unchanged); npm run build is clean at
192 modules; all 31 relative links across every .md resolve; the committed
line endings are LF, so caddy fmt's complaint was my working tree only.

Not verified: none of the install has run on a real host. The doc says so.

One claim was wrong before it shipped: both guides said signing out ends every
session everywhere. logout calls revoke_session for the current token only --
revoke_all_for_user exists but is not called there -- so it ends that browser's
session alone, and `user passwd` is what clears them all. Corrected in both
languages.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-21 23:01:20 +02:00

107 lines
4.9 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# poorBird
A radar-triggered bird camera. An ESP32-S3 watches a feeder with a 24 GHz
radar module, photographs whatever moves, and uploads it to a small server on
the same LAN that stores the images and shows them in a gallery you can label.
Radar rather than a PIR motion sensor: it sees through a plastic housing,
does not care about warm air or moving branches, and reports distance and
signal energy, which is enough to tell "a bird landed" from "the hedge moved".
```
ESP32-S3 + LD2410 radar FastAPI + PostgreSQL 17 React gallery
------------------------ ----------------------- -------------
detects, photographs, ----> stores, thumbnails, <---- browse, filter,
buffers, uploads authorises label
plain HTTP :8080 loopback :8090 over TLS
```
## Where things stand
Honestly, because a status table that flatters is worse than none:
| Part | State |
|---|---|
| **Firmware** | Written, compiles, **never run on hardware.** |
| **Device↔server contract** | Specified in full and implemented on the server. **Never yet exercised by real firmware.** |
| **Server** | Phases 1–2 and the Phase 3 server half. 308 tests against real PostgreSQL 17. **Not yet on the real host.** |
| **WebUI** | Login and a working cursor-paged gallery. Devices and System are honest empty states waiting on Phase 4. |
| **Backups** | **None.** Phase 5. Do not let captures you care about accumulate yet. |
Nothing here has been released, and `main` means "the project", not "a
release".
## Start here
| If you want to | Read |
|---|---|
| use it, in plain language | [`docs/README.USER.md`](docs/README.USER.md) · [Deutsch](docs/README.USER.de.md) |
| install it on a Linux box | [`server/deploy/INSTALL.md`](server/deploy/INSTALL.md) |
| work on the server | [`server/README.md`](server/README.md) |
| work on the UI | [`web/README.md`](web/README.md) |
| work on the firmware | [`firmware/README.md`](firmware/README.md) |
| know what is broken or unfinished | [`docs/OPEN-TOPICS.AI.md`](docs/OPEN-TOPICS.AI.md) |
| know *why* it is built this way | [`SPEC.md`](SPEC.md) |
| know what is next | [`TODO.md`](TODO.md) |
Two documents outrank the rest. [`firmware/API.md`](firmware/API.md) is the
device contract: the camera cannot be patched from a laptop once it is mounted
outdoors, so where the server and that document disagree, the document wins.
[`SPEC.md`](SPEC.md) holds the decisions and the reasons, which is what keeps
a later change from quietly undoing an earlier one.
## Layout
```
firmware/ ESP32-S3 sketch (PlatformIO) + API.md, the device contract
server/ FastAPI, PostgreSQL, the job queue, the CLI, systemd + Caddy
web/ React gallery, built on your machine and shipped as static files
docs/ user guides, open topics, and per-branch code reviews
SPEC.md the design and the reasoning behind it
TODO.md phase-by-phase plan and the open questions
```
## Constraints that are not up for negotiation
These are decided in `SPEC.md`, and they explain choices that would otherwise
look old-fashioned:
- **No containers.** Native packages and systemd units on an x86 thin client.
- **PostgreSQL, not SQLite.** The job queue needs `FOR UPDATE SKIP LOCKED`.
- **No Redis.** The queue is a table; one fewer service to run and back up.
- **Caddy, not nginx.** It gets a real certificate for a LAN-only hostname
over DNS-01, so there is no browser warning and no port forwarding.
- **The camera speaks plain HTTP.** TLS on an ESP32 means a CA baked into
firmware and a mounted camera that stops uploading when the chain rotates.
- **Images are never served straight off disk.** The app authorises the
request and Caddy sends the bytes. An unguessable URL is not access control.
- **Logs go to stdout.** journald catches them; the app manages no log files.
## Quick start on a dev machine
```bash
# server
cd server && python -m venv .venv && .venv/bin/pip install -e ".[dev]"
.venv/bin/poorbird check # says what is misconfigured, and why
.venv/bin/poorbird migrate
.venv/bin/poorbird user add me --role admin
.venv/bin/poorbird seed --captures 500 # something to look at
.venv/bin/poorbird serve
# UI, in another terminal
cd web && npm install && npm run dev # http://localhost:5173
```
On Windows the venv puts those executables in `.venv\Scripts\` rather than
`.venv/bin/`; [`server/README.md`](server/README.md) covers that setup, uv and
Podman included.
There is no sign-up page and no default account, on purpose — a shipped
default credential is a backdoor. Accounts are created with the CLI.
Two settings need flipping for local development, and both say why in
[`server/deploy/poorbird.env.example`](server/deploy/poorbird.env.example):
`POORBIRD_SESSION_COOKIE_SECURE=false` (a `Secure` cookie is dropped over
plain HTTP, so login silently never sticks) and
`POORBIRD_SERVE_IMAGES_DIRECTLY=true` (there is no Caddy to hand the files to).