[{"data":1,"prerenderedAt":537},["ShallowReactive",2],{"navigation_docs":3,"-serverless-overview":134,"-serverless-overview-surround":532},[4,26,52,88,114],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":25},"Getting Started","i-lucide-rocket","\u002Fgetting-started","1.getting-started",[10,15,20],{"title":11,"path":12,"stem":13,"icon":14},"Introduction","\u002Fgetting-started\u002Fintroduction","1.getting-started\u002F1.introduction","i-lucide-sparkles",{"title":16,"path":17,"stem":18,"icon":19},"Quickstart","\u002Fgetting-started\u002Fquickstart","1.getting-started\u002F2.quickstart","i-lucide-play",{"title":21,"path":22,"stem":23,"icon":24},"Architecture & State","\u002Fgetting-started\u002Farchitecture","1.getting-started\u002F3.architecture","i-lucide-cpu",false,{"title":27,"icon":28,"path":29,"stem":30,"children":31,"page":25},"Serverless & Edge","i-lucide-zap","\u002Fserverless","2.serverless",[32,37,42,47],{"title":33,"path":34,"stem":35,"icon":36},"Serverless Architecture","\u002Fserverless\u002Foverview","2.serverless\u002F1.overview","i-lucide-globe",{"title":38,"path":39,"stem":40,"icon":41},"Minimal Client","\u002Fserverless\u002Fminimal-client","2.serverless\u002F2.minimal-client","i-lucide-code",{"title":43,"path":44,"stem":45,"icon":46},"Execution Modes","\u002Fserverless\u002Fexecution-modes","2.serverless\u002F3.execution-modes","i-lucide-list-tree",{"title":48,"path":49,"stem":50,"icon":51},"Timeouts & Retries","\u002Fserverless\u002Ftimeouts-and-retries","2.serverless\u002F4.timeouts-and-retries","i-lucide-alert-triangle",{"title":53,"icon":54,"path":55,"stem":56,"children":57,"page":25},"API Reference","i-lucide-terminal","\u002Fapi-reference","3.api-reference",[58,63,68,73,78,83],{"title":59,"path":60,"stem":61,"icon":62},"Protocol & Authentication","\u002Fapi-reference\u002Foverview","3.api-reference\u002F1.overview","i-lucide-key",{"title":64,"path":65,"stem":66,"icon":67},"Queries","\u002Fapi-reference\u002Fqueries","3.api-reference\u002F2.queries","i-lucide-database",{"title":69,"path":70,"stem":71,"icon":72},"Transactions","\u002Fapi-reference\u002Ftransactions","3.api-reference\u002F3.transactions","i-lucide-layers",{"title":74,"path":75,"stem":76,"icon":77},"Administration","\u002Fapi-reference\u002Fadministration","3.api-reference\u002F4.administration","i-lucide-settings",{"title":79,"path":80,"stem":81,"icon":82},"Scopes & Permissions","\u002Fapi-reference\u002Fscopes-permissions","3.api-reference\u002F5.scopes-permissions","i-lucide-shield",{"title":84,"path":85,"stem":86,"icon":87},"Errors & Diagnostics","\u002Fapi-reference\u002Ferrors","3.api-reference\u002F6.errors","i-lucide-alert-circle",{"title":89,"icon":90,"path":91,"stem":92,"children":93,"page":25},"Configuration","i-lucide-sliders","\u002Fconfiguration","4.configuration",[94,99,104,109],{"title":95,"path":96,"stem":97,"icon":98},"Gateway YAML","\u002Fconfiguration\u002Fgateway-yaml","4.configuration\u002F1.gateway-yaml","i-lucide-file-code",{"title":100,"path":101,"stem":102,"icon":103},"Connection Pools","\u002Fconfiguration\u002Fconnection-pools","4.configuration\u002F2.connection-pools","i-lucide-activity",{"title":105,"path":106,"stem":107,"icon":108},"Analytics & Observability","\u002Fconfiguration\u002Fanalytics","4.configuration\u002F3.analytics","i-lucide-bar-chart",{"title":110,"path":111,"stem":112,"icon":113},"Runtime Files & State","\u002Fconfiguration\u002Fruntime-files","4.configuration\u002F4.runtime-files","i-lucide-folder",{"title":115,"icon":116,"path":117,"stem":118,"children":119,"page":25},"Operations & Security","i-lucide-shield-check","\u002Foperations","5.operations",[120,125,129],{"title":121,"path":122,"stem":123,"icon":124},"Production Deployment","\u002Foperations\u002Fdeployment","5.operations\u002F1.deployment","i-lucide-server",{"title":126,"path":127,"stem":128,"icon":116},"Security Hardening","\u002Foperations\u002Fsecurity","5.operations\u002F2.security",{"title":130,"path":131,"stem":132,"icon":133},"Development & Contributing","\u002Foperations\u002Fdevelopment","5.operations\u002F3.development","i-lucide-code-2",{"id":135,"title":33,"body":136,"description":523,"extension":524,"links":525,"meta":526,"navigation":527,"path":34,"seo":528,"stem":35,"__hash__":531},"docs\u002F2.serverless\u002F1.overview.md",{"type":137,"value":138,"toc":512},"minimark",[139,144,148,151,156,263,271,273,277,282,293,297,304,307,320,324,327,339,342,346,353,355,359,362,480,482,486,508],[140,141,143],"h1",{"id":142},"serverless-edge-integration","Serverless & Edge Integration",[145,146,147],"p",{},"HTTP PostgreSQL Gateway is specifically built for runtimes that support outbound HTTPS requests but cannot or should not establish direct TCP connections to PostgreSQL.",[149,150],"hr",{},[152,153,155],"h2",{"id":154},"deployment-architecture","Deployment Architecture",[157,158,163],"pre",{"className":159,"code":160,"language":161,"meta":162,"style":162},"language-mermaid shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","flowchart TD\n  subgraph Edge[\"Serverless \u002F Edge Runtimes\"]\n    Workers[\"Cloudflare Workers\"]\n    Vercel[\"Vercel Functions\"]\n    Lambda[\"AWS Lambda\"]\n  end\n\n  subgraph VPC[\"Private VPC\"]\n    Gateway[\"HTTP PostgreSQL Gateway\u003Cbr\u002F>- Reusable connection pools\u003Cbr\u002F>- Scoped role authorization\u003Cbr\u002F>- Atomic transactions & queue\"]\n    Postgres[(\"PostgreSQL Cluster\")]\n  end\n\n  Workers -->|\"HTTPS fetch()\"| Gateway\n  Vercel -->|\"HTTPS fetch()\"| Gateway\n  Lambda -->|\"HTTPS fetch()\"| Gateway\n  Gateway -->|\"Private TCP \u002F Socket\"| Postgres\n","mermaid","",[164,165,166,174,180,186,192,198,204,211,217,223,229,234,239,245,251,257],"code",{"__ignoreMap":162},[167,168,171],"span",{"class":169,"line":170},"line",1,[167,172,173],{},"flowchart TD\n",[167,175,177],{"class":169,"line":176},2,[167,178,179],{},"  subgraph Edge[\"Serverless \u002F Edge Runtimes\"]\n",[167,181,183],{"class":169,"line":182},3,[167,184,185],{},"    Workers[\"Cloudflare Workers\"]\n",[167,187,189],{"class":169,"line":188},4,[167,190,191],{},"    Vercel[\"Vercel Functions\"]\n",[167,193,195],{"class":169,"line":194},5,[167,196,197],{},"    Lambda[\"AWS Lambda\"]\n",[167,199,201],{"class":169,"line":200},6,[167,202,203],{},"  end\n",[167,205,207],{"class":169,"line":206},7,[167,208,210],{"emptyLinePlaceholder":209},true,"\n",[167,212,214],{"class":169,"line":213},8,[167,215,216],{},"  subgraph VPC[\"Private VPC\"]\n",[167,218,220],{"class":169,"line":219},9,[167,221,222],{},"    Gateway[\"HTTP PostgreSQL Gateway\u003Cbr\u002F>- Reusable connection pools\u003Cbr\u002F>- Scoped role authorization\u003Cbr\u002F>- Atomic transactions & queue\"]\n",[167,224,226],{"class":169,"line":225},10,[167,227,228],{},"    Postgres[(\"PostgreSQL Cluster\")]\n",[167,230,232],{"class":169,"line":231},11,[167,233,203],{},[167,235,237],{"class":169,"line":236},12,[167,238,210],{"emptyLinePlaceholder":209},[167,240,242],{"class":169,"line":241},13,[167,243,244],{},"  Workers -->|\"HTTPS fetch()\"| Gateway\n",[167,246,248],{"class":169,"line":247},14,[167,249,250],{},"  Vercel -->|\"HTTPS fetch()\"| Gateway\n",[167,252,254],{"class":169,"line":253},15,[167,255,256],{},"  Lambda -->|\"HTTPS fetch()\"| Gateway\n",[167,258,260],{"class":169,"line":259},16,[167,261,262],{},"  Gateway -->|\"Private TCP \u002F Socket\"| Postgres\n",[264,265,266,270],"warning",{},[267,268,269],"strong",{},"Deploy the gateway as a long-running persistent daemon"," inside your private database network (e.g., AWS ECS, EKS, GCP Cloud Run with min-instances, or standard VMs). Never package or start the gateway inside individual serverless function invocations.",[149,272],{},[152,274,276],{"id":275},"key-benefits-for-serverless","Key Benefits for Serverless",[278,279,281],"h3",{"id":280},"_1-zero-native-driver-dependencies","1. Zero Native Driver Dependencies",[145,283,284,285,288,289,292],{},"Native PostgreSQL client libraries (like ",[164,286,287],{},"pg-native"," or libpq bindings) require compiled C++ binaries that complicate deployment packages, increase bundle size, and frequently break across different serverless architectures (x86 vs ARM). HTTP PostgreSQL Gateway works with standard ",[164,290,291],{},"fetch()",", available natively in modern Node.js, Deno, Bun, and browser-like runtimes.",[278,294,296],{"id":295},"_2-elimination-of-connection-starvation","2. Elimination of Connection Starvation",[145,298,299,300,303],{},"When traffic spikes from 10 to 1,000 concurrent serverless invocations, a direct database connection model attempts to open 1,000 direct TCP connections. PostgreSQL quickly runs out of memory or crashes with ",[164,301,302],{},"FATAL: sorry, too many clients already",".",[145,305,306],{},"With HTTP PostgreSQL Gateway:",[308,309,310,314,317],"ul",{},[311,312,313],"li",{},"Serverless invocations make fast HTTP requests to the gateway.",[311,315,316],{},"The gateway multiplexes requests across a fixed, bounded pool of long-lived PostgreSQL connections.",[311,318,319],{},"Queued requests wait briefly for a warm connection or fail gracefully before overwhelming PostgreSQL.",[278,321,323],{"id":322},"_3-lower-cold-start-latency","3. Lower Cold-Start Latency",[145,325,326],{},"Direct TCP database connections require:",[328,329,330,333,336],"ol",{},[311,331,332],{},"TCP handshake (1 RTT)",[311,334,335],{},"TLS handshake (1-2 RTTs)",[311,337,338],{},"PostgreSQL authentication & startup negotiation (1-2 RTTs)",[145,340,341],{},"The gateway maintains prewarmed connections to PostgreSQL. Serverless requests over persistent HTTPS or HTTP\u002F2 keep TLS connections warm, reducing query overhead during cold starts.",[278,343,345],{"id":344},"_4-elimination-of-master-password-distribution","4. Elimination of Master Password Distribution",[145,347,348,349,352],{},"Instead of embedding master database credentials across dozens of microservices or edge deployments, each service receives a ",[267,350,351],{},"scoped API key",". If an API key is compromised, its access is strictly bounded to specific tables and CRUD operations, and it can be revoked instantly without restarting PostgreSQL or cycling master database credentials.",[149,354],{},[152,356,358],{"id":357},"supported-serverless-edge-runtimes","Supported Serverless & Edge Runtimes",[145,360,361],{},"The gateway is compatible with any runtime that supports standard HTTPS and JSON:",[363,364,365,382],"table",{},[366,367,368],"thead",{},[369,370,371,376,379],"tr",{},[372,373,375],"th",{"align":374},"left","Runtime",[372,377,378],{"align":374},"Transport",[372,380,381],{"align":374},"Environment Variable Configuration",[383,384,385,404,418,433,448,466],"tbody",{},[369,386,387,393,398],{},[388,389,390],"td",{"align":374},[267,391,392],{},"Cloudflare Workers",[388,394,395,396],{"align":374},"Standard ",[164,397,291],{},[388,399,400,403],{"align":374},[164,401,402],{},"wrangler.toml"," encrypted secrets",[369,405,406,411,415],{},[388,407,408],{"align":374},[267,409,410],{},"Vercel Functions",[388,412,395,413],{"align":374},[164,414,291],{},[388,416,417],{"align":374},"Vercel Project Environment Variables",[369,419,420,425,430],{},[388,421,422],{"align":374},[267,423,424],{},"AWS Lambda",[388,426,427,428],{"align":374},"Node 20+ ",[164,429,291],{},[388,431,432],{"align":374},"AWS Systems Manager \u002F Secrets Manager",[369,434,435,440,445],{},[388,436,437],{"align":374},[267,438,439],{},"Deno Deploy",[388,441,442,443],{"align":374},"Built-in ",[164,444,291],{},[388,446,447],{"align":374},"Deno Deploy Dashboard Environment Variables",[369,449,450,455,460],{},[388,451,452],{"align":374},[267,453,454],{},"Bun",[388,456,457,458],{"align":374},"Native ",[164,459,291],{},[388,461,462,465],{"align":374},[164,463,464],{},".env"," or Bun environment variables",[369,467,468,473,477],{},[388,469,470],{"align":374},[267,471,472],{},"Google Cloud Functions",[388,474,457,475],{"align":374},[164,476,291],{},[388,478,479],{"align":374},"Secret Manager binding",[149,481],{},[152,483,485],{"id":484},"next-steps","Next Steps",[308,487,488,495,502],{},[311,489,490,491,303],{},"Implement the ",[492,493,494],"a",{"href":39},"Minimal fetch() Client",[311,496,497,498,501],{},"Understand ",[492,499,500],{"href":49},"Timeouts and Retry Rules"," to prevent accidental double-writes.",[311,503,504,505,507],{},"Review ",[492,506,43],{"href":44}," to pick the right strategy for your workload.",[509,510,511],"style",{},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":162,"searchDepth":176,"depth":176,"links":513},[514,515,521,522],{"id":154,"depth":176,"text":155},{"id":275,"depth":176,"text":276,"children":516},[517,518,519,520],{"id":280,"depth":182,"text":281},{"id":295,"depth":182,"text":296},{"id":322,"depth":182,"text":323},{"id":344,"depth":182,"text":345},{"id":357,"depth":176,"text":358},{"id":484,"depth":176,"text":485},"How HTTP PostgreSQL Gateway bridges the gap between serverless functions and relational databases.","md",null,{},{"icon":36},{"title":529,"description":530},"Serverless Integration · HTTP PostgreSQL Gateway","Deployment model, architectural patterns, and advantages of using an HTTP gateway for serverless and edge workloads.","TJGbqqn5xALs2BUABoVpS9CCv08lOmi3jq3NZbWqitA",[533,535],{"title":21,"path":22,"stem":23,"description":534,"icon":24,"children":-1},"In-depth technical architecture, state boundaries, dual-pool model, and scaling boundaries.",{"title":38,"path":39,"stem":40,"description":536,"icon":41,"children":-1},"Production-ready TypeScript and JavaScript client examples for querying PostgreSQL via fetch().",1795399273837]