Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Courses

Course browsing app with a Svelte frontend and Rust API.

Setup

Install Nix and devenv. You’ll also need access to git.cmu.dev and ScottyLabs’ OpenBao secrets service. Ask a maintainer for access and authentication setup; the dev profile loads secrets automatically.

The API also needs a published catalog.bin in the configured CDN_S3_BUCKET. If startup reports NoSuchKey, ask a maintainer to confirm the catalog location or publish it using the Scrape and Publish Catalog workflow.

git clone ssh://forgejo@git.cmu.dev/ScottyLabs/courses.git
cd courses
devenv shell

The environment provides Rust, Deno, Git, and the WebAssembly tooling. First startup downloads dependencies and builds the browser’s WebAssembly module.

Optional: with direnv configured in your shell, run direnv allow at the repository root to activate the environment automatically when entering the directory.

Run locally

Use three terminals, each with the development environment loaded. Start from the repository root in each terminal.

# Terminal 1: PostgreSQL and the Ricochet login relay
devenv up
# Terminal 2: web API on port 3002
cargo run -p courses-web-api
# Terminal 3: frontend
cd sites/web
deno task dev

Open http://localhost:5173. The frontend proxies /api and /auth to the web API on port 3002. Stop the foreground processes with Ctrl+C.

Preview a production build

From sites/web, with the development environment loaded:

deno task build
deno task preview

Open http://localhost:4173. Keep the API running for backend features. To test login with the configured callback URL, stop the dev server and use deno task preview --port 5173, with the login relay running. Rebuild after changes. Preview is for local testing; deployment serves the generated sites/web/build directory through courses-web-api using STATIC_DIR.

Useful commands

CommandRun fromPurpose
deno task checksites/webCheck Svelte and TypeScript
build-wasmRepository rootRebuild browser bindings after Rust index changes
direnv reloadRepository rootReload the environment after configuration changes
devenv --no-tui shellRepository rootShow plain startup logs when troubleshooting

More details: architecture and scraper usage.