mimix-cli
v1.0.3
Published
A lightweight, local-first API mock server with strict schema validation.
Maintainers
Readme
Mimix
A zero-friction, local-first API mock server with strict Zod validation.
Links
- GitHub Repository: Pranay-Bhaskar/mimix
- Report a Bug: Open an Issue
Stop wrestling with massive OpenAPI specs just to mock a simple login route. Mimix is designed for modern frontend developers: feed it a basic JSON config, and get a running API with strict schema validation, record/replay proxying, and a live metrics dashboard.
Why does this exist?
Most basic JSON servers don't validate incoming payloads, leaving you to guess if your frontend is sending the right data. On the other end of the spectrum, enterprise mocking tools require writing hundreds of lines of tedious YAML.
Mimix hits the sweet spot. Paste a stringified Zod schema into your config, and your frontend will instantly know if it is sending the wrong data type. Perfect for pairing with LLMs—tell your AI to write a mock.json, and let Mimix serve it.
Features
- Strict Schema Validation: Powered by Zod. If your frontend sends a string instead of a number, Mimix intercepts it and throws a strict
400 Bad Requestexplaining exactly what field is missing. - Record & Replay: Proxy a real backend API, capture its responses, and cache them locally. Ideal for coding offline or when staging servers go down.
- Smart Autoschema: Feed Mimix a raw JSON file, and it will intelligently generate strict Zod schemas for you, detecting UUIDs, dates, and emails.
- Built-in Dashboard: Navigate to
/mimix/dashboardto see live traffic, latency charts, and a log of recent requests. - Hot-Reloading: Tweak your
mock.jsonand the server updates instantly without restarting. - Collision Proof: Automatically finds the next available port if your requested port is busy.
Built With
Mimix is built using a modern, blazing-fast Node.js stack:
- Hono: Ultrafast web framework for the core server.
- Zod: TypeScript-first schema declaration and validation.
- Vitest: Next-generation testing framework.
- Commander.js: For the robust CLI interface.
- VS Code API: Seamless editor integration.
Quick Start
Option 1: VS Code Extension
Search for Mimix in the VS Code Extensions Marketplace and click install. Use the status bar at the bottom right to start and stop your server with one click!
Option 2: CLI Interface
1. Install Globally
npm install -g mimix-cli2. Initialize in your project
mimix init(This creates a blank mock.json file in your current directory).
3. Start the Server
mimix serve -p 3000CLI Commands
mimix serve
Starts the mock server using your mock.json file.
Options:
-p, --port <number>(Default:3000)
UI: Open http://localhost:3000/mimix/dashboard in your browser to view live traffic.
mimix record --proxy <url>
Starts the server in Record & Replay mode.
How it works: The first time you request an endpoint, Mimix fetches it from the real URL and saves the data to recorded_responses.json. Make the same request again, and Mimix serves it instantly from the local cache.
mimix autoschema --from <file.json>
Reads a raw JSON file and automatically generates a strict Zod schema block you can copy and paste directly into your mock.json.
The mock.json API
No heavy schemas required. Just define your method, path, and stringified Zod definitions.
{
"routes": [
{
"method": "POST",
"path": "/api/users",
"schema": {
"body": {
"email": "z.string().email()",
"age": "z.number().min(18)",
"id": "z.string().uuid()"
}
},
"delay": { "min": 200, "max": 500 },
"response": {
"success": true,
"message": "User validated!"
}
}
]
}Contributing
Contributions, issues, and feature requests are always welcome!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'feat: Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
Distributed under the MIT License.
