This template provides a minimal setup for building a React application with TypeScript and Vite, designed to run on Cloudflare Workers. It features hot module replacement, ESLint integration, and the flexibility of Workers deployments.
🚀 Supercharge your web development with this powerful stack:
- React - A modern UI library for building interactive interfaces
- Vite - Lightning-fast build tooling and development server
- Hono - Ultralight, modern backend framework
- Cloudflare Workers - Edge computing platform for global deployment
- 🔥 Hot Module Replacement (HMR) for rapid development
- 📦 TypeScript support out of the box
- 🛠️ ESLint configuration included
- ⚡ Zero-config deployment to Cloudflare's global network
- 🎯 API routes with Hono's elegant routing
- 🔄 Full-stack development setup
- 🔎 Built-in Observability to monitor your Worker
Get started in minutes with local development or deploy directly via the Cloudflare dashboard. Perfect for building modern, performant web applications at the edge.
To start a new project with this template, run:
pnpm create cloudflare@latest -- --template=cloudflare/templates/vite-react-templateA live deployment of this template is available at: https://react-vite-template.templates.workers.dev
Install dependencies:
pnpm installStart the development server with:
pnpm devYour application will be available at http://localhost:5173.
Build your project for production:
pnpm buildPreview your build locally:
pnpm previewDeploy your project to Cloudflare Workers:
pnpm build && pnpm deployMonitor your workers:
pnpm exec wrangler tailThis app integrates Firebase Auth and Firestore to enable authenticated users to start a new conversation from the landing page and jump into its workspace.
Copy .env.example to .env and fill in your Firebase project settings:
VITE_FIREBASE_API_KEY=your-api-key-here
VITE_FIREBASE_AUTH_DOMAIN=your-project-id.firebaseapp.com
VITE_FIREBASE_PROJECT_ID=your-project-id
VITE_FIREBASE_STORAGE_BUCKET=your-project-id.appspot.com
VITE_FIREBASE_MESSAGING_SENDER_ID=your-messaging-sender-id
VITE_FIREBASE_APP_ID=your-app-id
Initial Firestore rules are in firestore.rules and allow:
- create on
conversations/{hashId}only for authenticated users whereownerUid == request.auth.uid - get/read on conversations for the owner
- everything else is denied by default (with limited allowances for owner contributions)
Deploy rules with the Firebase CLI (manual step):
firebase deploy --only firestore:rules
Or use the helper script which prints the command:
pnpm run rules:deploy
- Sign in using the header or the landing page CTA (Google sign-in popup)
- Click "Start a conversation" on the landing page
- A Firestore document will be created at
conversations/{hashId}with:- title: "Untitled Conversation"
- slug: null
- ownerUid, ownerDisplayName
- participantRoles: { [uid]: "owner" }
- createdAt, updatedAt
- You will be redirected to
/c/{hashId}?created=1and see a brief success banner in the workspace
Run the test suite and lints:
pnpm lint
pnpm test
A lightweight Landing page test ensures the correct CTA appears based on authentication state.