docs
database
seeders
Seeders
Seeders
Mithril provides a seed command to insert demo data for development.
Run the Seeder#
mithril seed
# or: make seed
This runs cmd/seed/ which creates a demo user (when configured). Seeds are manual only — they do not run on app startup or Air reload.
Implementation#
Seed logic lives in cmd/seed/main.go. It connects via DATABASE_URL, hashes passwords with bcrypt, and inserts into the users table.
To customize:
- Edit
cmd/seed/main.go - Add additional repositories/models as needed
- Run
mithril seed
Safety#
- Do not run seed in production without reviewing inserted data
- Registration via API is disabled by default (
ENABLE_REGISTERunset) - Use
mithril createsuperuserfor production admin accounts
Related Commands#
mithril createsuperuser # Interactive superuser creation
mithril migrate-up # Ensure schema exists first