Any way to create a serverless crate registry?

I've been looking into private cargo registries. There's some open source ones that look promising (meuse, estuary, etc), but we may also write our own.

Ideally this registry would be serverless: e.g., AWS's Lambda/DynamoDB/S3. The crate index would be stored in DynamoDB, for example. However, this would mean emulating Git's formats in the endpoint responses. Not impossible, but fiddly.

Has anyone tried to go down this path? Any experience (or code) that I could draw upon?

You may want to try doing this with the (experimental) sparse registry format, which uses a simple HTTP API rather than a Git repo: Unstable Features - The Cargo Book

2 Likes

You can point Cargo to a file folder that contains a registry Git repo. No servers involved.

If we had a monorepo, that would work, but we generally do "one repo per crate".
Currently we're putting git URLs into cargo.toml, specifying a specific tag. Works well enough, but you don't get the nice version resolution that cargo can do with a proper crate registry.

You need a "registry" repository, with a index of the file paths to all the other crates.

1 Like