Skip to main content

Development

Commands​

make lists them all. The ones you'll use:

CommandWhat it does
make setupChecks for Rust, creates .env and redlib.toml, adds the upstream Git remote and fetches dependencies
make localRuns a dev server from source with plain-HTTP cookies
make checkFormatting, lints and the extension tests, offline
make testThe full test suite. Upstream's tests call Reddit live, so they fail when Reddit rate-limits
make buildA 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​

PathWhat'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