https://github.com/marle3003/mokapi
Your API mocking tool for OpenAPI and AsyncAPI using Go and JavaScript - https://mokapi.io
https://github.com/marle3003/mokapi
api-mocking api-simulation api-testing fake javascript kafka ldap mock mock-server mock-testing openapi openapi-tooling openapi2 openapi3 openapi31 rest-api smtp swagger swagger2 testing
Last synced: about 17 hours ago
JSON representation
Your API mocking tool for OpenAPI and AsyncAPI using Go and JavaScript - https://mokapi.io
- Host: GitHub
- URL: https://github.com/marle3003/mokapi
- Owner: marle3003
- License: mit
- Created: 2020-04-12T11:00:42.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2026-02-26T22:11:59.000Z (3 days ago)
- Last Synced: 2026-02-27T03:42:29.966Z (3 days ago)
- Topics: api-mocking, api-simulation, api-testing, fake, javascript, kafka, ldap, mock, mock-server, mock-testing, openapi, openapi-tooling, openapi2, openapi3, openapi31, rest-api, smtp, swagger, swagger2, testing
- Language: Go
- Homepage: https://mokapi.io
- Size: 1.73 GB
- Stars: 46
- Watchers: 1
- Forks: 9
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Your API Mocking Tool for Agile Development
# 🚀 Overview
Mokapi is an open-source tool that helps Agile, DevOps, and Continuous
Deployment teams design, test, and validate APIs before implementation.
It enables rapid prototyping of scenarios—like delayed responses,
failures, or edge cases—without needing a live backend. By simulating
real-world conditions early, Mokapi improves API quality and reduces
the risk of bugs in production.
# ✨ Features
- **Multiple Protocol support**: HTTP, HTTPS, Apache Kafka, SMTP, LDAP
- **Everything as Code**: Reusing, version control, consistency and integrate mocks with your CI/CD.
- **An embedded JavaScript engine** to control everything - status, headers, delays, errors or other edge cases.
- **Patch Configuration** changes for mocking needs, rather than changing the original contract
- **Multiple Provider support**: File, HTTP, GIT, NPM to gather configurations and scripts.
- **Dashboard** to see what's going on.
## 🧩 OpenAPI & AsyncAPI Support
Mokapi supports mocking REST APIs using **OpenAPI 2.0 / 3.0 / 3.1** and event-driven systems using **AsyncAPI**.
## 🔧 Spin Up Mokapi
Install and start Mokapi using one of the following methods.
Replace the URL with your own OpenAPI or AsyncAPI specification.
Windows
```shell
choco install mokapi
mokapi https://petstore31.swagger.io/api/v31/openapi.json
```
MacOS
```shell
brew tap marle3003/tap
brew install mokapi
mokapi https://petstore31.swagger.io/api/v31/openapi.json
```
Docker
```shell
docker run -p 80:80 -p 8080:8080 mokapi/mokapi:latest https://petstore31.swagger.io/api/v31/openapi.json
```
# 🎯 Hit Your First Mock
Once Mokapi is running, you can make requests to your mocked API like so:
```shell
curl http://localhost/api/v31/pet/2 -H 'Accept: application/json'
```
# 🧩 Customize Your Mock with JavaScript
Mokapi makes it simple to control responses using embedded JavaScript.
For example, you can dynamically change the response based on query parameters:
```typescript
import { on } from 'mokapi';
export default function() {
on('http', (request, response) => {
switch (request.path.petId) {
case 2:
response.data.name = 'Betty';
case 9:
response.statusCode = 404;
}
});
}
```
# 🖥️ Dashboard
Mokapi’s dashboard lets you visualize your mock APIs. View requests and responses in real-time, generate and validate sample data for testing.

# 🧪 Learn by Example
Explore tutorials that walk you through mocking different protocols and scenarios:
- 🌍 [Get started with REST API](https://mokapi.io/resources/tutorials/get-started-with-rest-api)\
This tutorial will show you how to mock a REST API using an OpenAPI specification.
- ⚡ [Mocking Kafka with AsyncAPI](https://mokapi.io/resources/tutorials/get-started-with-kafka)\
Mocking a Kafka topic using Mokapi and verifying that a producer generates valid messages.
- 👨💻 [Mocking LDAP Authentication](https://mokapi.io/resources/tutorials/mock-ldap-authentication-in-node)\
Simulate LDAP-based login flows, including group-based permissions.
- 📧 [Mocking SMTP Mail Servers](https://mokapi.io/resources/tutorials/mock-smtp-server-send-mail-using-node)\
Use Mokapi to simulate sending and receiving emails in Node.js apps.
- 🖥️ [End-to-End Testing with Jest and GitHub Actions](https://mokapi.io/resources/tutorials/running-mokapi-in-a-ci-cd-pipeline)\
Integrate Mokapi into your CI pipeline for full-stack E2E testing.
> More examples are available on [mokapi.io/resources](https://mokapi.io/resources)
# 📚 Documentation
- [Get Started](https://mokapi.io/docs/welcome)
- [HTTP](https://mokapi.io/docs/http/overview)
- [Kafka](https://mokapi.io/docs/kafka/overview)
- [LDAP](https://mokapi.io/docs/ldap/overview)
- [SMTP](https://mokapi.io/docs/mail/overview)
- [Javascript API](https://mokapi.io/docs/javascript-api/overview)
- [Resources](https://mokapi.io/resources)
# ☕ Support
Show your love for Mokapi and support the project by grabbing some cool merch!
[Visit the Mokapi Merchandise Store](https://mokapi.myspreadshop.ch) 🔥
If you like Mokapi, consider buying me a coffee:
# 📄 License
This project is licensed under the MIT License. See the [LICENSE](https://github.com/marle3003/mokapi/blob/main/LICENSE) file for details.
