After at least 6 months of effort (and interruptions… so many interruptions) I have finally completed the complete rewrite of artifact – including rewriting the Web UI to be in rust compiled into web assembly. 2.0 is complete and you can download it here (for linux only ATM)

This release spans a huge amount of effort. The TLDR version:

I felt like I needed a cohesive CLI SDK and so I created the ergo crate. This included several other crates created by me: path_abs for better path handling. std_prelude for glob importing what I need. termstyle for cleaner terminal styles. taken for taking ownership. stfu8 for serializing/deserializing arbitrary bytes that are “mostly” utf8 compliant (i.e. paths).

I used yew for developing the frontend. I ended up contributing a fair amount to both yew and stdweb but these frameworks were surprisingly stable. I also made a few crates: jrpc: for easily creating JSON-RPC requests and handling responses. yew_simple: a simpler (in my opinion) imlementation of several yew services. It is important to note that yew is flexible enough that this is even possible :)



What I ended up with is the first (to my knowledge) full stack application in rust that is more than a toy. Artifact is a reasonably complex piece of software, and rust delivers its promises of speed and stability even at the cutting edge of the web.

Why Rewrite Everything?

The first question is probly why I decided a complete rewrite was necessary. There are two answers: for fun and because I initially wrote artifact when I was just learning rust for the first time and it showed.

I wanted to write artifact “the right way” – using standardized libraries and split into several reusable crates. However, the standardized those libraries didn’t really exist yet (or at least they weren’t cohesive) so I went about building ergo. It was my way of giving back to the fantastic rust community :)

The other reasons to rewrite were:

Speed: I wanted to make the implementation completely parallel, and I did. It is blazingly fast now.

Simplicity: the filesystem interface now has an API which acts like a CRUD database. You simply give it a list of operations (create/modify/delete) and it makes sure they are valid and consistent and performs them. This made implementing the CLI and Server layers trivial, as they could both use this simple interface.

New Features: I added several new features that the old library made difficult to add and test. Sub Artifacts: you can add sub-artifacts using [[.subart]] syntax in the text of any artifact, making it possible to split up the definition of how to implement the artifact in source code. This also includes test subarts ( [[.tst-subart]] ). Markdown format: the default way to specify artifacts is now using an extended form of commonmark markdown. The docs (including the Simple Quality book) are now distributed directly with the web app.



How was WASM / yew?

Rewriting the frontend in rust using yew (and compiling to webassembly) was truly fun and exciting. There was definitely a few areas that needed improvement; and being willing to contribute to fix your own issues was critical with the ecosystem where it is at now – but the responsiveness of the rust developers has never ceased to amaze me.

Probably the most amazing thing about writing your whole stack in a single langauge is code reuse. I have a single crate, artifact-ser with the serialization datatypes and logic that can be used anywhere in the stack. This allows me to implement code once and use it anywhere – a benefit that can seriously not be overstated!

Conclusion

I love rust, it is definitely my favorite language at the moment. Writing a full stack application in pure rust has been an amazing experience.

The highlights however are definitely my interactions with the community. After my Rust and the Great CLI Awakening blog post I was invited to be on the CLI Working Group. Unfortunately, that pulled too much of my time away from rewriting artifact so I had to drop out. However, my experience there and with the WASM folks has been nothing but positive. Its been said before and I’ll say it again: Rust has a great community!

There is still much work to be done for artifact. For one thing I need to figure out how to run cargo-web in CI for mac and windows so that I can distrubute artifact for those platforms. I also need to finish end to end testing (including using frontend testing using rust, more on that later!).

However, one of the primary distractions over the last several months has been interviewing at Google… and the distractions paid off! I will be starting as a Test Engineer at Google working on Android Auto. This is super exciting, but will not leave a lot of time for working on artifact. Therefore this blog post is basically also a notice that I will be on haitus for the next several months as I get up to speed on everything Googly.

If you find artifact valuable, please leave feedback. Help in maintaining it would also be much appreciated :).