TypeScript apps use server-only database helpers for tenant data. The SDK can create a request-scoped Drizzle client or use the governed proxy path when the runtime requires it.
Use request-scoped handles
import { withWorkspaceDb } from '@app-builder-platform/relpin-sdk/db'
export async function listOrders(env: Env) {
return withWorkspaceDb({ env }, async (db) => {
return db.execute('select id, status from orders limit 20')
})
}
Close handles after each request. withWorkspaceDb does this automatically.
Server-only boundary
The database helpers are server-only. If code runs in the browser, it should call a server route instead of importing the DB SDK.
Container mode
In container preview, the SDK uses the proxy data path so the app does not receive the raw tenant connection string.