stratal-seeders

CLI tool and infrastructure for database seeding in Stratal applications. Seeders run within request-scoped DI containers with full access to injected services. Full documentation at stratal.dev/testing/seeders.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "stratal-seeders" with this command: npx skills add strataljs/stratal/strataljs-stratal-stratal-seeders

@stratal/seeders

CLI tool and infrastructure for database seeding in Stratal applications. Seeders run within request-scoped DI containers with full access to injected services. Full documentation at stratal.dev/testing/seeders.

Writing a Seeder

import { Seeder } from '@stratal/seeders'; import { inject, Transient, DI_TOKENS } from 'stratal/di'; import type { DatabaseService } from '@stratal/framework/database';

@Transient() export class UserSeeder extends Seeder { constructor(@inject(DI_TOKENS.Database) private db: DatabaseService) { super(); }

async run() { await new UserFactory().count(10).createMany(this.db); } }

Registration

Register seeders in module providers :

@Module({ providers: [UserSeeder, RolePermissionsSeeder], }) export class SeederModule {}

Seeders are auto-discovered by walking module providers recursively — any class extending Seeder is found.

Entry File

// src/seed.ts import { SeederRunner } from '@stratal/seeders'; import { AppModule } from './app.module';

SeederRunner.run(AppModule);

Add to package.json : "seed": "stratal-seed" (uses @swc-node/register for runtime TypeScript support).

CLI Usage

Command Description

npx stratal-seed run <seeder>

Run a single seeder by name

npx stratal-seed run --all

Run all discovered seeders

npx stratal-seed list

List all available seeders

npx stratal-seed run <seeder> --dry-run

Preview without executing

Naming Convention

Class Name CLI Name

UserSeeder

user

RolePermissionsSeeder

role-permissions

OrganizationMembersSeeder

organization-members

Pattern: strip Seeder suffix, convert PascalCase to kebab-case.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

stratal

No summary provided by upstream source.

Repository SourceNeeds Review
General

stratal-framework

No summary provided by upstream source.

Repository SourceNeeds Review
General

stratal-testing

No summary provided by upstream source.

Repository SourceNeeds Review