Seed test account
August 25, 2026 · View on GitHub
Use this script to ensure a known test login exists in any deployed environment. See the setup index for the other setup pages.
- Local D1 (default):
npm run migrate:localnode tools/seed-test-data.ts --local
- Local D1 with custom persisted state:
node tools/seed-test-data.ts --local --persist-to .wrangler/state/e2e
- Remote D1:
node tools/seed-test-data.ts --remote --config <wrangler-config-path>- Add
--env <name>when the config uses environment-scoped bindings and the environment is not already set viaCLOUDFLARE_ENV.
- Default fixture credentials (both use password
ilikecode):kody@example.com— seeded with theadminrole so RBAC features (the/adminpages) are testable out of the boxjane@example.com— regular account (userrole only), seeded alongside the primary account for testing the non-admin side of RBAC (local seeding only; never seeded into remote environments)
- Each seeded account also gets a sample user-lane Google integration with
Personal and Work connections so
/account/integrationscan be exercised without a live OAuth dance. - These credentials are a test fixture only and should not be used to describe
product behavior. Pass
--no-adminto seed the default account without the admin role. - Choose explicit fixture credentials when needed (custom accounts are non-admin
unless you pass
--admin):node tools/seed-test-data.ts --email <email> --password <password>
- When changing DB schema/model definitions or migrations, review
tools/seed-test-data.tsand update it so seeded data matches the new model and stays useful for local and preview verification.
Reset, re-migrate, then seed
For a full local reset before seeding, delete the local Wrangler persistence
directory (dropping individual tables does not work: Wrangler's d1_migrations
tracking table would still mark the migrations as applied, so re-running them
would recreate nothing):
- Delete local persisted state:
rm -rf .wrangler/state
- Re-apply migrations:
npm run migrate:local
- Seed test account:
node tools/seed-test-data.ts --local
For preview environments, we do a full resource reset:
- Delete preview resources:
node tools/ci/preview-resources.ts cleanup --worker-name <preview-worker-name>
- Recreate preview app resources and config:
node tools/ci/preview-resources.ts ensure --worker-name <preview-worker-name> --out-config packages/worker/wrangler-preview.generated.json
- Recreate preview jobs-worker resources and config:
node tools/ci/jobs-worker-resources.ts ensure --env preview --worker-name <preview-worker-name>-jobs --host-worker-name <preview-worker-name> --out-config packages/jobs-worker/wrangler-preview.generated.json
- Re-apply remote migrations:
CLOUDFLARE_ENV=preview node ./wrangler-env.ts d1 migrations apply APP_DB --remote --config packages/worker/wrangler-preview.generated.jsonCLOUDFLARE_ENV=preview node ./wrangler-env.ts d1 migrations apply AUDIT_DB --remote --config packages/worker/wrangler-preview.generated.jsonCLOUDFLARE_ENV=preview node ./wrangler-env.ts d1 migrations apply JOBS_DB --remote --config packages/jobs-worker/wrangler-preview.generated.json
- Seed test account:
CLOUDFLARE_ENV=preview node tools/seed-test-data.ts --remote --config packages/worker/wrangler-preview.generated.json