| outline | deep |
|---|
Use Void with Analog for resource detection, typed database queries, and migrations. Analog keeps its own build and Cloudflare integration; Void plugs into its Vite configuration.
npx create-analog@latest my-app
cd my-appnpm install -D void nitro-cloudflare-devVoid provides the local Cloudflare binding runtime. nitro-cloudflare-dev creates the platform proxy during development so that void/db, void/kv, and other runtime helpers can access bindings.
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.
Void generates the Cloudflare config used by Analog's development runtime:
import { defineConfig } from 'void/config';
export default defineConfig({
cloudflare: {
name: 'my-app',
compatibility_date: '2026-02-24',
compatibility_flags: ['nodejs_compat', 'nodejs_als'],
},
});nodejs_compat is required for Nitro's Cloudflare runtime. nodejs_als is required for void/* runtime helpers (e.g. void/db, void/kv).
void auth login
void deployMost Void platform features work with Analog. Use them in page server loaders, actions, and API routes:
Void-managed auth is not supported in framework mode yet. Use Better Auth's official integration directly for now.
// 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) };
};Use KV, object storage, and AI from server-side code with the same imports as a Void app. Add cron jobs in crons/ and queue consumers in queues/.
Declare variables in env.ts and read them with import { env } from "void/env". See Environment Variables for local values, production secrets, and public VITE_* values.
void/env replaces the H3 event context and import { env } from "cloudflare:workers" for env-var access. Keep those around when you need raw binding access (D1, KV, R2, etc.).
You can also access raw Cloudflare bindings via 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;
});