Mockoon CLI screenshot

Mockoon CLI is now available 🥳

Take your mock APIs in all your headless and automated environments with the new CLI: servers, CI, GitHub Action, WSL, etc.

Guillaume, Founder
Posted by Guillaume, Founder
|
newsreleases

After months of work, Mockoon CLI is available in beta 🚀. You can now deploy your mock APIs in all your headless and automated environments. A server, your favorite CI environment, in a GitHub Action, in the Windows Subsystem Linux, you name it!

Like the main application, the CLI is free and open-source. It supports all of Mockoon features, and we tried to make it as fast as possible.

You are one command away to using it. Check the installation instructions, and most of all, let us know what you think and what we could improve on the official forum.

 How does it work

The CLI can directly run a Mockoon environment file. You can either provide the data as a local file or a URL where you host it.

Mockoon CLI start command output

You can also list the running mock API processes to get some information about them (port, PID, CPU, memory, etc.) or stop them completely.

Mockoon CLI list command output

Mockoon CLI supports all of Mockoon's features: templating system, proxy mode, route response rules, etc.

It's also compatible with your data files in an older format as it automatically migrates them before running the mock.

 Implementation details

We chose to create an NPM package as it is a widely used and well-known format. It's also the technology we know best, and we wanted to be sure to create something simple to use, fast and lightweight.

Before actually working on the CLI, we needed first to extract a lot of code from the main application into a new library. Luckily, this part of the main application was already relatively independent. But we still had some challenges and learned a lot about creating a Typescript library 😄.

Under the hood, we used Typescript (as for the main application and the library), Oclif to create the command-line tool, and PM2 to manage your mock API processes. It means that, while we wrap our CLI around all of PM2 commands, you can leverage everything PM2 has to offer if you are used to it!

 Closing thoughts

The CLI was our small 2020 challenge. The biggest struggle was to achieve this while having a full-time job and an infinite list of things to work on for this project: content, features, support, etc. But we like challenges 😅.

We were initially planning a beta release for November. It seems the initial estimation wasn't that off!

We hope that you will love using this tool as much as we loved creating it!

One of the oldest requests from our users (September 2018! 😱) is now closed, but this is just the beginning! More improvements are already in the pipe. Stay tuned!

You might also be interested in these articles

2024 retrospective and Mockoon 7th birthday

Let's take a look back at 2024 (and 2023?) and celebrate Mockoon's 7th birthday!

Read more

Contributor spotlight: Maurice Ackel

We continue our series of interviews with Mockoon's open-source contributors with Maurice Ackel, Full Stack Developer at Netlight.

Read more

Cloud depoyments are available in Mockoon Cloud

The cloud deployments feature is now available for Mockoon Cloud subscribers. Deploy your mock APIs in the cloud and share them with your team.

Read more