Skip to main content

Cloudflare Vite Example

This example shows how to deploy a Vite application to Cloudflare Workers with KV Namespace bindings and environment variables.

Features

  • Vite: Modern frontend build tool with HMR
  • KV Namespace: Key-value storage for the application
  • Environment Bindings: Secrets and configuration
  • Local Development: Vite dev server integration

Project Setup

Key Features Explained

KV Namespace Adoption

The adopt: true flag allows reusing existing KV namespaces:

Environment Variables

Secrets and configuration are passed via bindings:

Local Development

The dev configuration integrates with Vite’s dev server:

Source Code

View the complete source code: examples/cloudflare-vite