Data generation

Generate Mock Data from TypeScript Models

The local runtime generates realistic records from the normalized TypeScript model. Field names provide semantic hints, explicit Faker mappings can override those hints, and a project seed makes generated starting data repeatable.

How does TypeScript become mock data?

Mock API Studio normalizes each supported field into a safe schema, then uses Faker-backed generators for primitive and structured values. Arrays, nested objects, enums, optionals, nullable fields, and discriminated unions retain the shape of the TypeScript contract.

TypeScript
interface Customer {
  id: string;
  fullName: string;
  email: string;
  joinedAt: Date;
  tier: "free" | "pro";
}

Use semantic field hints

Names such as email, firstName, price, phone, city, url, and createdAt map to appropriate generators. A generic string field still receives a valid string, but descriptive field names produce more useful fixtures.

  • Use a deterministic seed for repeatable local datasets.
  • Set a project default record count.
  • Override the count for endpoints that need a different volume.

Override generation with Faker mappings

The visual type designer exposes supported Faker mapping families for commerce, dates, internet, location, lorem, numbers, people, phones, and strings. An explicit mapping takes precedence over inference from the field name.

Example output
{
  "id": "87c10e65-21f4-4b32-865d-f04468cf6b31",
  "fullName": "Avery Chen",
  "email": "avery.chen@example.net",
  "joinedAt": "2026-08-21T09:12:00.000Z",
  "tier": "pro"
}

Related questions

Will a restart always replace my local records?

No. SQLite data persists while the synchronized schema and configuration hash remain compatible. Material configuration changes can trigger regeneration.

Keep exploring

Last updated September 17, 2026. Product behavior described here is verified against the current Mock API Studio runtime.