Bug
When scaffolding a new project with D1 database, Drizzle ORM, and Alchemy infra, running bun run dev immediately after project creation fails with:
ENOENT: no such file or directory, open '../../packages/db/src/migrations'
Root Cause
The packages/db/src/migrations directory is never created during scaffolding. The drizzle config (packages/db/drizzle.config.ts) specifies out: "./src/migrations" as the output directory, but drizzle-kit generate is never run during project generation. The infra package (packages/infra/alchemy.run.ts) references this directory via migrationsDir: "../../packages/db/src/migrations", and when Alchemy's D1Database tries to glob for SQL files in a non-existent directory, Bun's fs.glob throws ENOENT (unlike Node.js which silently returns empty).
The post-install instructions do mention running db:generate, but the README says "D1 local development and migrations are handled automatically by Alchemy" and directs users to run bun run dev without any prerequisite steps.
Steps to Reproduce
bunx create-better-t-stack my-app (select D1, Drizzle, Alchemy)
cd my-app && bun install
bun run dev
- Observe ENOENT crash from the infra package
Suggested Fix
Add a .gitkeep file to packages/db/src/migrations/ in the template generator so the directory always exists after scaffolding. This is the simplest fix — the directory will be populated with real migration files once the user runs db:generate, but its existence won't break bun run dev in the meantime.
Alternative: run drizzle-kit generate as a post-scaffold step when D1 + Drizzle is selected.
Bug
When scaffolding a new project with D1 database, Drizzle ORM, and Alchemy infra, running
bun run devimmediately after project creation fails with:Root Cause
The
packages/db/src/migrationsdirectory is never created during scaffolding. The drizzle config (packages/db/drizzle.config.ts) specifiesout: "./src/migrations"as the output directory, butdrizzle-kit generateis never run during project generation. The infra package (packages/infra/alchemy.run.ts) references this directory viamigrationsDir: "../../packages/db/src/migrations", and when Alchemy'sD1Databasetries to glob for SQL files in a non-existent directory, Bun'sfs.globthrows ENOENT (unlike Node.js which silently returns empty).The post-install instructions do mention running
db:generate, but the README says "D1 local development and migrations are handled automatically by Alchemy" and directs users to runbun run devwithout any prerequisite steps.Steps to Reproduce
bunx create-better-t-stack my-app(select D1, Drizzle, Alchemy)cd my-app && bun installbun run devSuggested Fix
Add a
.gitkeepfile topackages/db/src/migrations/in the template generator so the directory always exists after scaffolding. This is the simplest fix — the directory will be populated with real migration files once the user runsdb:generate, but its existence won't breakbun run devin the meantime.Alternative: run
drizzle-kit generateas a post-scaffold step when D1 + Drizzle is selected.