{"id":20330301,"url":"https://github.com/huseyinnurbaki/mocktail","last_synced_at":"2026-03-02T17:13:32.985Z","repository":{"id":38149165,"uuid":"258341966","full_name":"Huseyinnurbaki/mocktail","owner":"Huseyinnurbaki","description":"Free, 13MB, containerized, self-hosted mock server.","archived":false,"fork":false,"pushed_at":"2026-02-28T09:44:22.000Z","size":16557,"stargazers_count":241,"open_issues_count":10,"forks_count":10,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-28T14:47:26.893Z","etag":null,"topics":["docker","go","gofiber","json-server","kubernetes","mock","mock-api","mock-data","mock-server","react"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Huseyinnurbaki.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-04-23T22:06:59.000Z","updated_at":"2026-02-28T09:44:26.000Z","dependencies_parsed_at":"2024-06-19T02:55:34.657Z","dependency_job_id":"27d96efe-bafa-4860-8a3a-df031257f54f","html_url":"https://github.com/Huseyinnurbaki/mocktail","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/Huseyinnurbaki/mocktail","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Huseyinnurbaki%2Fmocktail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Huseyinnurbaki%2Fmocktail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Huseyinnurbaki%2Fmocktail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Huseyinnurbaki%2Fmocktail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Huseyinnurbaki","download_url":"https://codeload.github.com/Huseyinnurbaki/mocktail/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Huseyinnurbaki%2Fmocktail/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30011525,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-02T17:00:27.440Z","status":"ssl_error","status_checked_at":"2026-03-02T17:00:03.402Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","go","gofiber","json-server","kubernetes","mock","mock-api","mock-data","mock-server","react"],"created_at":"2024-11-14T20:15:50.674Z","updated_at":"2026-03-02T17:13:32.975Z","avatar_url":"https://github.com/Huseyinnurbaki.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# Mocktail\n\n![Docker Image Version (latest by date)](https://img.shields.io/docker/v/hhaluk/mocktail?color=blue\u0026logo=docker)\n![Docker Image Size (latest by date)](https://img.shields.io/docker/image-size/hhaluk/mocktail?color=B4D4A55\u0026logo=docker)\n![Docker Image Version (latest semver)](https://img.shields.io/docker/v/hhaluk/mocktail?label=stable-version\u0026logo=docker\u0026sort=semver\u0026style=flat-square)\n![GitHub release (latest SemVer including pre-releases)](https://img.shields.io/github/v/release/Huseyinnurbaki/mocktail?include_prereleases\u0026logo=github)\n[![Docker Build CI](https://github.com/Huseyinnurbaki/mocktail/actions/workflows/dockerize.yml/badge.svg?branch=master)](https://github.com/Huseyinnurbaki/mocktail/actions/workflows/dockerize.yml)\n![Docker Pulls](https://img.shields.io/docker/pulls/hhaluk/mocktail?color=gray\u0026logo=docker)\n\nMocktail is completely free, lightweight (~13MB), self-hosted, containerized mock server with a modern dashboard.\n\nNo limitations or restrictions. Mock any HTTP request. Export and import your mocks.\n\n[Quickstart](#quickstart) 🚀 •\n[Features](#features) ✨ •\n[Changelog](changelog.md) 📋 •\n[v3.0 Changes](#v30-changes) 🔥\n\n\u003e **Note:** Looking for v2? See [v2.0.3](https://github.com/Huseyinnurbaki/mocktail/tree/2.0.3) - the last stable v2 release.\n\n\u003c/div\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/Huseyinnurbaki/notes/blob/master/Storage/mocktail_V3.gif?raw=true\" alt=\"mocktail_gif\" /\u003e\n\u003c/p\u003e\n\n## Quickstart\n\n\u003cdetails\u003e\n  \u003csummary\u003eDocker 🐳\u003c/summary\u003e\n\n## Run Mocktail in a Docker container 🐳\n\n```console\ndocker run -p 4000:4000 -v $(pwd)/db:/db -d hhaluk/mocktail:3.1.6\n```\n\nThe `-v $(pwd)/db:/db` flag mounts a local directory to persist your mock data.\n\n### Go to **localhost:4000** 🏃\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eDocker Compose 🐳\u003c/summary\u003e\n\n## Run with Docker Compose\n\n```console\ndocker-compose up -d\n```\n\nOr build and run:\n\n```console\ndocker-compose up -d --build\n```\n\n### Go to **localhost:4000** 🏃\n\nThe database is automatically persisted in `./mocktail-api/db/` on your host machine.\n\n\u003c/details\u003e\n\n## Features\n\n- **Create Mock APIs** - Support for GET/POST/PUT/PATCH/DELETE methods\n- **Custom Status Codes** - Return any HTTP status (200, 404, 500, etc.) to test error handling\n- **Response Delays** - Add 0-30000ms delay to simulate network latency and loading states\n- **JSON Editor** - CodeMirror-powered editor with syntax highlighting, error detection, and code folding\n- **Code Examples** - Instantly generate cURL, Node.js, Python, and Go code snippets for any endpoint\n- **Randomize \u0026 Anonymize** ⚠️ _Beta_ - Generate realistic fake data with 20+ faker types plus Custom (fixed value) and AI Generate (prompt-based) modes, with per-field configuration, live preview, and \"apply same value to all\" support\n- **Irregular Array Support** - Handles arrays with inconsistent object structures, showing field frequency and applying configs selectively\n- **Modern Dashboard** - Clean, intuitive interface built with React and Chakra UI v3\n- **Catalog View** - Browse, search, and manage all your mock endpoints with quick actions and persistent selection\n- **Quick Edit** - Update status codes and delays instantly via gear icon in catalog\n- **Test Endpoints** - Test mocks directly from the catalog list with visual feedback\n- **Import/Export** - Export mocks to JSON and import them anywhere\n- **Persistent Storage** - SQLite database with volume mounting\n- **Multi-Platform** - Native support for amd64 and arm64 (Intel, Apple Silicon, Raspberry Pi)\n- **Health Check** - `/health` endpoint for monitoring and orchestration\n- **Customizable URLs** - Override display URLs for reverse proxy/custom domain setups\n\n## MCP Server (AI Integration)\n\nMocktail includes an [MCP (Model Context Protocol)](https://modelcontextprotocol.io) server that lets AI assistants like Claude manage your mock endpoints through natural language. Available on npm as [`mocktail-mcp`](https://www.npmjs.com/package/mocktail-mcp).\n\n**Examples:** \"List all my mocks\", \"Create a GET /api/users mock returning a list of users\", \"Import mock endpoints for a blog API.\"\n\n### Available Tools\n\n| Tool           | Description                                   |\n| -------------- | --------------------------------------------- |\n| `list_mocks`   | List all configured mock endpoints            |\n| `create_mock`  | Create a single mock endpoint                 |\n| `update_mock`  | Update an existing mock by ID                 |\n| `delete_mock`  | Delete a mock by ID                           |\n| `import_mocks` | Bulk import multiple mocks (skips duplicates) |\n\n### Setup\n\n\u003cdetails\u003e\n  \u003csummary\u003enpx (Recommended)\u003c/summary\u003e\n\n#### Claude Code\n\n```bash\nclaude mcp add mocktail \\\n  -e MOCKTAIL_URL=http://localhost:4000 \\\n  -e MOCKTAIL_API_KEY=your-api-key \\\n  -- npx mocktail-mcp\n```\n\n#### Claude Desktop\n\nAdd to your config file (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):\n\n```json\n{\n  \"mcpServers\": {\n    \"mocktail\": {\n      \"command\": \"npx\",\n      \"args\": [\"mocktail-mcp\"],\n      \"env\": {\n        \"MOCKTAIL_URL\": \"http://localhost:4000\",\n        \"MOCKTAIL_API_KEY\": \"your-api-key\"\n      }\n    }\n  }\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eFrom source (Development)\u003c/summary\u003e\n\nIf you cloned the repo and want to run the MCP server locally:\n\n#### Claude Code\n\n```bash\nclaude mcp add mocktail \\\n  -e MOCKTAIL_URL=http://localhost:4000 \\\n  -e MOCKTAIL_API_KEY=your-api-key \\\n  -- node /path/to/mocktail/mcp-server/index.js\n```\n\n#### Claude Desktop\n\n```json\n{\n  \"mcpServers\": {\n    \"mocktail\": {\n      \"command\": \"node\",\n      \"args\": [\"/path/to/mocktail/mcp-server/index.js\"],\n      \"env\": {\n        \"MOCKTAIL_URL\": \"http://localhost:4000\",\n        \"MOCKTAIL_API_KEY\": \"your-api-key\"\n      }\n    }\n  }\n}\n```\n\n\u003c/details\u003e\n\n**Environment Variables:**\n\n| Variable           | Required | Description                                                       |\n| ------------------ | -------- | ----------------------------------------------------------------- |\n| `MOCKTAIL_URL`     | Yes      | Base URL of your Mocktail instance (e.g. `http://localhost:4000`) |\n| `MOCKTAIL_API_KEY` | No       | API key sent as `X-API-Key` header on all requests                |\n\n\u003e **Note:** If you configured `MOCKTAIL_BASE_URL` for a custom domain or reverse proxy, use that same URL for `MOCKTAIL_URL` (e.g. `https://api.mycompany.com/mocktail` becomes `MOCKTAIL_URL=https://api.mycompany.com`).\n\n\u003e See [`mcp-server/README.md`](mcp-server/README.md) for more details.\n\n## Configuration\n\n### Environment Variables\n\n**`MOCKTAIL_BASE_URL`** (optional)\n\nOverride the Mocktail URL displayed in the dashboard. Useful when deploying behind a reverse proxy or custom domain.\n\n\u003e **Note:** The legacy `REACT_APP_MOCKTAIL_URL` environment variable is still supported for backwards compatibility.\n\n```bash\n# Example: Custom domain\nMOCKTAIL_BASE_URL=https://api.mycompany.com/mocktail\n\n# Example: Reverse proxy\nMOCKTAIL_BASE_URL=https://gateway.example.com/mocktail\n```\n\nIf not set, defaults to:\n\n- **Development:** `http://localhost:4000/mocktail`\n- **Production:** `[your-domain]/mocktail`\n\n**CORS Configuration** (optional)\n\nConfigure Cross-Origin Resource Sharing (CORS) policies for the mock API.\n\n```bash\n# Allowed origins (comma-separated)\n# Default: * (allow all)\nMOCKTAIL_CORS_ORIGINS=https://myapp.com,http://localhost:3000\n\n# Allowed HTTP methods (comma-separated)\n# Default: GET,POST,PUT,PATCH,DELETE,OPTIONS\nMOCKTAIL_CORS_METHODS=GET,POST,PUT,DELETE\n\n# Allowed headers (comma-separated)\n# Default: * (allow all)\nMOCKTAIL_CORS_HEADERS=Content-Type,Authorization,X-API-Key\n\n# Allow credentials (cookies, auth headers)\n# Default: false\nMOCKTAIL_CORS_CREDENTIALS=true\n```\n\n**Docker Example:**\n\n```bash\ndocker run -p 4000:4000 \\\n  -e MOCKTAIL_CORS_ORIGINS=https://myapp.com \\\n  -e MOCKTAIL_CORS_CREDENTIALS=true \\\n  hhaluk/mocktail:latest\n```\n\n**Docker Compose Example:**\n\n```yaml\nservices:\n  mocktail:\n    image: hhaluk/mocktail:latest\n    ports:\n      - \"4000:4000\"\n    environment:\n      MOCKTAIL_CORS_ORIGINS: \"https://myapp.com,http://localhost:3000\"\n      MOCKTAIL_CORS_CREDENTIALS: \"true\"\n    volumes:\n      - ./db:/db\n```\n\n**⚠️ Important Security Rule:**\n\n**DO NOT combine wildcard origins with credentials:**\n\n```bash\n# ❌ INVALID - Browsers will reject this combination\nMOCKTAIL_CORS_ORIGINS=*\nMOCKTAIL_CORS_CREDENTIALS=true\n\n# ✅ VALID - Use specific origins with credentials\nMOCKTAIL_CORS_ORIGINS=https://myapp.com,http://localhost:3000\nMOCKTAIL_CORS_CREDENTIALS=true\n\n# ✅ VALID - Use wildcard without credentials (default)\nMOCKTAIL_CORS_ORIGINS=*\nMOCKTAIL_CORS_CREDENTIALS=false\n```\n\nWhen `MOCKTAIL_CORS_CREDENTIALS=true`, you **must** specify exact origins (no `*` wildcard).\n\n**`MOCKTAIL_API_KEY`** (optional)\n\nProtect mock endpoints with API key authentication. When set, all requests to `/mocktail/*` must include the API key.\n\n```bash\n# Set API key\nMOCKTAIL_API_KEY=your-secret-key-here\n```\n\n**Usage:**\n\nClients must provide the key via header or query parameter:\n\n```bash\n# Via header (recommended)\ncurl http://localhost:4000/mocktail/users \\\n  -H \"X-API-Key: your-secret-key-here\"\n\n# Via query parameter\ncurl http://localhost:4000/mocktail/users?api_key=your-secret-key-here\n```\n\n**What's Protected:**\n\n- 🔒 Mock endpoints (`/mocktail/*`) - Requires API key\n- ✅ Dashboard (`/`) - No auth needed\n- ✅ Core API (`/core/v1/*`) - No auth needed (dashboard uses this)\n- ✅ Health check (`/health`) - No auth needed\n\n**Security Note:** If not set, mock endpoints are open (no authentication). This is fine for local development or private networks.\n\n## Recent Changes\n\nSee the full [Changelog](changelog.md) for all release notes.\n\n**v3.1.6** — Backend \u0026 MCP endpoint leading-slash normalization (fixes `/mocktail//posts/1`-style double-slash URLs)\n\n**v3.1.5** — MCP endpoint path normalization (fixes double slashes), catalog pagination\n\n**v3.1.4** — MCP Server AI integration (`npx mocktail-mcp`), Randomize \u0026 Anonymize UX overhaul (three-column layout, Custom \u0026 AI Generate types)\n\n**v3.1.3** — Backend Logs tab with real-time monitoring, enhanced code examples with API key support, critical Go string mutation bugfix\n\n**v3.1.2** — API key authentication, configurable CORS, `.env` file support\n\n**v3.1.1** — Cross-reference detection, review modal, Randomize \u0026 Anonymize improvements\n\n## v3.0 Changes\n\n### 🎉 What's New\n\n- **Custom Status Codes \u0026 Delays** - Configure HTTP status codes and response delays per endpoint\n- **CodeMirror JSON Editor** - Professional code editor with syntax highlighting and error detection\n- **Quick Actions** - Test, edit, copy, and delete directly from the catalog list with icon buttons\n- **Chakra UI v3** - Complete UI library upgrade with modern components\n- **Go 1.24 \u0026 GORM v2** - Latest backend stack with improved performance\n- **Fiber v2.52** - Updated web framework with security patches\n- **Cleaner Architecture** - Improved code organization and consistency\n- **Health Endpoint** - `/health` for Docker health checks and monitoring\n- **Auto-Setup** - Database directory auto-creates on first run\n- **Import/Export UI** - Moved to Catalog tab with better UX\n\n### 🔄 What Changed\n\n- **Import Tab Removed** - Import functionality now in Catalog tab\n- **Drag \u0026 Drop Removed** - Simplified to native file input\n- **react-dropzone Removed** - Reduced dependencies\n\n### ⚠️ Breaking Changes\n\n**v3.0 is not backwards compatible with v2.x databases.**\n\nHowever, you can migrate your data:\n\n1. In v2, export your mocks to JSON (Catalog → Export)\n2. Install v3.0\n3. Import the JSON file (Catalog → Import)\n\nYour mock endpoints will work unchanged - only the internal database structure changed.\n\n## Development\n\n\u003cdetails\u003e\n  \u003csummary\u003eLocal Development 🏃\u003c/summary\u003e\n\n### Using Makefile (Recommended)\n\n```console\n# Run backend dev server\nmake dev-api\n\n# Run dashboard dev server (in another terminal)\nmake dev-dashboard\n\n# Build everything\nmake build\n\n# Build Docker image\nmake build-docker\n```\n\n### Manual Setup\n\n**Backend:**\n\n```console\ncd mocktail-api\ngo run main.go\n```\n\n**Dashboard:**\n\n```console\ncd mocktail-dashboard\nyarn install\nyarn start\n```\n\nBackend runs on **localhost:4000**, Dashboard on **localhost:3001**\n\nVSCode debug configuration is included for Go debugging.\n\n\u003c/details\u003e\n\n### References\n\n- [Changelog](https://github.com/Huseyinnurbaki/mocktail/blob/master/changelog.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuseyinnurbaki%2Fmocktail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhuseyinnurbaki%2Fmocktail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuseyinnurbaki%2Fmocktail/lists"}