Minimal React Router template for Cloudflare
This is a minimal template for building React applications with React Router and Cloudflare Workers. It includes server-side rendering, hot module replacement, TypeScript, and middleware by default.
The recommended way to clone this repo is using degit
bunx degit sergiodxa/react-router-cloudflare-minimal my-app
After the repo is clonned, this will remove the LICENSE
and .github/FUNDING.yml
files, and the .git
folder, so you will have a clean slate to start your project.
Install the dependencies:
bun install
Start the development server with HMR:
bun run dev
Your application will be available at http://localhost:3000
.
Create a production build:
bun run build
This template can only be deployed to Cloudflare Workers.
bun run deploy
This will init the deploy script of wrangler and guide you to deploy the application.
This template includes a GitHub Actions workflow that will deploy your application to Cloudflare Workers when triggered.
To use it you need to set the following secrets in your repository:
CLOUDFLARE_API_TOKEN
CLOUDFLARE_ACCOUNT_ID
You can get the CLOUDFLARE_API_TOKEN
from the Cloudflare dashboard and the CLOUDFLARE_ACCOUNT_ID
from the wrangler configuration file.
Then trigger the workflow by clicking on the "Actions" tab in your repository and running the "Deploy" workflow.
This template comes with Tailwind CSS already configured for a simple default starting experience. You can use whatever CSS framework you prefer.
This project is open source and available under the MIT License.