By Sarah June FischerMarch 26, 2014

Mithril.js: A new JavaScript MVC framework

This small-but-powerful framework is easy to learn and simple to use.

Leo Horie, Senior Web Architect at Klick Health and creator of Mithril.js, shared with us why he created the library and how it will help his fellow developers.

What is Mithril.js?

Mithril is a new javascript MVC framework that aims to make application development more manageable than the “jQuery spaghetti” that is common in legacy systems, and is without the need for steep learning curves that one would encounter with big frameworks like Ember or Angular.

What problems does Mithril solve for JavaScript developers?

It’s designed to be very small (3kb gzipped) but at the same time, it’s packed with “in-the-trenches” experience, and it allows developers a way to create apps that are DRY, easy to maintain and performant. And you don’t even need jQuery.

What are Mithril’s major features and benefits?

One of the first things that stands out about Mithril is the fact that it has a ton of documentation despite having a very small API, which makes it very easy to learn. It’s also surprisingly “magic”-free: there’s very little framework-specific syntax to learn before becoming productive, and you’re always close to the metal — there are no abstractions getting in the way of debugging.

In addition to simple yet deceptively powerful tools for handling data, Mithril provides a state-of-art templating engine that combines the terseness of tools like HAML/Jade with the full expressive power of JavaScript.

If nothing else, it’s worth looking at the guide in the website just to see some how it’s possible to use functional programming in your day-to-day work to turn coding into a learning experience that you can use for the rest of your career.

In fact, one of my “secret” goals with Mithril is to hopefully help people become better developers by making the good practices easy and the bad practices hard. You can find tips on application architecture throughout the guide, from basic MVC organization, to the advanced “battle scars.”

What inspired you to create Mithril?

Despite being a tiny library, Mithril is not just a marketing stunt: for example, when I mention the state-of-art templating engine, I’m not embezzling — the performance techniques that Mithril uses to achieve its rendering speeds are a fruit of a ton of research that is just barely starting to receive attention from the big framework authors. Likewise, the simplicity of the data tools that Mithril provides aren’t just cute syntax tricks: they are a pragmatic application of the years of CS literature on functional composition. Mithril really stands on the shoulders of very tall giants.

How did you pick the name Mithril for this project?

I actually picked the name “Mithril” for this framework because I feel it’s similar to the legendary mineral from Tolkien’s Lord of The Rings. In a world full of MVC frameworks, Mithril has a hard-to-find level of quality, it’s robust, and you can build brilliant things with it.

Try our Mithril.js for yourself, and check out Leo’s blog for more cool projects and insights.