Files
LudusPublic/README.md

53 lines
2.8 KiB
Markdown

# LudusPublic
The public parts of **Ludus**, a local-first learning app. Today that is one thing: **the league relay**, the
optional, self-hostable server a group of learners can run to share a weekly league board.
Ludus itself is private. The relay is public for one reason: it is the only part of Ludus that receives anything
from a learner's device, and a promise about what a server keeps is worth only as much as your ability to read the
server. So you can read it here, run it yourself, and check that it keeps what is listed below and nothing else.
## What the relay stores
One SQLite table with six columns and no joins: the participant's Ed25519 public key, the display name they chose,
the league, the ISO week, the XP (clamped to a weekly ceiling), and when the last submission arrived (stored, never
served). There is no IP address in any form, no user agent, no referrer, no request log, no cookie, no session, and
no history: one row per participant, replaced on every submission. `relay/test/store.test.ts` reads the schema back
out of SQLite and fails if a seventh column appears.
A submission's signature proves who sent it, not that the number is true. A client computes its own score and can
lie. The relay's defences are the cheap ones: a weekly XP ceiling, a current-week check, and leagues small enough
that the people in them know each other.
## Layout
| Folder | What |
| :-- | :-- |
| `relay/` | the relay: `src/bin.ts` starts it, `src/server.ts` serves it, `src/store.ts` keeps the six columns |
| `schema/` | the slice of Ludus's schema the relay imports (`@ludus/schema`): the league submission and the `Result` type |
```bash
pnpm install
pnpm test # the relay's tests
pnpm typecheck
pnpm --filter @ludus/relay start
```
## Where this code comes from
Ludus develops the relay in its private repository (`services/relay`). This repository carries the same files.
`relay/src`, `relay/test` and `schema/src/{league,result}.ts` are byte-for-byte copies, and a test in Ludus fails
if a copy here differs from the code Ludus ships. This repository started from Ludus at `52d7a0c` (2026-11-23).
## Licence
**CPAL-1.0** (Common Public Attribution License 1.0): see [`LICENSE`](LICENSE). Anyone who redistributes this code,
or runs it as a service for others, must show the Exhibit B credit: **Built on Domi**, linking to
https://aula.marek-novak.cz, with the notice *Copyright (c) 2026 Marek Novák*.
A running relay shows that credit itself: `GET /about` (and `GET /`) answers with the credit, the copyright and
the URL of its source. If you run a **modified** relay, set `LUDUS_RELAY_SOURCE_URL` to where your changed code
can be read. §15 makes running it for others a distribution, and the source owed is the code that runs.
The dependencies keep their own licences (`@noble/curves` and `better-sqlite3`: MIT).