← Workers / workers / framework-guides / web-apps
Vike
You can deploy your Vike ↗ app to Cloudflare using the Vike extension vike-photon ↗.
All app types (SSR/SPA/SSG) are supported.
What is Vike?
Vike ↗ is a Next.js/Nuxt alternative for advanced applications, powered by a modular architecture for unprecedented flexibility and stability.
New app
Use vike.dev/new ↗ to scaffold a new Vike app that uses vike-photon with @photonjs/cloudflare.
Add to existing app
-
npm i wrangler vike-photon @photonjs/cloudflare -
pages/+config.ts
import type { Config } from 'vike/types' + import vikePhoton from 'vike-photon/config' export default { + extends: [vikePhoton] } satisfies Config -
package.json
{ "scripts": { "dev": "vike dev", + "preview": "vike build && vike preview", + "deploy": "vike build && wrangler deploy" } }wrangler.jsonc+ { + "$schema": "node_modules/wrangler/config-schema.json", + "compatibility_date": "2025-08-06", + "name": "my-vike-cloudflare-app", + "main": "virtual:photon:cloudflare:server-entry", + // Only required if your app depends a Node.js API + "compatibility_flags": ["nodejs_compat"] + } -
.gitignore
+ .wrangler/ -
(Optional) By default, Photon uses a built-in server that supports basic features like SSR. If you need additional server functionalities (e.g. file uploads ↗ or API routes ↗), then create your own server ↗.
Cloudflare APIs (bindings)
To access Cloudflare APIs (such as D1 and KV), use bindings which are available via the env object imported from cloudflare:workers.
import { env } from 'cloudflare:workers'
// Key-value store
env.KV.get('my-key')
// Environment variable
env.LOG_LEVEL
// ...Example of using Cloudflare D1:
npm create vike@latest -- --react --hono --drizzle --cloudflareOr go to vike.dev/new ↗ and select
Cloudflarewith an ORM.
TypeScript
If you use TypeScript, run wrangler types whenever you change your Cloudflare configuration to update the worker-configuration.d.ts file.
npx wrangler typesThen commit:
git commit -am "update cloudflare types"Make sure TypeScript loads it:
{
"compilerOptions": {
+ "types": ["./worker-configuration.d.ts"]
}
}See also: Cloudflare Workers > TypeScript.