https://github.com/Huseyinnurbaki/mocktail
Free, 11MB, containerized, self-hosted mock server.
https://github.com/Huseyinnurbaki/mocktail
docker go gofiber json-server kubernetes mock mock-api mock-data mock-server react
Last synced: 4 months ago
JSON representation
Free, 11MB, containerized, self-hosted mock server.
- Host: GitHub
- URL: https://github.com/Huseyinnurbaki/mocktail
- Owner: Huseyinnurbaki
- License: mit
- Created: 2020-04-23T22:06:59.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2026-01-25T08:16:58.000Z (4 months ago)
- Last Synced: 2026-01-25T23:11:36.491Z (4 months ago)
- Topics: docker, go, gofiber, json-server, kubernetes, mock, mock-api, mock-data, mock-server, react
- Language: JavaScript
- Homepage:
- Size: 14.9 MB
- Stars: 237
- Watchers: 1
- Forks: 9
- Open Issues: 5
-
Metadata Files:
- Readme: readme.md
- Changelog: changelog.md
- License: LICENSE
Awesome Lists containing this project
README
# Mocktail




[](https://github.com/Huseyinnurbaki/mocktail/actions/workflows/dockerize.yml)

Mocktail is completely free, lightweight (~13MB), self-hosted, containerized mock server with a modern dashboard.
No limitations or restrictions. Mock any HTTP request. Export and import your mocks.
[Quickstart](#quickstart) 🚀 •
[Features](#features) ✨ •
[v3.0 Changes](#v30-changes) 🔥
> **Note:** Looking for v2? See [v2.0.3](https://github.com/Huseyinnurbaki/mocktail/tree/2.0.3) - the last stable v2 release.
## Quickstart
Docker 🐳
## Run Mocktail in a Docker container 🐳
```console
docker run -p 4000:4000 -v $(pwd)/db:/db -d hhaluk/mocktail:3.0.0
```
The `-v $(pwd)/db:/db` flag mounts a local directory to persist your mock data.
### Go to **localhost:4000** 🏃
Docker Compose 🐳
## Run with Docker Compose
```console
docker-compose up -d
```
Or build and run:
```console
docker-compose up -d --build
```
### Go to **localhost:4000** 🏃
The database is automatically persisted in `./mocktail-api/db/` on your host machine.
## Features
- **Create Mock APIs** - Support for GET/POST/PUT/PATCH/DELETE methods
- **Custom Status Codes** - Return any HTTP status (200, 404, 500, etc.) to test error handling
- **Response Delays** - Add 0-30000ms delay to simulate network latency and loading states
- **JSON Editor** - CodeMirror-powered editor with syntax highlighting, error detection, and code folding
- **Code Examples** - Instantly generate cURL, Node.js, Python, and Go code snippets for any endpoint
- **Generate Menu** - Placeholder UI for upcoming AI features (prompt-based generation, array expansion, randomization, anonymization) (In progress)
- **Modern Dashboard** - Clean, intuitive interface built with React and Chakra UI v3
- **Catalog View** - Browse, search, and manage all your mock endpoints with quick actions
- **Quick Edit** - Update status codes and delays instantly via gear icon in catalog
- **Test Endpoints** - Test mocks directly from the catalog list with visual feedback
- **Import/Export** - Export mocks to JSON and import them anywhere
- **Persistent Storage** - SQLite database with volume mounting
- **Multi-Platform** - Native support for amd64 and arm64 (Intel, Apple Silicon, Raspberry Pi)
- **Health Check** - `/health` endpoint for monitoring and orchestration
- **Customizable URLs** - Override display URLs for reverse proxy/custom domain setups
## Configuration
### Environment Variables
**`REACT_APP_MOCKTAIL_URL`** (optional)
Override the Mocktail URL displayed in the dashboard. Useful when deploying behind a reverse proxy or custom domain.
```bash
# Example: Custom domain
REACT_APP_MOCKTAIL_URL=https://api.mycompany.com/mocktail
# Example: Reverse proxy
REACT_APP_MOCKTAIL_URL=https://gateway.example.com/mocktail
```
If not set, defaults to:
- **Development:** `http://localhost:4000/mocktail`
- **Production:** `[your-domain]/mocktail`
## v3.0 Changes
### 🎉 What's New
- **Custom Status Codes & Delays** - Configure HTTP status codes and response delays per endpoint
- **CodeMirror JSON Editor** - Professional code editor with syntax highlighting and error detection
- **Quick Actions** - Test, edit, copy, and delete directly from the catalog list with icon buttons
- **Chakra UI v3** - Complete UI library upgrade with modern components
- **Go 1.24 & GORM v2** - Latest backend stack with improved performance
- **Fiber v2.52** - Updated web framework with security patches
- **Cleaner Architecture** - Improved code organization and consistency
- **Health Endpoint** - `/health` for Docker health checks and monitoring
- **Auto-Setup** - Database directory auto-creates on first run
- **Import/Export UI** - Moved to Catalog tab with better UX
### 🔄 What Changed
- **Import Tab Removed** - Import functionality now in Catalog tab
- **Drag & Drop Removed** - Simplified to native file input
- **react-dropzone Removed** - Reduced dependencies
### ⚠️ Breaking Changes
**v3.0 is not backwards compatible with v2.x databases.**
However, you can migrate your data:
1. In v2, export your mocks to JSON (Catalog → Export)
2. Install v3.0
3. Import the JSON file (Catalog → Import)
Your mock endpoints will work unchanged - only the internal database structure changed.
## Development
Local Development 🏃
### Using Makefile (Recommended)
```console
# Run backend dev server
make dev-api
# Run dashboard dev server (in another terminal)
make dev-dashboard
# Build everything
make build
# Build Docker image
make build-docker
```
### Manual Setup
**Backend:**
```console
cd mocktail-api
go run main.go
```
**Dashboard:**
```console
cd mocktail-dashboard
yarn install
yarn start
```
Backend runs on **localhost:4000**, Dashboard on **localhost:3001**
VSCode debug configuration is included for Go debugging.
### References
- [Changelog](https://github.com/Huseyinnurbaki/mocktail/blob/master/changelog.md)