https://github.com/xatrarana/mockini
Mock REST API server from a JSON config
https://github.com/xatrarana/mockini
cli json mock-server rest-api
Last synced: 11 months ago
JSON representation
Mock REST API server from a JSON config
- Host: GitHub
- URL: https://github.com/xatrarana/mockini
- Owner: xatrarana
- Created: 2025-07-05T03:10:35.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-07-05T08:23:46.000Z (12 months ago)
- Last Synced: 2025-07-05T08:32:55.522Z (12 months ago)
- Topics: cli, json, mock-server, rest-api
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/mockini
- Size: 6.84 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Roadmap: docs/roadmap.md
Awesome Lists containing this project
README
# โก mockini
mockini is a lightweight CLI tool to instantly spin up mock REST APIs using a simple JSON config file.
Designed for frontend developers, testers, and backend teams who need mock endpoints without writing server logic.
---
## ๐ Features
- โก Zero-config mock server
- ๐ Simple JSON-based route definition
- ๐งฉ Supports GET, POST, PUT, DELETE, etc.
- โจ CLI: `init` to generate config, `start` to launch server
- ๐ง Convention-based: uses `mockini.config.json` by default
- ๐ Built with Bun (but runs as a native CLI via npx/npm)
---
## ๐ฆ Getting Started
### 1. Create a config file
```bash
npx mockini init
```
Creates a file: `./mockini.config.json`
You can also manually create it:
```json
{
"port": 3000,
"routes": [
{
"method": "GET",
"path": "/hello",
"status": 200,
"response": { "message": "Hello, world!" }
}
]
}
```
---
### 2. Start the mock server
```bash
npx mockini start
```
By default, it uses `./mockini.config.json`.
You can override the path with:
```bash
npx mockini start --config ./myconfig.json
```
You can also install globally:
```bash
npm install -g mockini
mockini init
mockini start
```
---
## ๐งฉ CLI Commands
| Command | Description |
| --------------- | ----------------------------------- |
| `mockini init` | Generate a default mock config file |
| `mockini start` | Start mock server from config file |
---
## ๐ Project Structure
```bash
mockini/
โโโ bin/ # CLI entry point
โโโ src/ # Server and init logic
โโโ docs/ # Additional documentation
โโโ mockini.config.json # Default config (generated)
โโโ README.md # This file
```
---
## ๐ Tech Stack
- ๐ Bun (development runtime)
- ๐งช Express (mock server)
- ๐งพ Commander (CLI parser)
---
## ๐ License
MIT ยฉ 2025 Chhatra Rana