Recommended setup in long running node server

Hi all!
I have a node.js based backend running on railway serving a frontend,
and I'm confused regarding the driver choice and whether and where to use pooling.

My code thus far has been the following
import "dotenv/config";
import { drizzle } from "drizzle-orm/node-postgres";
import { Pool } from "pg";
import { env } from "./env";
import * as schema from "./schema";

const pool = new Pool({
    connectionString: env.DATABASE_URL,
});
export const db = drizzle(pool, { schema });


However, the docs warn against double pooling, and I heard that server-side pooling might be better than client-side, especially when running replicas and the like.
I tried to use Client instead of Pool but it makes my backend crash on launch already.
Can you give me pointers towards a reliable production setup for a bog-standard fe/be webapp?
Was this page helpful?