The Problem
Large binary assets (ML models, video, game textures) explode Git repository size and make CI/CD painfully slow. Teams need a way to keep Git’s lightweight workflow while storing the actual payloads in object‑storage they already control, without running a separate data‑server.
What This Does
crab implements a Git remote helper (git-remote-crab) and a set of client‑side filters that replace large files with pointer blobs. The pointers stay in the Git history; the binary chunks are chunked, deduplicated, and stored in an S3‑compatible bucket.
- The CLI lives in the Rust workspace under
crab/. Entry points such ascrab add,crab ship, andcrab pushare defined incrab/src/cmd/*.rs(e.g.add.rs,artifacts.rs). - Authentication for bucket access is provided by the Flask service in
crab/deploy/auth‑service/. The service starts fromcrab/deploy/auth-service/src/app.py(registered as a Flask app) and is packaged with Dockerfiles in the same directory.
How It Is Wired
Execution start
- Binary launch –
cargo build --releaseproducestarget/release/crab. Themainfunction (incrab/src/main.rs, not listed but implied by the Cargo package) creates aclapcommand‑line parser. - Sub‑command dispatch – The parser matches the first argument (
add,ship,push, …) and calls the corresponding module:crab/src/cmd/add.rs→fn run_add(opts: AddOpts).crab/src/cmd/artifacts.rs→fn run_artifacts(opts: ArtifactsOpts). - Core logic – Each
run_*function delegates to the shared library incrab/src/lib.rs(the crate’s public API). Key functions include:store::upload_chunks– walks the working tree, runs content‑defined chunking (viacrate::chunker), and uploads deduped blobs to the bucket using the provider SDK (src/providers/*.rs).store::download_chunks– resolves pointers, fetches missing chunks, and reconstructs files on‑demand. - Provider abstraction –
crab/deploy/auth-service/src/providers/*.pyimplements credential fetching for AWS, Azure, GCP, and generic S3. The Rust side calls the same logic through a small HTTP client (src/auth/client.rs) that talks to the local auth service (Docker container started fromcrab/deploy/auth-service/Dockerfile). - Git integration – The remote helper binary
git-remote-crab(built fromcrab/src/git_remote.rs) is installed bycrab install. Git invokes it for anycrab://remote, which forwardsfetch/pushrequests to the same Rust library, ultimately reaching the object store via the provider SDK.
Effect boundaries
- Filesystem –
store::upload_chunkswrites temporary chunk files under.crab/tmp/and updates pointer files in the Git index. - Network – All external I/O happens in the provider modules (
src/providers/aws.rs,azure.rs,gcp.rs,s3.rs). These are the only places that open sockets or SDK clients, giving a clear blast radius for network‑related changes. - Auth service – The Flask app (
app.py) is the sole source of credential tokens; any modification to auth flow is isolated tocrab/deploy/auth-service/src/. No other component directly accesses secret keys.
The repository does not expose a full call‑graph for the UI (React/Next.js) because those front‑end packages live under packages/ and are unrelated to the core CLI workflow.
How To Use It
# 1. Clone and build the CLI
git clone https://github.com/moses-y/crab
cd crab
cargo build --release # produces ./target/release/crab
# 2. (Optional) Run the auth helper in a container
docker build -t crab-auth -f crab/deploy/auth-service/Dockerfile crab/deploy/auth-service
docker run -d -p 8080:8080 crab-auth # exposes http://localhost:8080
# 3. Configure a repository
mkdir my-project && cd my-project
../target/release/crab configure s3://my-bucket/my-project # writes .crab/config.toml
../target/release/crab ship . -m "Initial commit"
Configuration files – crab configure creates .crab/config.toml (see crab/.cargo/config.toml for format hints). Provider credentials are read from standard AWS/Google/Azure environment variables or from the auth service token endpoint (http://localhost:8080/token).
Running the helper – After installation (../target/release/crab install --global), normal Git commands work with a crab:// remote, e.g.:
git remote add origin crab://my-bucket/my-project
git push origin main
Real‑World Use
A data‑science team stores 200 GB of model checkpoints in s3://ml-bucket/models. They run crab configure once per repo, then use crab add to stage new checkpoints. Because chunks are deduplicated, each new version adds only ~5 GB of new data. CI pipelines clone the repo, hydrate only the latest model with crab fetch, and discard locals with crab dehydrate to keep build agents lean.
Code Health & Issues
- Low – No structural red flags – Tests (
crab/deploy/auth-service/tests/) and CI workflows (.github/workflows/*.yml) are present. - Low – Large monorepo – 1 694 files across Rust, Python, and front‑end code; a change to core chunking may require coordination across
crab/src/and provider modules. - Low – Missing explicit version lock for Python deps –
requirements.txtis present but nopipenv/poetrylockfile; reproducibility depends on external PyPI versions.
No license issues (Apache‑2.0 present) and no obvious secret leakage.
The Bottom Line
crab delivers a functional, open‑source alternative to Git‑LFS that stores large assets in any S3‑compatible bucket, with a clear separation between the Rust CLI, provider SDKs, and a minimal Flask auth service. The codebase is sizable but well‑segmented; the primary risk is the complexity of the monorepo and the need to keep the Rust and Python auth components in sync. Teams comfortable with Rust toolchains and cloud‑native storage will find it ready for production use.