Skip to main content

Use Cases

Seedling fits into several key workflows — from CI pipelines to local development.

CI Pipeline Data Seeding

The most common use case: generate fresh test data in CI before running your test suite.
# .github/workflows/test.yml
jobs:
  test:
    services:
      postgres:
        image: postgres:16
        env:
          POSTGRES_DB: testdb
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version: "1.25"
      - run: go install github.com/tomiwa-a/seedling/cmd/seedling@latest
      - run: seedling generate --db postgres://postgres@localhost:5432/testdb
      - run: go test ./...
Benefits: No stale snapshots, no manual SQL files, every CI run gets fresh referentially-valid data.

E2E Workflow Testing with Replay

Pair Seedling with Replay — an E2E workflow testing engine — for a complete data-backed CI pipeline:
jobs:
  seedling-replay-e2e:
    runs-on: ubuntu-latest
    services:
      postgres:
        image: postgres:15-alpine
        env:
          POSTGRES_PASSWORD: password
    steps:
      - uses: actions/checkout@v4

      - name: Install Seedling
        run: go install github.com/tomiwa-a/seedling@latest

      - name: Seed deterministic test data
        run: seedling generate --count 1000 --seed 42 \
          --db postgres://postgres:password@postgres:5432/postgres

      - name: Install Replay
        run: go install github.com/replay/replay@latest

      - name: Run E2E workflows
        run: replay run tests/e2e/*.yaml --concurrency 4 --fail-fast
        env:
          POSTGRES_DSN: postgres://postgres:password@postgres:5432/postgres
Seedling produces fresh, referentially-valid rows every run. Using --seed 42 guarantees the same data set across CI runs, so your Replay assertions never flake due to changing data. For local development, chain both tools in one command:
seedling generate --count 500 --seed 42 \
  --db postgres://localhost:5432/testdb \
  && replay run test.yaml

Integration Testing

Seed directly into your test database with deterministic seeds for reproducible tests:
func TestUserWorkflow(t *testing.T) {
    // Seed with deterministic data
    exec.Command("seedling", "generate",
        "--count", "100",
        "--seed", "42",
        "--db", "postgres://localhost:5432/testdb",
    ).Run()

    // Your test assertions
    users := fetchUsers()
    assert.Len(t, users, 100)
}
Use --seed 42 for reproducible test data — the same seed produces the same rows every time, making tests predictable and debug-friendly.

Staging Environment Refresh

Quickly populate a staging environment with realistic data:
# Truncate and regenerate
seedling generate \
  --count 500000 \
  --db postgres://staging:password@staging-host:5432/mydb \
  --truncate \
  --verbose

Local Development

Generate a small dataset for local development without needing production data:
# Small, fast dataset for dev work
seedling generate \
  --count 50 \
  --seed 1 \
  --output seed.sql

psql -d localdb -f seed.sql

Load Testing

Scale up to production-level volumes for performance testing:
# 10 million rows via COPY protocol for max throughput
seedling generate \
  --count 10000000 \
  --db postgres://localhost:5432/loadtest \
  --copy \
  --batch-size 5000

Schema Migration Testing

After running migrations, regenerate data to verify the new schema works:
# Run migration
migrate -database $DATABASE_URL -path migrations up

# Regenerate data against migrated schema
seedling introspect --db $DATABASE_URL --output schema.yaml
seedling generate --count 1000 --db $DATABASE_URL

Data Analysis & ML

Generate CSV or JSONL datasets for analytics workflows:
# CSV for spreadsheet analysis
seedling generate \
  --count 10000 \
  --output data/ \
  --format csv

# JSONL for event streams
seedling generate \
  --count 50000 \
  --output events.jsonl \
  --format jsonl