Analog
Use Void with Analog for resource detection, typed database queries, and migrations.
Setup
1. Create a new project
npx create-analog@latest my-app
cd my-app2. Install dependencies
npm install -D void nitro-cloudflare-devUse nitro-cloudflare-dev for local Cloudflare 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
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).
5. Deploy
void connect --platform cloudflare
void deployvoid connect signs you in to Cloudflare, asks which account to use, and saves it as the deploy target. To deploy to a Void platform run by your team instead, see Deployment.
Using Void Features
Use Void resources in page server loaders, actions, and API routes. For authentication, use your framework’s Better Auth integration.
Database
To show the users from your database on an Analog page, query your users table in its server loader.
// 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
See supported resources and background jobs for KV, storage, AI, cron jobs, and queues.
Environment Variables
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.
Accessing Bindings Directly
You can also access raw Cloudflare bindings via the H3 event context or the cloudflare:workers module:
// src/server/routes/api/users.ts
import { env } from 'cloudflare:workers';
import { eventHandler } from 'h3';
export default eventHandler(async () => {
const { results } = await env.DB.prepare('SELECT * FROM users').all();
return results;
});