/workers-remix-d1

Primary LanguageTypeScriptMIT LicenseMIT

What is this?

Sample code to get data from Cloudflare D1 in Remix.

Motivation

To access Cloudflare D1, we need to write SQL. However, we would be even happier if we could retrieve data as easily as the O/R mapper. So I am trying to build a query with kysely to get the type at the same time.

If you look at users.tsx, you will see that the data to be retrieved from D1 is typed.

Development

$ docker compose up --build
#=> open http://localhost:3000/users

Deployment

Cloudflare Pages are currently only deployable through their Git provider integrations.

If you don't already have an account, then create a Cloudflare account here and after verifying your email address with Cloudflare, go to your dashboard and follow the Cloudflare Pages deployment guide.

Configure the "Build command" should be set to pnpm run build, and the "Build output directory" should be set to public.

$ pnpm run deploy