Engineering & Architecture6 min read

How Conversora runs storefronts on Cloudflare Workers

A look at the Next.js, OpenNext, Cloudflare Workers, and PostgreSQL setup behind Conversora storefronts.

E

Engineering Team

Conversora Core Infrastructure

Published on 2026-09-10

Conversora runs storefronts for multiple merchants, each with its own catalog and store data. This post explains how the app uses Cloudflare Workers and connects to PostgreSQL.

Running the app on Cloudflare Workers

Conversora uses Next.js with OpenNext on Cloudflare Workers. Store-specific database queries include a store ID so each merchant's data stays within its own workspace.

Prisma extension scopes database queries to a store ID
// Strict tenant-bound query enforcement at the edge
export function tenantDb(storeId: string) {
  if (!storeId || typeof storeId !== "string") {
    throw new Error("CRITICAL: tenantDb invoked without valid storeId boundary.");
  }
  return prisma.$extends({
    query: {
      $allModels: {
        async $allOperations({ args, query }) {
          (args as any).where = { ...(args as any).where, storeId };
          return query(args);
        },
      },
    },
  });
}

Connecting to PostgreSQL with Hyperdrive

Cloudflare Hyperdrive pools connections between Workers and PostgreSQL. We use it to reduce the overhead of opening database connections from short-lived edge requests.

Conclusion & Next Steps

The setup combines OpenNext, Cloudflare Workers, and PostgreSQL connection pooling. Store ID scoping keeps merchant queries in the correct workspace.

Tags:#Cloudflare Workers#OpenNext#Next.js#Edge Architecture#PostgreSQL

Related Articles & Insights