Introducing Mockoon: an API mocking desktop application

I just released Mockoon, an easy to use API mocking application that I worked on during the past few months. It allows devs to quickly mock dozen of API routes and run different environments in parallel.

Nice interface, lots of features :)

The application is still in beta but already offers a lot of great features:

  • Run multiple servers in parallel with unlimited number of routes
  • Route regex supported (/.*, /[a-z]{3}, …)
  • Support all HTTP codes and methods
  • Built-in support for OPTIONS pre-flight requests
  • Add unlimited custom headers
  • Latency simulation
  • Customizable body types including files content with automatic mime type detection
  • Rich text editor for body content
  • And some more features to come

Mockoon is available for Windows, Linux and OS X, you can download it here!

Why another app?

All came from a need for our team at work to frequently mock a soon-to-be API or some API’s new routes. Working with Angular (2+) the usual quick (and dirty) way of solving this was to make changes to the services and hardcode some mock responses. But this implied messing up with existing code and required frequent app rebuild not even speaking of the risk of committing the dummy code…

Using online mocking services was only a partial solution. It often required registration, was adding some latency and required us to change the API endpoint for the online service’s domain.

So, I decided to code my own application. But this was also an excuse to tinker with Electron for the first time :).

And after some month of development we are happy users of Mockoon :)

Feel free to give a try to the application and send me some feedback here in the comments, on my Twitter account or directly on Mockoon’s repository where you will also find the opened issues, upcoming features and releases changelogs.

And if you liked the application, spread the word :)

Behind the scene

Mockoon is built with Electron which, in my opinion, offers the easiest path for web developers to build cross-platform desktop apps. It was the first time I used Electron but for me it was an obvious choice and I don’t regret it!

However, Electron does not ship with a front end framework like Angular or React out of the box. So you have to manually add one. I chose to use Angular (4)/Typescript.

Making Electron and Angular / Webpack work together wasn’t the easiest path. Especially because of Angular build system. Using a basic AngularJS (v1) would have been definitely easier. No official boilerplate is provided and all starter apps are different, and sometimes not working anymore with Angular latest versions.

So I decided to create my own starter app (with hot reloading!). I first used Angular CLI which was nearly working but had some incompatibilities with Electron’s NodeJS dependencies (Pro tip: after ejecting add NodeJS dependencies asexternals in the webpack config to avoid bundling them). So, I ejected the app with ng eject to get the actual Webpack build and did some minor changes and voilà! I got my favorite framework running with Electron.

For the UI I used a customized SASS version of Bootstrap 4 beta. They have done an incredible job with this new version and I cannot wait to see the final result.

Again, give a try to the application and do not hesitate to send your feedback, and if you liked the application, spread the word! :)