Open sourcing the Mycroft Backend

Originally published at: http://mycroft.ai/blog/open-sourcing-the-mycroft-backend/

“You can’t claim to be an open source company unless all your code is open source.” This, or a variation of it, is something we hear a lot. All of the software running on a device using the Mycroft stack has been open source for years. But we have kept what we call the “backend” (web applications, APIs, etc.) in private repositories.

Why not make the backend open source? Well, something else we are often asked is “How does Mycroft make money if the software is free and the data collected is not sold?”. One potential revenue stream is leveraging our backend software. There was concern that open sourcing the code could prevent us from realising any of this revenue.

On the other hand, there are some benefits to releasing the backend code into the wild. One of these benefits is that Mycroft has a great community of developers contributing to our open source repositories. Mycroft is a small company so presenting the community with an opportunity to supplement our efforts makes a lot of sense. Making the backend code available to the public also shows that our code does what we say it does, a demonstration of Mycroft’s commitment to transparency and privacy.

So, we started asking ourselves if there was a way to generate revenue from our backend and make it open source. We wanted to go all Hannah Montana and get the best of both worlds!

Enter the AGPL 3.0 license. I know this license has its fair share of detractors, but the arguments against it are usually not from the point of view of the small startup publishing the source code. In our case, this license allows us to make the source code available for anyone to use and pursue dual licensing when dealing with our enterprise customers.

Introducing… Selene

We call the backend product “Selene”, named after one of Mycroft’s aliases in The Moon is a Harsh Mistress, Adam Selene. Selene consists of two repositories:

  • The selene-ui repository is three web applications written in the Angular framework (account, marketplace and single sign on). It is licensed under Apache 2.0. There is no business logic in this repository. It is purely a thin UI layer that displays the data retrieved from the API.
  • The selene-backend repository is a Python and SQL implementation of APIs, database schemas and scripts. It is licensed under AGPL 3.0. There are four APIs, one for each of the web applications in the selene-ui repository and the API used by Mycroft Core. This repository also contains library code shared by each of the APIs and the DDL necessary to build a Postgres database.

The README files in each repository give detailed instructions on how to setup your own instance of Selene. It is built to be lightweight. I can run the entire code base on my high-end laptop. In production, we run it on a handful of small virtual machines.

I know many of you have been looking forward to this for quite some time. As with all our open-source repositories, we appreciate any contributions no matter how big or small. On a personal note, the UI code represents my first foray into using Angular. I remember how awful my first lines of Python code were years ago. Feedback from any seasoned Angular developers out there would be appreciated!

6 Likes

It’s awesome that you have open-sourced the backend, and I’m looking forward to reading it and understanding your thought process.

I’m very curious how exactly the AGPL helps to protect your ability to leverage your back end. My (limited) understanding is that AGPL just requires that if someone takes your server software and sets up their own server with some modifications, then they have to make the source of their modifications available. I’m not sure how that helps, or how partners and enterprises can leverage it. Are you thinking remote projects like the ISS, or sensitive projects like hospitals? If a hospital decided to set up their own system and simply made the source code available within their system, or even in a public github fork, how would that benefit your project?

The funding of open source projects is an interesting topic, and I’m always interested in hearing how people have been able to fund projects.

Hi there, welcome the forums :slight_smile:

It’s a good question, and the short answer is dual licensing.

As you’ve said, the server being available under AGPL means that anyone can use it and modify it if they open source their modifications. This is great for other open source projects or personal usage. Mycroft can then incorporate any modifications that make sense for Mycroft.

It’s also possible that a large corporate would do the same, however whilst open source has gained traction in the corporate world, it’s still a small fraction of companies that engage with it in any meaningful way. Unfortunately most don’t fully understand the benefits or have the systems in place to manage open source projects of their own.

To be honest, open source still freaks out a lot of companies. Most would rather pay to use the software under another license where they are not required to release their code.