Example project for Drizzle ORM + Cloudflare Worker + Neon Serverless
Here's the original launch blog post and official CF demo repo
First let's setup your Cloudflare Worker project based on official docs
## wrangler.toml
name = "neon-cf-demo"
main = "src/index.ts"
compatibility_date = "2022-12-09"
usage_model = "unbound"
node_compat = true
Setup Neon Serverless database - official docs, grab database url with project tag, put them in .dev.vars
. You will need project name for postgres.js
driver to run migrations - read here
DATABASE_URL=postgres://user:password@localhost:5432/dbname
PROJECT_NAME=shiny-fire-338756
now we can run the project!
npm i
## run locally
npm start
## generate SQL migrations for schema.ts
npm run generate
## apply migrations to remote database
npm run migrate
That's it! Subscribe to our Twitter and join our comminity on Discord 🚀