Analog
Add the SDK to an Analog app to get resource detection, typed database queries and migrations. Analog keeps its own build and Cloudflare integration. The SDK plugs into its Vite config.
On this pageSet up the SDK in an Analog project · Use SDK features such as void/db from Analog · Reach Cloudflare bindings directly when you need them
Setup
Follow these steps in order.
1. Create a new project
Now you will create a new app and open the new app folder.
npx create-analog@latest my-app
cd my-appExample output: the scaffolder asks a few questions and creates the app folder.
2. Install dependencies
Now you will install the dependencies.
npm install -D void nitro-cloudflare-devExample output: npm finishes with added N packages and no errors.
The SDK provides the local Cloudflare binding runtime. nitro-cloudflare-dev creates the platform proxy in dev. This lets void/db, void/kv and other helpers reach your bindings.
3. Configure vite.config.ts
import analog from '@analogjs/platform';
import { defineConfig } from 'vite';
import { voidPlugin } from 'void';
export default defineConfig({
resolve: {
mainFields: ['module'],
},
plugins: [
analog({
ssr: true,
nitro: {
preset: 'cloudflare-module',
cloudflareDev: { configPath: './.void-wrangler.jsonc' },
modules: ['nitro-cloudflare-dev', 'void/nitro'],
},
}),
voidPlugin(),
],
});The void/nitro module gives Analog API routes and page server loads your app's void/db and @schema.
4. Create void.config.ts
This step creates the config that the SDK turns into Analog's dev Cloudflare config:
import { defineConfig } from 'void/config';
export default defineConfig({
cloudflare: {
name: 'my-app',
compatibility_date: '2026-02-24',
compatibility_flags: ['nodejs_compat', 'nodejs_als'],
},
});Nitro's Cloudflare runtime needs nodejs_compat. The void/* helpers, such as void/db and void/kv, need nodejs_als.
5. Deploy
Requires: login to your deploy target
void auth login opens your browser to sign in to Cloudflare or your team's platform. No token goes in your project.
Now you will sign in and deploy the app.
void auth login
void deployExample output: A browser window opens. The CLI confirms the sign-in when you finish. Build and upload progress, then the live URL.
Use SDK features
Most SDK platform features work with Analog. Use them in page server loaders, actions and API routes:
Framework mode does not support SDK-managed auth yet. Use Better Auth's official integration for now.
Database
// src/app/pages/users.server.ts
import type { PageServerLoad } from '@analogjs/router';
import { users } from '@schema';
import { db } from 'void/db';
export const load = async ({ event }: PageServerLoad) => {
return { users: await db.select().from(users) };
};Other resources
Use KV, object storage and AI in server-side code. The imports are the same as in an SDK app. Add cron jobs in crons/ and queue consumers in queues/.
Environment variables
Declare variables in env.ts. Read them with import { env } from "void/env". See Environment Variables for local values, production secrets and public VITE_* values.
For environment variables, void/env replaces the H3 event context and import { env } from "cloudflare:workers". Keep those for raw binding access, such as D1, KV or R2.
Access bindings directly
You can also read raw Cloudflare bindings from the H3 event context or the cloudflare:workers module:
import { env } from 'cloudflare:workers';
// src/server/routes/api/users.ts
import { eventHandler } from 'h3';
export default eventHandler(async () => {
const { results } = await env.DB.prepare('SELECT * FROM users').all();
return results;
});