After playing with Rust around the 1.0 release a couple of years ago, I put it aside to work on other things. But a sentence in the Rust 1.34 release note interested me: You can now use alternative registries to crates.io. I found my next project: write a Rust registry.

Meuse, a registry for your crate

Meuse is a registry written in Clojure. My goal is to create a simple and easy to deploy (and manage) Rust registry. The code is available on Github.

The current status of the project is it works on my computer. There is still a lot of work to do. The code should be refactored and needs more tests. All the authentication/token management part is also missing.

My first goal was to lay the foundation of the project and to discover the difficulties that I could have met. But I already have something interesting:

cargo publish --allow-dirty --registry custom
    Updating `https://github.com/mcorbin/testregistry.git` index
warning: manifest has no license, license-file, documentation, homepage or repository.
See <http://doc.crates.io/manifest.html#package-metadata> for more info.
   Packaging testpublish v0.1.13 (/home/mathieu/prog/rust/testpublish)
   Verifying testpublish v0.1.13 (/home/mathieu/prog/rust/testpublish)
   Compiling testpublish v0.1.13 (/home/mathieu/prog/rust/testpublish/target/package/testpublish-0.1.13)

cargo yank --vers 0.1.13 --registry custom
    Updating `https://github.com/mcorbin/testregistry.git` index
        Yank testpublish:0.1.13

cargo yank --undo --vers 0.1.13 --registry custom
    Updating `https://github.com/mcorbin/testregistry.git` index
      Unyank testpublish:0.1.13

cargo owner --add user1 --registry custom    Updating `https://github.com/mcorbin/testregistry.git` index
       Owner added user(s) user1 as owner(s) of crate testpublish

cargo owner --list --registry custom
    Updating `https://github.com/mcorbin/testregistry.git` index
user1 (user1)

cargo owner --remove user1 --registry custom
    Updating `https://github.com/mcorbin/testregistry.git` index
       Owner removing ["user1"] from crate testpublish

cargo search --registry custom "project" -v
testpublish = "0.1.13"    # This is a description of my project

I can also fetch dependencies from the registry ;)

How it works

Meuse uses PostgreSQL for its database (crates and versions, categories, users…​). Search (very basic for now) is also implemented using PostgreSQL (with the TSVECTOR type).

The rust registries also use a Git repository to store the crates metadata (versions, is a crate yanked or not…​ cf the documentation). Meuse also interacts with a Git repository when a crate is published or yanked.

Finally, crates files containing the source code are also handled by Meuse, which takes care of writing them on disk and exposing them through HTTP (but I also plan to support an S3-compatible backend).

So if you have a PostgreSQL instance, deploying your registry will only require a java -jar.

What’s next

This month, I will work on stabilizing the project and on token management.

In addition of the Cargo API, another API (which I already started) will be created to managed crates categories, users etc…​

I am also thinking of writing a CLI to interact with the project. However, I will not write a graphical interface (I’m too bad a frontend development and I don’t like that), it’s up to you to do it if you want to ;)

I hope I will be able to release a functional version and a bit of documentation at the end of the month.

Appendix: why Clojure ?

Meuse is written in Clojure. Among all the languages I used, Clojure is the one in which I’m most productive.

The Clojure ecosystem is rich, with a lot of good libraries (like Aleph or HoneySQL) and the Clojure REPL (with a reloaded workflow with Mount in my case) is amazing (I will write an article about that one day).

The language is also well designed, the immutability is amazing, so I’m happy with it (and no, I don’t miss static typing).

Top of page