Mocklify
Powerful API Mocking for VS Code
Create, manage, and run mock servers directly from your editor. Perfect for frontend development, API prototyping, and testing.
Features •
Installation •
Quick Start •
Documentation •
Shortcuts
✨ Features
🚀 Core Features
- Multiple Mock Servers - Run multiple servers on different ports simultaneously
- Dynamic Responses - Use Handlebars templates with 80+ Faker.js helpers
- Request Matching - Match by headers, query params, and body content
- Response Delays - Simulate network latency with fixed or random delays
- Hot Reload - Changes apply instantly without server restart
🔌 Protocol Support
- HTTP/REST - Full support for all HTTP methods
- GraphQL - Mock queries and mutations with variable substitution
- WebSocket - Real-time event mocking with rooms and broadcast
📥 Import & Export
- OpenAPI/Swagger - Import from OpenAPI 3.0 or Swagger 2.0 specs
- Postman Collections - Import from Postman Collection v2.1
- HAR Export - Export request logs in HTTP Archive format
- cURL Export - Generate cURL commands from logged requests
🎯 Advanced Features
- Proxy Pass-through - Forward requests to real APIs with recording
- Request Recording - Capture real API responses to generate mocks
- Response Sequences - Return different responses based on call count
- Database Integration - Query JSON files or in-memory databases
- Environment Variables - Use variables across routes and servers
🎨 Modern Dashboard
- Beautiful UI - Modern React dashboard with dark/light themes
- Real-time Logs - View request/response logs as they happen
- Search & Filter - Find routes by name, path, method, or tags
- Keyboard Shortcuts - Navigate and control with keyboard
📦 Installation
From VS Code Marketplace
- Open VS Code
- Go to Extensions (
Cmd+Shift+X / Ctrl+Shift+X)
- Search for "Mocklify"
- Click Install
From VSIX File
- Download the
.vsix file
- Open VS Code
- Go to Extensions
- Click
... → "Install from VSIX..."
- Select the downloaded file
🚀 Quick Start
1. Create Your First Server
- Open the Command Palette (
Cmd+Shift+P / Ctrl+Shift+P)
- Type "Mocklify: Create Server"
- Enter a name and port (e.g., "API Server" on port 3000)
2. Add a Route
- Right-click on your server in the Mocklify sidebar
- Select "Add Route"
- Configure your route:
3. Start the Server
- Click the ▶️ play button next to your server
- Your mock API is now running at
http://localhost:3000
4. Test It
curl http://localhost:3000/api/users
📖 Documentation
For full documentation, visit the Mocklify Documentation Site.
Dynamic Responses with Templates
Use Handlebars templates with Faker.js for dynamic data:
{
"id": "{{faker 'string.uuid'}}",
"name": "{{faker 'person.fullName'}}",
"email": "{{faker 'internet.email'}}",
"createdAt": "{{now}}"
}
Available Template Helpers
| Helper |
Description |
Example |
{{faker 'category.method'}} |
Generate fake data |
{{faker 'person.firstName'}} |
{{now}} |
Current ISO timestamp |
2024-01-15T10:30:00.000Z |
{{timestamp}} |
Unix timestamp |
1705315800000 |
{{uuid}} |
Random UUID |
a1b2c3d4-... |
{{randomInt min max}} |
Random integer |
{{randomInt 1 100}} |
{{request.params.id}} |
URL parameter |
Path: /users/:id |
{{request.query.page}} |
Query parameter |
?page=2 |
{{request.body.name}} |
Request body field |
POST body |
Request Matching
Match specific requests with conditions:
{
"matcher": {
"headers": {
"Authorization": "Bearer valid-token"
},
"queryParams": {
"status": "active"
},
"body": {
"type": "jsonPath",
"jsonPath": "$.user.role",
"value": "admin"
}
}
}
Response Sequences
Return different responses based on call count:
{
"response": {
"type": "sequence",
"sequence": [
{ "statusCode": 200, "body": { "attempt": 1 } },
{ "statusCode": 200, "body": { "attempt": 2 } },
{ "statusCode": 429, "body": { "error": "Rate limited" } }
]
}
}
Proxy & Recording
Forward requests to a real API and record responses:
- Start your mock server
- Click "Start Recording"
- Enter the target URL (e.g.,
https://api.example.com)
- Make requests to your mock server
- Stop recording and generate mock routes from captured responses
GraphQL Support
Create GraphQL mocks with operation matching:
{
"path": "/graphql",
"method": "POST",
"matcher": {
"body": {
"type": "jsonPath",
"jsonPath": "$.operationName",
"value": "GetUser"
}
},
"response": {
"body": {
"data": {
"user": {
"id": "{{faker 'string.uuid'}}",
"name": "{{faker 'person.fullName'}}"
}
}
}
}
}
WebSocket Support
Create WebSocket event handlers:
{
"protocol": "websocket",
"path": "/ws",
"routes": [
{
"name": "chat:message",
"path": "ws:chat:message",
"response": {
"body": {
"event": "chat:message",
"data": {
"id": "{{uuid}}",
"message": "{{request.body.message}}",
"timestamp": "{{now}}"
}
}
}
}
]
}
⌨️ Keyboard Shortcuts
Navigation
| Shortcut |
Action |
Cmd/Ctrl + 1 |
Go to Dashboard |
Cmd/Ctrl + 2 |
Go to Servers |
Cmd/Ctrl + 3 |
Go to Routes |
Cmd/Ctrl + 4 |
Go to Databases |
Cmd/Ctrl + 5 |
Go to Logs |
Cmd/Ctrl + 6 |
Go to Settings |
Actions
| Shortcut |
Action |
Cmd/Ctrl + K |
Focus search |
Cmd/Ctrl + N |
Create new item |
Alt + 1-9 |
Select server |
Cmd/Ctrl + Shift + S |
Start server |
Cmd/Ctrl + Shift + X |
Stop server |
Cmd/Ctrl + Shift + L |
Clear logs |
Escape |
Close modal / Clear search |
🗂️ Project Structure
Mocklify stores configuration in a .mocklify folder in your workspace:
.mocklify/
├── servers.json # Server configurations
├── recordings/ # Recorded sessions
└── databases/ # JSON database files
🔧 Configuration
Extension Settings
| Setting |
Default |
Description |
mocklify.autoStart |
false |
Auto-start servers on VS Code launch |
mocklify.defaultPort |
3000 |
Default port for new servers |
mocklify.configPath |
.mocklify |
Configuration directory path |
mocklify.logging.maxEntries |
1000 |
Maximum log entries to keep |
mocklify.logging.includeBody |
true |
Include request/response bodies in logs |
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature)
- Commit your changes (
git commit -m 'Add amazing feature')
- Push to the branch (
git push origin feature/amazing-feature)
- Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
Made with ❤️ by Sitharaj