A single full-stack devcontainer that provides everything needed to work on crates.io: backend, frontend, and a Postgres database. This is the recommended setup for new contributors.
- Rust toolchain (managed by
rustup, pinned viarust-toolchain.toml) - Node.js and pnpm
- Postgres, accessible at the hostname
db psqlclient andlibpq-devdiesel_cli(with thepostgresfeature)- Playwright Chromium headless shell with the required system libraries
Open the repository in VS Code with the Dev Containers extension installed and select "Reopen in Container".
Open the repository on GitHub and create a new codespace. The container starts automatically.
With the devcontainer CLI installed:
devcontainer up
devcontainer exec bashThe postCreateCommand runs once after the container is built and:
- Installs the tool versions pinned in
mise.tomlwithmise install - Initializes the local git index in
tmp/index-bare/ - Creates the
cargo_registry_testdatabase - Runs Diesel migrations against
cargo_registry - Installs JavaScript dependencies with
pnpm install - Installs the Playwright Chromium headless shell
- Pre-fetches Rust dependencies with
cargo fetch
On every subsequent container start, diesel migration run is invoked to
keep the development database schema current.
The container only provisions tooling and dependencies; it does not
start the backend or the Svelte dev server. See Building and serving
the frontend
and Starting the server and the frontend
in CONTRIBUTING.md for the commands.
The cargo_registry database is empty by default. To populate it with a
recent snapshot of the production data, run:
script/import-database-dump.shThe dump is several GB compressed and the import takes a while.
The container's first start copies .env.sample to .env if one
doesn't already exist. The defaults are enough for the backend to
boot. Login flows additionally require a GitHub OAuth app, so fill
in the GH_CLIENT_ID and GH_CLIENT_SECRET values. .env.sample
documents the callback URL to register with GitHub.
| Port | Service |
|---|---|
| 8888 | Backend API |
| 5173 | Svelte dev server |
| 6006 | Storybook |
Five named volumes persist between container rebuilds:
/workspaces/crates.io/target(Cargo build output)/usr/local/cargo/registry(downloaded crate sources)/home/vscode/.local/share/pnpm/store(pnpm content-addressable store)/home/vscode/.local/share/mise(mise-managed tools)/workspaces/crates.io/local_uploads(files written by the backend when storage isn't configured for S3, e.g. when publishing crates to your local instance)