Seedfast

Seedfast

Seeding

Seeding is the process of writing generated data into your database. Seedfast does this directly — there's no intermediate format, no file to import, no manual SQL to run.

Direct database writes

When a seed runs, Seedfast connects to your database and inserts records table by table, in the order determined during the planning phase. Data lands in your tables exactly as it would from your application — as rows in PostgreSQL, immediately queryable.

After seeding, you can use any tool you already use with your database:

  • Query with psql or any SQL client
  • Inspect in a GUI like pgAdmin, DBeaver, or TablePlus
  • Use immediately for development, testing, or demo environments
  • Export to any format if needed

Nothing special is required. The data is just there.

Local and remote databases

Seedfast seeds local and remote databases using the same workflow. Point it at a connection string — the rest is identical:

# Local
seedfast connect
# prompts for connection string: postgresql://user:pass@localhost:5432/mydb

# Remote — set connection string directly
seedfast connect postgres://user:pass@remote-host:5432/db
seedfast seed --scope "..."

This makes it straightforward to seed staging environments, review app databases, or any remote PostgreSQL instance you have credentials for.

Trigger-aware seeding

Seedfast accounts for database triggers when inserting data. If your schema has triggers that fire on insert — updating timestamps, maintaining denormalized counters, enforcing business rules — Seedfast handles this correctly.

The data you end up with reflects the actual state of your database after triggers run, not just the raw inserted values. This matches how your application writes data and means the seeded state is consistent with real usage.

Foreign keys and incomplete scopes

Seedfast hands the database a dataset it accepts as the rows land. Every foreign key in the generated data points at a row that is already there, so no constraint is violated on the way in.

If your scope includes a table that depends on another table not in scope, Seedfast catches this before the run starts and asks you to resolve it. You won't discover a dependency failure halfway through a large seed.

What gets seeded

Only the tables in your scope are touched. Existing rows in those tables are not modified or deleted — Seedfast appends new records.

If you need a clean state before seeding, truncate the relevant tables first:

# DATABASE_URL is your connection string, e.g. postgresql://user:pass@localhost:5432/mydb
psql $DATABASE_URL -c "TRUNCATE users, orders, products RESTART IDENTITY CASCADE;"
seedfast seed --scope "seed 100 users with orders and products"