yhuard / test-remix-typescript-cloudflare-workers

Test Remix + TypeScript + Cloudflare Workers

Home Page:https://test-remix-typescript.yhuard.workers.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Welcome to Remix!

Development

You will be running two processes during development:

  • The Miniflare server (miniflare is a local environment for Cloudflare Workers)
  • The Remix development server
# in one tab, start the remix dev server
$ npm run dev

# in another, start the miniflare server
$ npm start

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

If you'd rather run everything in a single tab, you can look at concurrently or similar tools to run both processes in one tab.

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

I learned...

  • how to set up Remix with Cloudflare Workers
  • how to create a GitHub action to automatically deploy to CF Workers on every push
  • Cloudflare Workers don't run in a Node.js environment, meaning we don't have access to Node.js native modules (like fs). For data persistence, something like Cloudflare Workers KV could be used https://www.cloudflare.com/en-gb/products/workers-kv/

Personal notes

About

Test Remix + TypeScript + Cloudflare Workers

https://test-remix-typescript.yhuard.workers.dev/


Languages

Language:TypeScript 83.2%Language:JavaScript 16.8%