A modern full-stack starter template for building web applications with Cloudflare Workers, React, Tailwind CSS, and type-safe RPC communication.
- π Full-Stack Development: Seamless integration between frontend and backend
- β‘ Vite + React: Lightning-fast HMR with React 19 and TypeScript
- π Tailwind CSS + shadcn/ui: Beautiful, customizable UI components
- π Type-Safe RPC: End-to-end type safety with automatic code generation
- π Edge Computing: Deploy globally with Cloudflare Workers
- π οΈ Modern Dev Tools: ESLint, Prettier, and testing with Vitest
- React 19 - UI library
- Vite - Fast development environment
- Tailwind CSS - Utility-first CSS framework
- shadcn/ui - Accessible UI components built with Radix UI and Tailwind
- TypeScript - Type safety and developer experience
- React Hooks - Custom hooks for RPC communication
- Lucide React - Beautiful, consistent icons
- use-toastr - Toast notifications
- Cloudflare Workers - Serverless edge runtime
- Type-safe RPC - End-to-end type safety between frontend and worker
- TypeScript - Strongly-typed API endpoints
- Node.js (v16+)
- Yarn or npm
- Cloudflare account (for deployment)
- Clone the repository:
git clone https://github.com/feliperohdee/cloudflare-react-tailwind-client.git my-project
cd my-project- Install dependencies:
yarn install- Start the development server:
yarn devThis will start the Vite development server at http://localhost:3000 with hot module replacement for real-time updates.
βββ app/ # React frontend application
β βββ components/ # React components
β β βββ ui/ # shadcn/ui components
β βββ hooks/ # Custom hooks
β βββ libs/ # Utility functions
β βββ pages/ # Page components
β βββ styles/ # Global styles
β
βββ worker/ # Cloudflare Worker code
β βββ rpc/ # RPC implementation
β
βββ public/ # Static files
βββ wrangler.toml # Cloudflare Workers configuration
βββ package.json # Project dependencies and scripts
yarn dev- Start the development serveryarn build- Build the project for productionyarn preview- Preview the production build locally
yarn deploy- Build and deploy to Cloudflare Workers
yarn lint- Run ESLint to check code qualityyarn test- Run tests using Vitest testing frameworkyarn cf-typegen- Generate TypeScript types for Cloudflare Workers
yarn add-component [name]- Install and configure shadcn/ui components
This project uses shadcn/ui components. You can add new components using:
yarn add-component buttonAvailable components include: button, card, dialog, dropdown-menu, input, label, select, and many more from the shadcn/ui collection.
This starter uses type-safe RPC for communication between the frontend and the Worker:
// Frontend (React component)
const { resource, rpc } = useRpc();
const { data, fetch, loading, setData } = resource('hello', {
message: 'Cloudflare'
});
// Worker RPC Implementation
class Rpc {
async hello({ message }: { message: string }) {
return { message: `Hello, ${message}!` };
}
}Key benefits:
- Full type safety between frontend and backend
- Automatic code generation
- Simple, intuitive API with React hooks
- Build your application:
yarn build- Deploy to Cloudflare Workers:
yarn deployContributions are welcome! Please feel free to submit a Pull Request.
MIT Β© Felipe Rohde
Felipe Rohde
- Twitter: @felipe_rohde
- Github: @feliperohdee
- Email: feliperohdee@gmail.com