talos seed:run. The command runs each module’s bin/seed/run.ts script from the module’s own directory. Each runner resolves every registered seed, keeps the ones that are active and target the current environment, and runs them in dependency order.
| Option | Description | Default |
|---|---|---|
--drop | Clear seeded data before running seeds. | false |
--env | Value used for APP_ENV when running the seeds. | — |
--no-cache | Skip reading and writing the seed cache. | false |
How a run proceeds
The runner loads every registered seed and filters it throughisActive() and getEnv() against the current APP_ENV. For each remaining seed it first runs the seed’s dependencies — resolving each from the container and collecting their return values — then calls the seed’s run(data) with those values. A seed that throws stops the run and exits non-zero; the runner closes the registered database connection on the way out.
There is no tracking table: whether a seed has already run is recorded only by the run cache, so a successful, unchanged seed is skipped on the next run and reported as up to date (cached).
Clearing data
Passing--drop clears seeded data before any seed runs by calling drop() on the module’s registered database constant, then re-seeds from scratch. A module without a registered database simply has nothing to drop. --drop also bypasses the cache, since the reset must always re-seed.
Setting the environment
--env sets APP_ENV for the run, which drives two things: the getEnv() filter that selects which seeds run, and the environment folded into each seed’s cache fingerprint. Seeding a different environment is therefore always a cache miss.
Running run() directly
Outside the CLI you can call run() from @talosjs/seeds:
seed:run command for the full reference.
Next steps
- Caching: how the per-seed run cache skips unchanged seeds.
- Writing seeds: gate a seed by activity, environment, and dependencies.