This project is a boilerplate for creating a React Router application with Cloudflare Durable Objects. It's set up as a monorepo using Bun and Turborepo for efficient management and building.
The project is organized as follows:
apps/:web-app: Contains the React Router applicationworker-app: Contains the Cloudflare Worker configuration
durable-objects/:example-do: Contains the Example Durable Object
packages/:biome-config: Biome (linter/formatter) configurationcloudflare-worker-config: Cloudflare Worker type definitionshono-typed-fetcher: Type-safe fetcher for Hono apps and Durable Objectsintegration-tests: End-to-end tests for Workers and Durable Objectswrangler-config-helper: Utilities for Wrangler configuration
This project is set up to use Bun and Turborepo. While it may be possible to use npm or Yarn, this is not officially supported.
- Clone this repository
- Install dependencies:
bun install
In the project directory, you can run:
Runs the app in development mode. Open http://localhost:5137 to view it in your browser.
Note: The development server is configured with a WebSocket proxy for local development. If you need to add more WebSocket endpoints, you'll need to adjust the proxy configuration in apps/web-app/vite.config.ts. The default configuration is:
proxy: {
"/websocket": {
ws: true,
changeOrigin: true,
target: "ws://localhost:8787",
},
},Builds the app for production.
Runs the app in a mock production environment using the results from bun run build.
Runs the linter (Biome) across the project.
Runs the tests using Vitest. This includes:
- Unit tests for individual packages
- Integration tests for Workers and Durable Objects using Miniflare environment
Deploys the app to Cloudflare in the production configuration.
- React Router application with Cloudflare Workers
- Durable Objects integration
- TypeScript support
- Tailwind CSS for styling
- Biome for linting and formatting
- Vitest for testing
- Unit tests for packages
- Integration tests with Miniflare environment
- Hono for API routing in Durable Objects
- Custom type-safe fetcher for Hono apps and Durable Objects
To learn more about the technologies used in this project, check out the following resources:
- React Router Documentation
- Cloudflare Workers
- Cloudflare Durable Objects
- Turborepo
- Tailwind CSS
- Biome
- Vitest
- Hono
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.