Using Rust with Elixir for code reuse and performance

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • phoenix_live_view

    Rich, real-time user experiences with server-rendered HTML

  • What's more, Phoenix Live View has made building interactive pages simpler than ever. It often removes the need for a complex front-end framework like React or Vue and an associated API.

  • doctave

    A batteries-included developer documentation site generator

  • Reuse code from our open source documentation generator CLI that is built in Rust

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • earmark

    Markdown parser for Elixir

  • It turned out that making the most popular Elixir Markdown processor, Earmark (originally written by Dave Thomas) and pulldown-cmark, a Rust Markdown processor, produce the same output was going to be difficult. We also required some customization that was not available in both libraries.

  • rust

    Empowering everyone to build reliable and efficient software.

  • Doctave.com is primarily built on the Elixir language. Specifically the Phoenix Web framework. Some key parts of our stack however are built in Rust and in this post we'll examine the reasons why and how this works in practice.

  • pulldown-cmark

    An efficient, reliable parser for CommonMark, a standard dialect of Markdown

  • It turned out that making the most popular Elixir Markdown processor, Earmark (originally written by Dave Thomas) and pulldown-cmark, a Rust Markdown processor, produce the same output was going to be difficult. We also required some customization that was not available in both libraries.

  • doctave-markdown

    Doctave-specific markdown parser

  • In the end we extracted the Markdown processor code from our Rust CLI into its own crate: doctave-markdown. This crate wraps pulldown-cmark with some specific flags and customization, and sanitizes the final HTML.

  • Elixir

    Elixir is a dynamic, functional language for building scalable and maintainable applications

  • Doctave.com is primarily built on the Elixir language. Specifically the Phoenix Web framework. Some key parts of our stack however are built in Rust and in this post we'll examine the reasons why and how this works in practice.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • Rustler

    Safe Rust bridge for creating Erlang NIF functions

  • Luckily, there is a great project called Rustler. It makes implementing NIFs in Rust a breeze. In our case, all we needed was ~100 lines of glue code that mapped Rust data structures to Elixir and did some argument parsing. Then we were ready to call our Rust code from Elixir.

  • benchee

    Easy and extensible benchmarking in Elixir providing you with lots of statistics!

  • First for Elixir. (Measured with Benchee)

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts