Introducing a Better Mantra

With a modular architecture and many other minor improvements

Arunoda Susiripala
KADIRA VOICE
3 min readFeb 3, 2016

--

We released the first draft of the Mantra specification in early January and got great feedback and contributions from the community. As a result of those contributions, today we are releasing Mantra 0.2.

Let’s see what’s new in Mantra 0.2.

Modular Architecture

This is our issue no: 3 in Github:

In this issue, everyone is asking for a modular directory structure for Mantra. Although this sounds like a simple thing to do, we had to work a bit harder to accomplish it. That’s because Mantra is not just a boilerplate. All the core components, like Actions, Containers, and the Application Context, must work properly with the module system.

Finally, we have come up with the design that works best for us. Here it is:

This module system is designed for the future and we will be able to distribute these modules via NPM.

Client Side Focus

From the start, Mantra has been designed for the client side of your app. We hadn’t clearly mentioned that before. Now we have documented it in the specification and show why we picked that approach.

But, we always have a server side to our app as well, and it’s also an important part of the app. You can use our suggested directory layout for the server side.

Have a look at it: Server Side Directory Layout

This directory layout is not a part of Mantra, but is very close to what we do with Mantra.

Improved Testing Tools

Testing is a core part of Mantra and we had a great testing setup from the beginning. Now we have a much better setup.

Test Watching

Now you can watch tests and they’ll re-run as you change your code or tests.

As an example, try running tests in the sample repo using the following command:

It will watch tests and re-run them. Basically, tests run in under a few milliseconds as you change the source code or test code. This gives us a much better testing experience.

Wallaby.js Support

Wallaby.js is a testing tool that integrates your tests nicely with your IDE to give you a much better testing experience.

Wallaby.js support has already been added to Mantra. See our sample repo and this issue.

Updated Specification

We have updated the specification for the new module system and added some appendices for the server-side directory layout, organizing modules, and file naming conventions.

What’s Next?

Now we have a much better version of Mantra, and it’s pretty stable. Have a look at the specification to see what we have planned for the future.

In the coming weeks, we’ll work on building a few tools for Mantra. These tools will improve your Mantra experience. Have a look at our roadmap for more information.

In addition to tools, we will also have more content on Mantra Tutor. Stay tuned.

Help Us

As usual, we won’t be able to make this kind of progress without your support.

Follow KADIRA VOICE for more articles like this.

--

--