ryurock / remix-cloudflare-sample

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remix + Cloudflare Workers boilerplate (Module Worker)🚀

Starter to get going with Remix and Cloudflare Workers (Module Worker).

Getting Started

​​Installing the Workers CLI

Wrangler requires a minimum Node version of 16

npm install -g wrangler

Read more about installing wrangler.

Development

Create a wrangler.toml file for the development, referring to wrangler.dev.toml.example. It is useful to prepare a configuration for development since the Secret is not available in wrangler dev --local mode.

You will be running two processes during development:

  • The Miniflare server (miniflare is a local environment for Cloudflare Workers)
  • The Remix development server

Both are started with one command:

npm run dev

Open up http://127.0.0.1:8787 and you should be ready to go!

If you want to check the production build, you can stop the dev server and run following commands:

npm run build
npm start

Then refresh the same URL in your browser (no live reload for production builds).

Deployment

Use wrangler to build and deploy your application to Cloudflare Workers. If you don't have it yet, follow the installation guide to get it setup. Be sure to authenticate the CLI as well.

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 set up your free custom Cloudflare Workers subdomain.

Once that's done, you should be able to deploy your app:

npm run deploy:dev

About


Languages

Language:TypeScript 92.2%Language:JavaScript 7.8%