No description
- TypeScript 97.4%
- Dockerfile 2.6%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| src | ||
| .env.example | ||
| .gitignore | ||
| bun.lock | ||
| CONTRIBUTING.md | ||
| docker-compose.yml | ||
| Dockerfile | ||
| drizzle.config.ts | ||
| LICENSE | ||
| NOTICE | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
Reseam Crowdcache
Results that Reseam's patches get from outside services, shared so a result one person paid for is reused by everyone else. Clients compute a result themselves, look it up here first, and submit it after a miss. The server only stores and serves; it never calls the outside services.
- Namespaces. Each kind of result has its own path and schema:
pangram-textandpangram-image. - Keys. Clients derive keys from what was checked, such as a post id and a hash of its text.
- Values. A result is stored whole, as the outside service returned it, including any text it quotes. Each namespace checks the fields clients read and keeps every other field as is.
- First write wins. A later submission for a key that already has a result is ignored.
| Endpoint | Body | Response |
|---|---|---|
POST /v1/<namespace>/lookup |
{ "keys": [...] }, up to 100 |
{ "entries": { "<key>": <result> } }, missing keys left out |
POST /v1/<namespace> |
{ "entries": [{ "key", "value" }] }, up to 50 |
204 |
GET /v1/health |
{ "ok", "version" } |
OpenAPI docs are served at /openapi.
Configuration
| Variable | Default | |
|---|---|---|
PORT |
4200 |
|
DB_PATH |
./data/crowdcache.db |
SQLite database |
CLIENT_IP_HEADER |
cf-connecting-ip |
Header holding the client address, for rate limits |
LOOKUP_RATE |
600 |
Lookups per address per minute |
WRITE_RATE |
120 |
Writes per address per minute |
BACKUP_BUCKET |
S3-compatible bucket for daily backups; unset turns backups off | |
BACKUP_ENDPOINT |
The bucket's S3 endpoint, such as an R2 account endpoint | |
BACKUP_ACCESS_KEY_ID, BACKUP_SECRET_ACCESS_KEY |
Credentials that can write to the bucket | |
BACKUP_PREFIX |
crowdcache/ |
Prefix for backup objects |
Backups
With BACKUP_BUCKET set, the server takes a snapshot of the database when it starts and every 24 hours after,
and uploads it gzipped as <prefix><YYYY-MM-DD>.db.gz. To restore, download the newest one, gunzip it, and
point DB_PATH at it. Old backups stay until a bucket lifecycle rule removes them.
Develop
Needs Bun.
bun install
bun run dev # restarts on changes
bun run typecheck
bun run db:generate # migration after a schema change
Built with Bun, Elysia, and Drizzle on SQLite.