auto-seed

auto-seed

v1.1.0

Generate realistic, relationally-accurate database seed data directly from your existing schema — in one command.

Supports Prisma, SQL DDL, and TypeORM schemas. Outputs .ts or .sql files.

bash
$ npx auto-seed generate
GitHub

Features

>_

One LLM call per run

The LLM plans the data strategy once. A local deterministic engine handles row generation — keeping costs predictable and output fast.

{}

Parse any schema

Bring your Prisma schema, raw SQL DDL, or TypeORM entities. auto-seed reads your structure and understands relationships automatically.

~

Realistic, coherent data

Names match emails. Addresses are consistent. Foreign keys resolve correctly. Self-references and unique constraints just work.

#

Reproducible with --seed

Pass a seed value to generate identical data every time. Deterministic output for consistent development and testing environments.

=>

.ts or .sql output

Generate TypeScript seed files or raw SQL inserts. Renders with correct FK ordering so you can run them directly against your database.

*

Anthropic, OpenAI, or Gemini

Bring your own API key. Works with Claude, GPT, or Gemini models. Switch providers without changing your workflow.

How it works

01

Parse

Your schema is parsed into an internal representation. Prisma, SQL DDL, or TypeORM — models, fields, relations, and constraints are all extracted.

02

Plan

A single LLM call analyzes your schema and plans a generation strategy: what values make sense, how many rows, and how relations connect.

03

Generate

A local deterministic engine uses the plan to produce rows. Faker.js creates realistic values. FK ordering and unique constraints are handled automatically.

04

Render

The generated data is rendered as a TypeScript seed file or raw SQL inserts, ready to run against your database.

Quick start

bash
$ npx auto-seed init

One-time setup. Configures your API key, provider, and default preferences.

bash
$ npx auto-seed generate

Parses your schema, calls the LLM once, generates rows locally, and writes your seed file.

Example output

// seed.ts (generated by auto-seed)
import { PrismaClient } from "@prisma/client";

const prisma = new PrismaClient();

async function main() {
  await prisma.user.createMany({
    data: [
      { id: 1, name: "Jordan Chen", email: "jordan.chen@example.com" },
      { id: 2, name: "Priya Sharma", email: "priya.sharma@example.com" },
      { id: 3, name: "Marcus Webb", email: "marcus.webb@example.com" },
      // ... 47 more rows
    ],
  });

  await prisma.post.createMany({
    data: [
      { id: 1, title: "Getting Started with GraphQL", authorId: 1 },
      { id: 2, title: "Why We Moved to Postgres", authorId: 2 },
      // ... 198 more rows
    ],
  });
}

main();

Requires Node.js 18+. No installation needed — runs directly with npx.