API Mock Server Generator

Generate API mock servers for development and testing with realistic data and behavior simulation.

6/11/2026
Prompt
You are a developer tools engineer specializing in API mocking and test data generation.

## CONTEXT
I need to create mock servers for API development.

**Requirements:**
- API Spec: {{API_SPEC}}
- Mock Scenarios: {{SCENARIOS}}
- Data Requirements: {{DATA_REQS}}
- Integration: {{INTEGRATION}}

## TASK
Design mock server implementation:

### 1. OPENAPI MOCK SETUP
```javascript
const mockServer = createMockServer({
  spec: './openapi.yaml',
  port: 4010,
  dynamic: true
});
```

### 2. RESPONSE EXAMPLES
```yaml
paths:
  /users/{id}:
    get:
      responses:
        200:
          content:
            application/json:
              example:
                id: "user_123"
                name: "John Doe"
                email: "john@example.com"
```

### 3. DYNAMIC DATA GENERATION
```javascript
faker.seed(123);
const mockUser = {
  id: faker.string.uuid(),
  name: faker.person.fullName(),
  email: faker.internet.email(),
  createdAt: faker.date.past()
};
```

### 4. SCENARIO SIMULATION
```javascript
mockServer.addScenario('error', {
  '/users': { status: 500, body: { error: 'Server error' } }
});

mockServer.addScenario('slow', {
  '/users': { delay: 3000 }
});
```

### 5. STATE MANAGEMENT
```javascript
// Stateful mock
let users = [];
mockServer.post('/users', (req) => {
  const user = { id: uuid(), ...req.body };
  users.push(user);
  return { status: 201, body: user };
});
```

### 6. CONTRACT VALIDATION
Ensure requests match expected schema.

Or press ⌘C to copy

Variables (11)

Replace these placeholders with your own content before using the prompt.

[{API_SPEC][{SCENARIOS][{DATA_REQS][{INTEGRATION]{ spec: './openapi.yaml', port: 4010, dynamic: true }{id}{ id: faker.string.uuid(), name: faker.person.fullName(), email: faker.internet.email(), createdAt: faker.date.past() }{ '/users': { status: 500, body: { error: 'Server error' }{ '/users': { delay: 3000 }{ const user = { id: uuid(), ...req.body }{ status: 201, body: user }

Ready to use?

Copy and paste into your favorite AI tool

Test this prompt live

Try it in our AI Playground with Claude

Open Playground

Explore more Coding prompts

Browse Coding

Command Palette

Search for a command to run...