Development
Commands
make lists them all. The ones you'll use:
| Command | What it does |
|---|---|
make setup | Checks for Rust, creates .env and redlib.toml, adds the upstream Git remote and fetches dependencies |
make local | Runs a dev server from source with plain-HTTP cookies |
make check | Formatting, lints and the extension tests, offline |
make test | The full test suite. Upstream's tests call Reddit live, so they fail when Reddit rate-limits |
make build | A release binary at target/release/redlib |
Docker (make docker, make logs, make down) is covered in Docker, and make worker and make worker-deploy in Cloudflare Workers.
Project layout
| Path | What's there |
|---|---|
src/ | Redlib's server, plus Threadshift's accounts (src/auth), instance settings (src/ext) and Workers platform code (src/workers) |
templates/ | Redlib's page templates, plus the installer and sign-in pages |
ext/ | The extensions, compiled in at build time by ext/compose.rs |
workers/ | The Cloudflare Workers deployment |
migrations/ | The account database schema, shared by SQLite, PostgreSQL and D1 |
docs/ and website/ | These docs, and the site that publishes them |
Staying close to Redlib
Threadshift adds to Redlib rather than rewriting it. Features live in ext/, and upstream files only gain the hook lines listed in NOTICE.md. That keeps merges small:
git fetch upstream
git merge upstream/main
make check
New features belong in an extension: see Extensions and ext/README.md.
The docs site
The pages in docs/ are plain Markdown, so GitHub shows them as they are. Docusaurus in website/ publishes the same files; the sidebar order is in website/sidebars.js.
make docs-site # build into website/build (installs dependencies first)
make docs-deploy # deploy to Cloudflare Workers
cd website && npx docusaurus start # live preview while editing