Eliminate glue code. Connect to authentication, PostgreSQL 17, serverless functions, maps, object storage, and transactional mail using a single cohesive SDK—or connect directly over standard PostgreSQL wire protocols.
One unified client for TypeScript, Python, Dart/Flutter, Go, Rust, cURL, and Agent-Native Model Context Protocol (MCP).
import { createClient } from '@pgbhub/client';
// Initialize single client for all 8 PGB Hub services
const pgb = createClient({
endpoint: 'https://my-app.pgbhub.app',
apiKey: process.env.PGB_API_KEY
});
// 1. Auth: Passwordless 6-digit OTP verification
const { session, user } = await pgb.auth.verifyOtp({
email: '[email protected]',
token: '592810'
});
// 2. Database: Query JSONB collections with native PostGIS spatial filters
const drivers = await pgb.table('drivers').find({
status: 'AVAILABLE',
location: { $near: { coordinates: [-122.4194, 37.7749], maxDistanceMeters: 5000 } }
});
// 3. Storage: Generate 15-minute presigned upload URL for direct S3 upload
const { uploadUrl, fileKey } = await pgb.storage.getPresignedUploadUrl({
path: 'receipts/order-948.pdf'
});
// 4. Maps: Compute turn-by-turn directions via self-hosted OSRM routing
const route = await pgb.maps.getDirections({
origin: [-122.4194, 37.7749],
destination: [-122.2711, 37.8044]
});
// 5. Mail: Dispatch transactional email with automatic SES deliverability
await pgb.mail.send({
to: user.email,
subject: 'Your Ride is Confirmed',
html: '<h2>Driver is arriving in 4 mins</h2>'
});Beyond the unified HTTP SDK, every PGB Hub database exposes a public TLS 1.3 PostgreSQL 17 wire endpoint. Connect with Prisma, Drizzle, SQLAlchemy, TypeORM, or raw SQL drivers.
DATABASE_URL="postgresql://pgb_app:[email protected]:5433/production_db?sslmode=require"datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
id String @id @default(uuid())
data Json // Native JSONB document storage
createdAt DateTime @default(now())
}import { pgTable, text, jsonb, timestamp } from 'drizzle-orm/pg-core';
export const documents = pgTable('documents', {
id: text('id').primaryKey(),
payload: jsonb('payload').notNull(),
updatedAt: timestamp('updated_at').defaultNow(),
});// Accelerated query with Drizzle JSON operators
const results = await db.select().from(documents)
.where(sql`payload->>'status' = 'published'`);from sqlalchemy import create_engine, Column, String
from sqlalchemy.dialects.postgresql import JSONB
engine = create_engine("postgresql+psycopg://pgb_app:[email protected]:5433/production_db?sslmode=require")class Document(Base):
__tablename__ = "documents"
id = Column(String, primary_key=True)
attributes = Column(JSONB) # 100% GIN indexedSimply paste your public TLS connection string or input host (`db.pgbhub.app`), port 5433, database name, and credentials with SSL enabled (`Require`).
Provision databases, serverless compute, microVM containers, maps, auth, storage, and agent MCP tooling under one unified sovereign endpoint.