Skip to main content

React Router on Cloudflare Example

This example shows how to deploy a React Router v7 application to Cloudflare Workers with environment bindings and secrets.

Features

  • React Router v7: File-based routing with server rendering
  • Cloudflare Workers: Edge deployment
  • Environment Bindings: Secrets and configuration
  • Type Safety: Full TypeScript support

Project Setup

Key Features Explained

Environment Bindings

Secrets are passed as bindings to your application:

Server-Side Rendering

React Router runs on Cloudflare’s edge:

Type Safety

Full TypeScript support for environment bindings:

Advanced Usage

Add KV Storage

Extend with KV Namespace:
Use in loader:

Source Code

View the complete source code: examples/cloudflare-react-router