SvelteKit - Lucia Auth - Cloudflare D1 - Drizzle ORM - Cloudflare Pages Template
Demo
https://svelte-lucia-cf-d1.pages.dev/
Developing
- Install dependencies (or npm install),
bun install
- Rename wrangler.example.toml to wrangler.toml
- Login to wranger
bun wrangler login
- Setup Database (npm run wrangler...)
bun wrangler d1 create <DBName>
- Paste the response in wrangler.toml, example:
[[d1_databases]]
binding = "DB"
database_name = "sveltedb"
database_id = "11fba10e-2d8f-3212-adc6-d430e2e8a81a"
- Rename "sveltedb" for your selected database_name in d1:mig:local and d1:mig:prod in package.json
- Migrate starter schema to local database
bun d1:mig:local
- Run app (Do both of the following at the same time)
bun proxy
bun dev
Deployment
- Migrate schema to production database
bun d1:mig:prod
- Create web app in Cloudflare
- Bind database to your app