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 most of Mockoon features, and we tried to make it as fast as possible.
The CLI takes a Mockoon data export file and runs the specified environment. You can either provide the data as a local file or a URL where you host it.
You can also list the running mock API processes to get some information about them (port, PID, CPU, memory, etc.) or stop them completely.
It's also compatible with your data files in an older format as it automatically migrates them before running the mock.
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!
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!
Or follow us on TwitterFollow @GetMockoon