mynahq
v0.1.1
Published
A fast local API mock server powered by Rust. Mock REST APIs from YAML with one command.
Readme
Mynahq
Mock APIs that mimic real systems — powered by OpenAPI
Mynahq is a lightweight API mock server that simulates real backend behavior using simple YAML configs or OpenAPI specs.
Inspired by the mynah bird — known for mimicking sounds — Mynahq mimics APIs for development and testing.
Features
- ✅ YAML-based mock server
- ✅ Path params (
/users/:id) - ✅ Query matching
- ✅ Header matching
- ✅ Body matching
- ✅ Template variables (
{{params}},{{query}},{{body}}) - ✅ OpenAPI import (3.0.x)
- ✅ Hot reload (
--watch) - ✅ Request logging
- ✅ Response delay simulation
- ✅ Scenario switching
Quick Start (Recommended)
Mynahq provides prebuilt binaries through GitHub Releases, so you do not need Rust installed to use it.
Run instantly with npx
npx mynahq import <open-api-file-name.yaml> --out mock.yaml
npx mynahq serve mock.yaml --watchInstall globally with npm
npm install -g mynahqThen:
mynahq import <open-api-file-name.yaml> --out mock.yaml
mynahq serve mock.yaml --watchInstall with Cargo
cargo install mynahqThen:
mynahq import <open-api-file-name.yaml> --out mock.yaml
mynahq serve mock.yaml --watchDownload Releases
👉 https://github.com/jainmohit535/mynahq-mock-server/releases/latest
Choose the correct release file for your operating system from the release assets.
CLI Commands
mynahq init # generate sample config
mynahq import openapi.yaml --out mock.yaml # generate yaml file from an OpenAPI YAML/JSON file
mynahq import openapi.yaml --out mock.yaml --base-path /api/v1 --port 400 # generate yaml file from an OpenAPI YAML/JSON file and use custome base path and port
mynahq serve <file> # start mock server
mynahq validate <file> # validate config
mynahq routes <file> # list routes
mynahq import <file> # import OpenAPI
OpenAPI import
Generate a Mynahq config from an OpenAPI YAML/JSON file:
./mynahq-macos-arm64 import examples/openapi.yaml --out generated-mock.yamlConfig example
server:
host: 127.0.0.1
port: 3000
cors: true
routes:
- method: GET
path: /users/:id
response:
status: 200
delay: 1000
body:
id: "{{params.id}}"
name: "User {{params.id}}"Why Mynahq?
- Develop frontend without backend dependencies
- Simulate real APIs quickly
- Test different API scenarios easily
- Replace complex mock setups with simple YAML
License
MIT
