- Notifications
You must be signed in to change notification settings - Fork14
tlebeitsuk/nuxt-cloudflare-lucia
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A demo usingNuxt, CloudflarePages +D1 database,Drizzle ORM andLucia auth.
Inspired byNuxt Todo List on the Edge.
Take a look atNuxtHub for a more complete solution.
A. Create a CF pages deployment linked to your GitHub repository.
B. UseWrangler:
pnpm build
Preview build (setup D1 first):
pnpm wrangler pages dev dist
Deploy build to CF:
pnpm wrangler pages publish dist
A. Create a D1 database in CF.
In the CF Pages project settings -> Functions, add the binding between your D1 database and the DB variable.
B. Use Wrangler:
wrangler d1 create<DATABASE_NAME>
Bind Worker with D1 database:
----filename: wrangler.toml----name ="YOU PROJECT NAME"main ="./.output/server/index.mjs"[[d1_databases]]binding ="DB"# i.e. available in your Worker on env.DBdatabase_name ="<DATABASE_NAME>"database_id ="<unique-ID-for-your-database>"
To init local database and run server locally:
wrangler d1 execute<DATABASE_NAME> --local --file server/db/migrations/0000_cultured_fixer.sqlwrangler dev --local --persist
Deploy:
wrangler d1 execute<DATABASE_NAME> --file server/db/migrations/0000_cultured_fixer.sqlwrangler deploy
About
A demo using Nuxt, Cloudflare Pages, Cloudflare D1 database and Lucia for auth