Skip to main content

Mock Server

Generate mock servers from your collections or OpenAPI specs to simulate API responses during development.

Overview

Starting a Mock Server

From Collection

  1. Right-click on a collection
  2. Select Start Mock Server
  3. A new tab opens with mock server controls

Configuration

SettingDescriptionDefault
PortServer port3000
DelayResponse 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

OriginalMock Endpoint
GET /api/usersGET /api/users
POST /api/usersPOST /api/users
GET /api/users/:idGET /api/users/:id

Response Generation

Responses are generated based on:

  1. Saved Response (if available)
  2. OpenAPI Response Schema
  3. 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": "john.smith@example.com",
"createdAt": "2024-01-15T10:30:00Z"
}

Property Name Awareness

Field names influence generated data:

Property NameGenerated Value
emailRealistic email
firstNameFirst name
lastNameLast name
phonePhone number
addressStreet address
cityCity name
countryCountry name
priceCurrency amount
urlValid URL
uuid, idUUID
createdAtISO timestamp

Request Logs

The log panel shows:

ColumnDescription
TimeRequest timestamp
MethodHTTP method
PathRequest path
StatusResponse status
DurationProcessing 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:

  1. Start mock server for Collection A on port 3000
  2. 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:

  1. Click on an endpoint in the mock server
  2. Edit the response:
    • Status code
    • Headers
    • Body

Changes apply immediately.

Best Practices

Realistic Data

Use OpenAPI schemas for the most realistic mock data.

Delay Simulation

Add response delays to simulate real network conditions.

Error Scenarios

Create endpoints that return error responses (400, 500) for testing error handling.

Port Selection

Use consistent ports across your team for shared configurations.