When developing with nuxt-auto-crud and Drizzle ORM, you may often need to reset your database and seed it with initial data (like default roles and permissions).
If you are using NuxtHub (Cloudflare D1) or a local SQLite file:
.data directory or your specific SQLite file.nuxt db generate
Seeding is crucial for setting up your initial RBAC structure (Roles, Resources, Permissions).
In the starter template, the database is automatically seeded when the system detects an attempt to log in using the configured admin email.
admin@example.com.NUXT_ADMIN_EMAIL environment variable.This ensures that your production or development environment is always initialized with the necessary roles, resources, and permissions upon the first admin login.
The seeding logic is located in server/tasks/seed.ts. You can modify this file to:
If you need to manually re-seed the database (e.g., after a reset), you can use Nuxt DevTools:
Shift + Alt + D).db:seed and click Run.This task typically:
If you are using the default seed script from the starter, the following users are created with the password $1Password:
admin@example.com (Full Access)manager@example.commoderator@example.comcustomer@example.comSecurity Note: Always change default passwords and delete default admin users before deploying to production.