[{"data":1,"prerenderedAt":648},["ShallowReactive",2],{"navigation_docs":3,"-getting-started-introduction":134,"-getting-started-introduction-surround":645},[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":11,"body":136,"description":636,"extension":637,"links":638,"meta":639,"navigation":640,"path":12,"seo":641,"stem":13,"__hash__":644},"docs\u002F1.getting-started\u002F1.introduction.md",{"type":137,"value":138,"toc":629},"minimark",[139,144,152,155,160,181,214,217,219,223,273,275,279,416,427,429,433,586,588,592,625],[140,141,143],"h1",{"id":142},"introduction-to-http-postgresql-gateway","Introduction to HTTP PostgreSQL Gateway",[145,146,147,151],"p",{},[148,149,150],"strong",{},"HTTP PostgreSQL Gateway"," is a persistent bridge between HTTP-only runtimes and PostgreSQL. It allows serverless and edge clients to make stateless HTTPS requests while the gateway maintains reusable PostgreSQL connection pools on a private network where TCP or Unix-socket database access is available.",[153,154],"hr",{},[156,157,159],"h2",{"id":158},"the-serverless-database-dilemma","The Serverless Database Dilemma",[145,161,162,163,166,167,166,170,166,173,176,177,180],{},"Serverless platforms like ",[148,164,165],{},"Cloudflare Workers",", ",[148,168,169],{},"Vercel Functions",[148,171,172],{},"AWS Lambda",[148,174,175],{},"Deno Deploy",", and ",[148,178,179],{},"Bun"," present unique operational challenges when connecting directly to relational databases:",[182,183,184,191,202,208],"ul",{},[185,186,187,190],"li",{},[148,188,189],{},"No Direct Socket Support:"," Many edge runtimes (such as V8 isolates) cannot open raw TCP sockets to PostgreSQL.",[185,192,193,196,197,201],{},[148,194,195],{},"Connection Storms:"," Each serverless instance opens its own TCP connection. Spikes in concurrent traffic can quickly exhaust PostgreSQL's ",[198,199,200],"code",{},"max_connections"," limit.",[185,203,204,207],{},[148,205,206],{},"Expensive TLS Handshakes:"," Re-establishing TLS connections and authenticating with PostgreSQL on every cold start introduces significant latency.",[185,209,210,213],{},[148,211,212],{},"Distributed Database Secrets:"," Storing master database credentials inside numerous client-side or distributed deployment configs increases exposure risk.",[145,215,216],{},"HTTP PostgreSQL Gateway solves these problems by providing a high-performance HTTP front-end that lives close to PostgreSQL, manages the backend connection lifecycle, and enforces strict authorization.",[153,218],{},[156,220,222],{"id":221},"core-capabilities","Core Capabilities",[224,225,226,231,239,256,264,269],"u-page-grid",{},[227,228,230],"u-page-card",{"icon":28,"title":229,"to":39},"Native fetch() Support","Query PostgreSQL using standard HTTPS JSON requests without native binary drivers or socket shims.",[227,232,234,235,238],{"icon":67,"title":233,"to":101},"Persistent Connection Pooling","Maintains prewarmed, verified PostgreSQL sessions with automatic ",[198,236,237],{},"DISCARD ALL"," rollbacks and resets.",[227,240,242,243,166,246,166,249,166,252,255],{"icon":116,"title":241,"to":80},"Scoped Database Roles","Maps API keys to dynamically provisioned, least-privilege PostgreSQL roles with granular CRUD permissions (",[198,244,245],{},"c",[198,247,248],{},"r",[198,250,251],{},"u",[198,253,254],{},"d",").",[227,257,259,260,263],{"icon":72,"title":258,"to":70},"Idempotent Atomic Batches","Submit multi-statement transactions with ",[198,261,262],{},"Idempotency-Key"," headers to guarantee exactly-once commit behavior.",[227,265,268],{"icon":266,"title":267,"to":65},"i-lucide-clock","Asynchronous Query Queue","Queue queries that outlast typical serverless execution windows (up to 5 minutes) and poll for results.",[227,270,272],{"icon":103,"title":271,"to":106},"Built-in Observability","Worker-thread SQLite analytics, query counting, and automatic SQL literal sanitization for failed queries.",[153,274],{},[156,276,278],{"id":277},"architecture-at-a-glance","Architecture at a Glance",[280,281,286],"pre",{"className":282,"code":283,"language":284,"meta":285,"style":285},"language-mermaid shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","flowchart LR\n  Client[\"Serverless \u002F Edge Client\u003Cbr\u002F>(fetch)\"]\n  \n  subgraph Gateway[\"HTTP PostgreSQL Gateway (Fastify)\"]\n    direction TB\n    Auth[\"Auth & Rate Limiting\u003Cbr\u002F>(Redis \u002F Memory)\"]\n    AdminPool[\"PostgreSQL Admin Pool\u003Cbr\u002F>(Migrations & Roles)\"]\n    QueryPools[\"Per-Key Query Pools\u003Cbr\u002F>(Verified Sessions)\"]\n    Metadata[(\"JSON Metadata Store\")]\n    Analytics[(\"SQLite Analytics Worker\")]\n  end\n\n  Postgres[(\"PostgreSQL Cluster\u003Cbr\u002F>(Private Network)\")]\n\n  Client ==>|\"HTTPS + JSON\"| Auth\n  Auth --> AdminPool\n  Auth --> QueryPools\n  Auth --> Metadata\n  Auth -.-> Analytics\n  AdminPool ==>|\"Admin TCP\"| Postgres\n  QueryPools ==>|\"Scoped TCP\"| Postgres\n","mermaid","",[198,287,288,296,302,308,314,320,326,332,338,344,350,356,363,369,374,380,386,392,398,404,410],{"__ignoreMap":285},[289,290,293],"span",{"class":291,"line":292},"line",1,[289,294,295],{},"flowchart LR\n",[289,297,299],{"class":291,"line":298},2,[289,300,301],{},"  Client[\"Serverless \u002F Edge Client\u003Cbr\u002F>(fetch)\"]\n",[289,303,305],{"class":291,"line":304},3,[289,306,307],{},"  \n",[289,309,311],{"class":291,"line":310},4,[289,312,313],{},"  subgraph Gateway[\"HTTP PostgreSQL Gateway (Fastify)\"]\n",[289,315,317],{"class":291,"line":316},5,[289,318,319],{},"    direction TB\n",[289,321,323],{"class":291,"line":322},6,[289,324,325],{},"    Auth[\"Auth & Rate Limiting\u003Cbr\u002F>(Redis \u002F Memory)\"]\n",[289,327,329],{"class":291,"line":328},7,[289,330,331],{},"    AdminPool[\"PostgreSQL Admin Pool\u003Cbr\u002F>(Migrations & Roles)\"]\n",[289,333,335],{"class":291,"line":334},8,[289,336,337],{},"    QueryPools[\"Per-Key Query Pools\u003Cbr\u002F>(Verified Sessions)\"]\n",[289,339,341],{"class":291,"line":340},9,[289,342,343],{},"    Metadata[(\"JSON Metadata Store\")]\n",[289,345,347],{"class":291,"line":346},10,[289,348,349],{},"    Analytics[(\"SQLite Analytics Worker\")]\n",[289,351,353],{"class":291,"line":352},11,[289,354,355],{},"  end\n",[289,357,359],{"class":291,"line":358},12,[289,360,362],{"emptyLinePlaceholder":361},true,"\n",[289,364,366],{"class":291,"line":365},13,[289,367,368],{},"  Postgres[(\"PostgreSQL Cluster\u003Cbr\u002F>(Private Network)\")]\n",[289,370,372],{"class":291,"line":371},14,[289,373,362],{"emptyLinePlaceholder":361},[289,375,377],{"class":291,"line":376},15,[289,378,379],{},"  Client ==>|\"HTTPS + JSON\"| Auth\n",[289,381,383],{"class":291,"line":382},16,[289,384,385],{},"  Auth --> AdminPool\n",[289,387,389],{"class":291,"line":388},17,[289,390,391],{},"  Auth --> QueryPools\n",[289,393,395],{"class":291,"line":394},18,[289,396,397],{},"  Auth --> Metadata\n",[289,399,401],{"class":291,"line":400},19,[289,402,403],{},"  Auth -.-> Analytics\n",[289,405,407],{"class":291,"line":406},20,[289,408,409],{},"  AdminPool ==>|\"Admin TCP\"| Postgres\n",[289,411,413],{"class":291,"line":412},21,[289,414,415],{},"  QueryPools ==>|\"Scoped TCP\"| Postgres\n",[145,417,418,419,422,423,426],{},"The service separates ",[148,420,421],{},"administrative database access"," from ",[148,424,425],{},"client query access",". API-key scopes are translated directly into PostgreSQL roles, ensuring that PostgreSQL remains the ultimate authorization boundary for SQL execution.",[153,428],{},[156,430,432],{"id":431},"gateway-vs-other-solutions","Gateway vs. Other Solutions",[434,435,436,455],"table",{},[437,438,439],"thead",{},[440,441,442,447,450,453],"tr",{},[443,444,446],"th",{"align":445},"left","Feature",[443,448,449],{"align":445},"Direct Driver",[443,451,452],{"align":445},"PgBouncer \u002F Pgpool",[443,454,150],{"align":445},[456,457,458,480,497,514,531,548,568],"tbody",{},[440,459,460,466,469,471],{},[461,462,463],"td",{"align":445},[148,464,465],{},"Protocol",[461,467,468],{"align":445},"Native TCP",[461,470,468],{"align":445},[461,472,473],{"align":445},[148,474,475,476,479],{},"HTTPS \u002F JSON (",[198,477,478],{},"fetch()",")",[440,481,482,487,490,492],{},[461,483,484],{"align":445},[148,485,486],{},"Edge Isolation Friendly",[461,488,489],{"align":445},"No (requires TCP)",[461,491,489],{"align":445},[461,493,494],{"align":445},[148,495,496],{},"Yes (Native HTTP)",[440,498,499,504,507,509],{},[461,500,501],{"align":445},[148,502,503],{},"Credential Distribution",[461,505,506],{"align":445},"DB passwords in functions",[461,508,506],{"align":445},[461,510,511],{"align":445},[148,512,513],{},"Scoped Bearer API Keys",[440,515,516,521,524,526],{},[461,517,518],{"align":445},[148,519,520],{},"Authorization Boundary",[461,522,523],{"align":445},"Client SQL string",[461,525,523],{"align":445},[461,527,528],{"align":445},[148,529,530],{},"PostgreSQL Role per Scope",[440,532,533,538,541,543],{},[461,534,535],{"align":445},[148,536,537],{},"Async Execution",[461,539,540],{"align":445},"None",[461,542,540],{"align":445},[461,544,545],{"align":445},[148,546,547],{},"Yes (Persistent background queue)",[440,549,550,555,558,560],{},[461,551,552],{"align":445},[148,553,554],{},"Idempotent Transactions",[461,556,557],{"align":445},"Client managed",[461,559,557],{"align":445},[461,561,562],{"align":445},[148,563,564,565,567],{},"Yes (",[198,566,262],{}," tracking)",[440,569,570,575,578,581],{},[461,571,572],{"align":445},[148,573,574],{},"Failed SQL Sanitization",[461,576,577],{"align":445},"Application logs",[461,579,580],{"align":445},"Raw logs",[461,582,583],{"align":445},[148,584,585],{},"Yes (Auto-redacted analytics)",[153,587],{},[156,589,591],{"id":590},"next-steps","Next Steps",[182,593,594,602,612,618],{},[185,595,596,597,601],{},"Follow the ",[598,599,600],"a",{"href":17},"Quickstart Guide"," to run the gateway locally in 5 minutes.",[185,603,604,605,608,609,611],{},"Learn about the ",[598,606,607],{"href":34},"Serverless Integration Pattern"," and review the ",[598,610,38],{"href":39},".",[185,613,614,615,611],{},"Explore all supported execution methods in the ",[598,616,617],{"href":60},"API Routes Reference",[185,619,620,621,624],{},"Inspect the ",[598,622,623],{"href":127},"Security Hardening Guide"," before deploying to production.",[626,627,628],"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":285,"searchDepth":298,"depth":298,"links":630},[631,632,633,634,635],{"id":158,"depth":298,"text":159},{"id":221,"depth":298,"text":222},{"id":277,"depth":298,"text":278},{"id":431,"depth":298,"text":432},{"id":590,"depth":298,"text":591},"Overview of HTTP PostgreSQL Gateway — connecting serverless and edge workloads to PostgreSQL safely over HTTP.","md",null,{},{"icon":14},{"title":642,"description":643},"Introduction · HTTP PostgreSQL Gateway","What is HTTP PostgreSQL Gateway, why use an HTTP bridge, core design principles, and feature comparison.","NqcOBUSNX_6mjVuBArDp-LDVBSb7W909AvhvoyOx1uM",[638,646],{"title":16,"path":17,"stem":18,"description":647,"icon":19,"children":-1},"Get up and running with HTTP PostgreSQL Gateway in under 5 minutes.",1795399273837]