Manual Setup? Cannot run @better-auth/cli generate

This may become a bigger problem down the line as well, I am not sure. I am attempting to go through the initial setup. My app runs on Cloudflare workers, which does not have access to process.env. Instead I must pass the variable to it from a context.

export const auth = (DATABASE_URL: string) => {
    return betterAuth({
    database: drizzleAdapter(getDb({ DATABASE_URL }), {
        provider: "pg",
    })
});
}


Having this in my auth.ts causes this error when attempting to generate the user tables
❯ npx @better-auth/cli generate
2025-06-12T01:21:44.064Z ERROR [Better Auth]: [#better-auth]: Couldn't read your auth config. Error: DATABASE_URL environment variable is required


I think I would rather create the schema file where I want to anyway. Is the schema we need to create documented anywhere?
Was this page helpful?