Fake Data vs Real Production Snapshots for Testing
The two extremes\n\nPure fake data — Faker.js or @lazymac/fake-data. Deterministic, PII-safe, infinite volume. Misses: real-world distributions, edge cases from actual users, bugs that only surface on specific name patterns.\n\nProduction snapshots — dump real user data, anonymize, use as fixtures. Catches everything that happens in prod. Legal/privacy nightmare if mishandled.\n\n## The hybrid pattern\n\n1. Generate fake data for 90% of tests — signup, auth, CRUD, UI snapshots\n2. Use anonymized production snapshots for the 10% that matter — payment flows, search relevance, PII redaction itself\n3. Keep snapshots per-environment — staging snapshot ≠ CI fixture ≠ unit test fixture\n\n## Anonymization pipeline\n\n``ts\nfunction anonymize(row) {\n return {\n ...row,\n email: fakeEmail(row.id), // deterministic so repeated tests match\n name: fakeName(row.id),\n phone: fakePhone(row.country),\n address: fakeAddress(row.country),\n // keep structure-preserving fields unchanged: created_at, status, tier\n };\n}\n`\n\nKey: deterministic fakes keyed off the real id — so the same row always anonymizes to the same fake, which lets you reproduce bugs.\n\n## Korean, Japanese, European data matters\n\nIf your test data is only US-format (first/last, 555-1234, 90210), you'll ship code that breaks on:\n\n- 김 3-character last name first, first name combined\n- Japanese long vowels, full-width characters\n- European street numbers after the street name\n- Korean 5-digit postal codes\n- European VAT ID formats\n\nFake Data API supports 12 locales with culturally-accurate name/address/phone patterns. Free 100/day. Pro $9.99/mo unlimited.\n\n`bash\ncurl -X POST https://api.lazy-mac.com/fake-data/api/v1/generate -d '{\"locale\":\"ko_KR\",\"count\":50,\"schema\":{\"name\":\"personName\",\"address\":\"koreanAddress\",\"brn\":\"koreanBRN\"}}'\n``
📬 MCP Security Weekly
One email per week — new CVEs, scanner improvements, MCPWatch grade drops on popular servers. Free. Unsubscribe anytime.
Support the work: MCP Pro $29/mo · MCPWatch Pro Report $49 · more posts