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.bun db:generate
# or
npx drizzle-kit generate
Seeding is crucial for setting up your initial RBAC structure (Roles, Resources, Permissions).
In the starter template, the database is automatically seeded when you attempt to log in as admin@example.com for the first time. This ensures that your production or development environment is always ready with the necessary roles and permissions.
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.