Faker Templates

Generate realistic fake data with Faker. Works in both HTTP endpoints and WebSocket responses.

Introduction

Faker templates allow you to generate realistic, dynamic data in your mock responses. Use the {{faker.method}} syntax in your JSON responses to automatically generate data.

Info

Works in: HTTP endpoints, WebSocket auto-responses, Schema generation

Syntax Formats

Two formats are supported:

Simple Format

JSON
"{{faker.uuid}}"

Nested Format (Recommended)

JSON
"{{faker.person.fullName}}"

Person

TemplateExample Output
{{faker.person.fullName}}John Doe
{{faker.person.firstName}}Jane
{{faker.person.lastName}}Smith
{{faker.person.middleName}}Marie
{{faker.person.email}}jane.smith@example.com
{{faker.person.gender}}Female
{{faker.person.jobTitle}}Software Engineer
{{faker.person.bio}}Lover of travel and coffee...

Date & Time

TemplateExample Output
{{faker.date.past}}2024-01-15T10:30:00.000Z
{{faker.date.future}}2027-06-20T14:45:00.000Z
{{faker.date.recent}}2026-02-25T09:15:00.000Z
{{faker.date.soon}}2026-02-28T12:00:00.000Z
{{faker.date.birthdate}}1985-07-10T00:00:00.000Z
{{faker.date.month}}March
{{faker.date.weekday}}Monday

Location

TemplateExample Output
{{faker.location.city}}New York
{{faker.location.country}}United States
{{faker.location.countryCode}}US
{{faker.location.street}}123 Main Street
{{faker.location.state}}California
{{faker.location.zipCode}}10001
{{faker.location.latitude}}40.7128
{{faker.location.longitude}}-74.0060

Internet

TemplateExample Output
{{faker.internet.url}}https://example.com
{{faker.internet.email}}user@example.com
{{faker.internet.username}}john_doe123
{{faker.internet.password}}xK9#mP2$
{{faker.internet.ip}}192.168.1.1
{{faker.internet.ipv4}}192.168.1.100
{{faker.internet.ipv6}}2001:0db8:85a3:0000:0000:8a2e:0370:7334
{{faker.internet.mac}}00:1A:2B:3C:4D:5E
{{faker.internet.userAgent}}Mozilla/5.0...

Commerce & Finance

TemplateExample Output
{{faker.commerce.productName}}Ergonomic Wooden Chair
{{faker.commerce.price}}42.00
{{faker.commerce.department}}Electronics
{{faker.finance.currencyCode}}USD
{{faker.finance.amount}}99.99
{{faker.finance.bitcoinAddress}}1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2
{{faker.finance.iban}}DE89 3704 0044 0532 0130 00

Data Types

TemplateExample Output
{{faker.string.uuid}}550e8400-e29b-41d4-a716-446655440000
{{faker.string.alpha}}abcDEF
{{faker.string.alphanumeric}}abc123DEF456
{{faker.string.numeric}}1234567890
{{faker.number.int}}42
{{faker.number.float}}42.5
{{faker.datatype.boolean}}true

Lorem (Text)

TemplateExample Output
{{faker.lorem.word}}lorem
{{faker.lorem.words}}lorem ipsum dolor
{{faker.lorem.sentence}}Lorem ipsum dolor sit amet.
{{faker.lorem.sentences}}Two sentences here.
{{faker.lorem.paragraph}}Multiple sentences...

Vehicle

TemplateExample Output
{{faker.vehicle.vehicle}}Toyota Camry
{{faker.vehicle.manufacturer}}Toyota
{{faker.vehicle.model}}Camry
{{faker.vehicle.color}}Red
{{faker.vehicle.fuel}}Electric
{{faker.vehicle.vin}}1G1YY22G965104590

Music

TemplateExample Output
{{faker.music.songName}}Bohemian Rhapsody
{{faker.music.artist}}Queen
{{faker.music.album}}A Night at the Opera
{{faker.music.genre}}Rock

Image

TemplateExample Output
{{faker.image.avatar}}https://cloudflare-ipfs.com/...
{{faker.image.url}}https://placehold.co/600x400

Practical Examples

HTTP Endpoint Response

JSON
{
  "path": "/api/users",
  "method": "GET",
  "response": {
    "id": "{{faker.string.uuid}}",
    "name": "{{faker.person.fullName}}",
    "email": "{{faker.internet.email}}",
    "avatar": "{{faker.image.avatar}}",
    "address": {
      "city": "{{faker.location.city}}",
      "country": "{{faker.location.country}}",
      "zipCode": "{{faker.location.zipCode}}"
    },
    "createdAt": "{{faker.date.past}}",
    "isActive": "{{faker.datatype.boolean}}"
  }
}

WebSocket Auto-Response

JSON
{
  "path": "/ws/chat",
  "eventType": "message",
  "response": {
    "id": "{{faker.string.uuid}}",
    "user": {
      "name": "{{faker.person.fullName}}",
      "avatar": "{{faker.image.avatar}}"
    },
    "message": "{{faker.lorem.sentence}}",
    "timestamp": "{{faker.date.recent}}"
  },
  "delay": 500
}

Notification Endpoint

JSON
{
  "path": "/ws/notifications",
  "eventType": "message",
  "response": {
    "id": "{{faker.string.uuid}}",
    "type": "notification",
    "title": "{{faker.commerce.productName}}",
    "message": "{{faker.lorem.paragraph}}",
    "user": {
      "id": "{{faker.string.uuid}}",
      "name": "{{faker.person.fullName}}",
      "email": "{{faker.internet.email}}"
    },
    "priority": "{{faker.number.int}}",
    "read": "{{faker.datatype.boolean}}",
    "createdAt": "{{faker.date.recent}}"
  },
  "delay": 1000
}

Quick Reference

Commonly used aliases (simpler format):

AliasEquivalent To
{{faker.uuid}}{{faker.string.uuid}}
{{faker.email}}{{faker.internet.email}}
{{faker.name}}{{faker.person.fullName}}
{{faker.firstName}}{{faker.person.firstName}}
{{faker.lastName}}{{faker.person.lastName}}
{{faker.city}}{{faker.location.city}}
{{faker.country}}{{faker.location.country}}
{{faker.phone}}Phone number
{{faker.price}}{{faker.commerce.price}}
{{faker.word}}{{faker.lorem.word}}
{{faker.sentence}}{{faker.lorem.sentence}}
{{faker.paragraph}}{{faker.lorem.paragraph}}