Adding a provider
Ship another hosted product on top of the Postgres driver
Hosted Postgres products reuse @db-sdk/postgres. Supabase in @db-sdk/supabase is the reference.
Package
Publish @db-sdk/<product>. Depend on @db-sdk/postgres and @db-sdk/core. Put product auth and listing APIs in that package when the flow is reusable across hosts.
Resolve
Turn product credentials into a Postgres URI, or into host, user, password, and database. That resolve step is the provider’s job.
Open
Call postgres({ id: "<product>", connectionString }). Do not reimplement SQL policy or catalog. Export id as the product name and keep driver as "postgres" so hosts can reuse one SQL tool for every Postgres-backed connection.
Example
import { postgres } from "@db-sdk/postgres";
import type { DatabaseProvider } from "@db-sdk/core";
import type { PostgresQuery } from "@db-sdk/postgres";
export async function hosted(options: {
apiKey: string;
projectId: string;
}): Promise<DatabaseProvider<PostgresQuery>> {
const connectionString = await resolveConnectionString(options);
return postgres({
id: "<product>",
connectionString,
});
}Raw URI users skip the hosted package and call postgres({ connectionString }) directly.