How to Generate Realistic Relational Test Data in One API Call (No More Manual Joins)

BugiaData

Most developers have been there: you’re building a new feature—perhaps a checkout flow or a customer dashboard—and you need realistic test data to see if the logic actually holds up.

But modern databases aren't just flat tables. They are ecosystems of related entities: users, orders, products, addresses, and payments. You want foreign keys that actually make sense, names that match specific locales, and order totals that aren't just "12345."

Traditionally, this meant writing complex seed scripts, faking IDs, manually matching relationships, and handling edge cases. It quickly turns into hours (or days) of boring, error-prone work.

What if you could describe your entire schema—including complex relationships—and get a complete, consistent relational dataset back from one single POST request?

That’s exactly what BugiaData makes possible in 2026.

The Old Way vs. The New Way

The "Manual" Way (The Scripting Nightmare)

Even today, many teams are stuck in a cycle that feels like 2010:

  • Use Faker.js or Faker Python to generate flat lists.
  • Manually assign and track foreign keys in your code.
  • Write custom logic for one-to-many or many-to-many relationships.
  • Run multiple generation passes and join them yourself.
  • The Result: High risk of "orphan rows" or constraint violations when you finally try to pipe it into PostgreSQL or MySQL.

The BugiaData Way (Single API Call)

You send a single JSON schema that describes your tables and their internal connections. The engine handles the heavy lifting, ensuring every user_id in your orders table actually points to a real user generated in the same batch.

Example Request:

POST https://api.bugiadata.com/v1/generate/schema
{
  "locale": "en_US",
  "tables": [
    {
      "name": "users",
      "count": 50,
      "fields": [
        {"name": "id", "type": "uuid"},
        {"name": "full_name", "type": "full_name"},
        {"name": "email", "type": "email"}
      ]
    },
    {
      "name": "orders",
      "count": 200,
      "fields": [
        {"name": "id", "type": "uuid"},
        {"name": "user_id", "type": "foreign_key", "references": "users.id"},
        {"name": "total", "type": "decimal", "min": 19.99, "max": 799.99},
        {"name": "status", "type": "random_element", "options": ["pending","shipped","delivered"]}
      ]
    }
  ]
}

Example Response:

{
  "users": [
    {"id": "550e8400-e29b-41d4-a716-446655440000", "full_name": "John Smith", "email": "[email protected]"},
    // ... 49 more
  ],
  "orders": [
    {"id": "f47ac10b...", "user_id": "550e8400-e29b-41d4-a716-446655440000", "total": 124.50, "status": "shipped"},
    // ... 199 more, all correctly linked to the users above
  ]
}

Why Relational Logic Matters in 2026

  1. Speed & Efficiency: Seed your staging, QA, or local development environments in seconds instead of hours.
  2. Global Realism: With support for 100+ locales, you can test how your UI handles long German names, Japanese characters, or Brazilian CPF numbers instantly.
  3. Data Integrity: No more orphan rows. Your foreign keys are guaranteed to point to valid records generated within the same request.
  4. Edge Case Testing: Easily generate "unhappy paths"—like users with failed payments or orders with zero items—by simply adjusting your schema rules.

Pro-Tips for Power Users

[!TIP] Reproducible Data: If you need the exact same dataset every time for your CI/CD tests, use a fixed seed parameter in your request.

  • Start Small: Define 2–3 tables first to get the hang of the foreign_key syntax.
  • Integration: Pipe the JSON output directly into your favorite ORM (Prisma, Drizzle, Eloquent) or use it for plain SQL COPY commands.
  • Billing Tip: Remember that relational calls calculate usage based on the total number of fields generated across all tables.

Stop Scripting, Start Building

Generating test data shouldn't be the hardest part of your sprint. Once you experience a fully relational dataset delivered in under 2 seconds, manual mocking feels like a relic of the past.

Ready to reclaim your afternoon? Grab a free API key here and experiment with your own schema—no credit card required.

What’s the most annoying test-data problem you’re facing right now? Is it many-to-many relationships? Specific regional formats? Drop a comment below—your feedback might just become our next feature.

Happy coding!