Mock Server
Generate mock servers from your collections or OpenAPI specs to simulate API responses during development.
Overview
Starting a Mock Server
From Collection
- Right-click on a collection
- Select Start Mock Server
- A new tab opens with mock server controls
Configuration
| Setting | Description | Default |
|---|---|---|
| Port | Server port | 3000 |
| Delay | Response delay (ms) | 0 |
Mock Server Panel
The mock server tab has two sections:
Left: Configuration
- Port selection
- Start/Stop controls
- Endpoint list
Right: Request Logs
- Incoming requests
- Matched endpoints
- Response details
Generated Endpoints
Mock endpoints are created from:
HTTP Requests
| Original | Mock Endpoint |
|---|---|
GET /api/users | GET /api/users |
POST /api/users | POST /api/users |
GET /api/users/:id | GET /api/users/:id |
Response Generation
Responses are generated based on:
- Saved Response (if available)
- OpenAPI Response Schema
- Smart Fake Data
Smart Fake Data
When an OpenAPI schema is available, Istek generates realistic fake data:
Schema-Based Generation
// Schema
{
"type": "object",
"properties": {
"id": { "type": "integer" },
"name": { "type": "string" },
"email": { "type": "string", "format": "email" },
"createdAt": { "type": "string", "format": "date-time" }
}
}
// Generated Response
{
"id": 42,
"name": "John Smith",
"email": "[email protected]",
"createdAt": "2024-01-15T10:30:00Z"
}
Property Name Awareness
Field names influence generated data:
| Property Name | Generated Value |
|---|---|
email | Realistic email |
firstName | First name |
lastName | Last name |
phone | Phone number |
address | Street address |
city | City name |
country | Country name |
price | Currency amount |
url | Valid URL |
uuid, id | UUID |
createdAt | ISO timestamp |
Request Logs
The log panel shows:
| Column | Description |
|---|---|
| Time | Request timestamp |
| Method | HTTP method |
| Path | Request path |
| Status | Response status |
| Duration | Processing time |
Click a log entry to see:
- Request headers
- Request body
- Response headers
- Response body
Multiple Mock Servers
Run multiple mock servers on different ports:
- Start mock server for Collection A on port 3000
- Start mock server for Collection B on port 3001
Each runs independently.
Use Cases
Frontend Development
Develop frontend without waiting for backend.
Integration Testing
Test against consistent, controlled responses.
Offline Development
Work without internet connectivity using mocked APIs.
Example Workflow
1. Import OpenAPI Spec
# users-api.yaml
paths:
/users:
get:
responses:
'200':
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/User'
2. Start Mock Server
Port: 3000
3. Configure Frontend
// .env.development
API_URL=http://localhost:3000
4. Develop
Your frontend gets realistic fake responses.
Custom Responses
Override generated responses:
- Click on an endpoint in the mock server
- Edit the response:
- Status code
- Headers
- Body
Changes apply immediately.
Best Practices
Use OpenAPI schemas for the most realistic mock data.
Add response delays to simulate real network conditions.
Create endpoints that return error responses (400, 500) for testing error handling.
Use consistent ports across your team for shared configurations.