HaloStack Docs
Open App
Packages

Seed

Database seeder that resets Postgres and seeds a demo account plus random todos.

@halostack/seed resets Postgres and seeds a demo account alongside a batch of random todos. You run it through the root bun run db:seed command, and it's also part of the bun run setup bootstrap. It isn't a library — it has no exports, just a CLI entrypoint.

Structure

The seeder is broken into an orchestrator and two focused steps:

  • src/index.ts — the orchestrator, which runs migrate → reset → seed in order.
  • src/auth.ts — creates the demo user and organization through better-auth's API, so the password is properly hashed rather than inserted as a raw row.
  • src/todos.ts — generates random todos with drizzle-seed, then realigns the todos identity sequence afterward so the app's own inserts don't collide.

Running

The default run migrates, resets the data (TRUNCATE … RESTART IDENTITY), and seeds. Flags let you tune the volume, reproducibility, and behavior:

The result is a demo login of [email protected] / password, owning a "Demo Org".

Conventions

Auth identities always go through @halostack/auth (never raw inserts) so that password hashing and organization wiring match production exactly. CLI logging and reporting use @halostack/scripts, and the database connection and flags are read from @halostack/env.