[{"data":1,"prerenderedAt":810},["ShallowReactive",2],{"navigation_docs":3,"-getting-started-architecture":134,"-getting-started-architecture-surround":805},[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":21,"body":136,"description":796,"extension":797,"links":798,"meta":799,"navigation":800,"path":22,"seo":801,"stem":23,"__hash__":804},"docs\u002F1.getting-started\u002F3.architecture.md",{"type":137,"value":138,"toc":780},"minimark",[139,144,148,151,156,288,290,294,299,310,314,321,341,345,349,352,385,393,400,404,422,426,429,431,435,438,559,561,565,659,661,665,672,735,737,741,744,776],[140,141,143],"h1",{"id":142},"architecture-state-ownership","Architecture & State Ownership",[145,146,147],"p",{},"HTTP PostgreSQL Gateway is designed as a persistent, high-throughput bridge between short-lived HTTP-only environments and a private PostgreSQL cluster. It maintains long-lived TCP connections, enforces fine-grained authorization, and coordinates state across background workers.",[149,150],"hr",{},[152,153,155],"h2",{"id":154},"component-topology","Component Topology",[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  Client[\"Serverless \u002F Edge Client\"]\n  \n  subgraph Fastify[\"Fastify Web Server\"]\n    Hooks[\"Authentication & Rate Limiting\"]\n    AdminPool[\"PostgreSQL Admin Pool\"]\n    QueryPools[\"Per-Key Query Pools\"]\n    JsonDB[(\"data\u002Fdata.json + Lock\")]\n    Worker[(\"SQLite Analytics Worker\")]\n  end\n\n  Postgres[(\"PostgreSQL Server\")]\n\n  Client -->|\"HTTPS JSON\"| Hooks\n  Hooks --> AdminPool\n  Hooks --> QueryPools\n  Hooks --> JsonDB\n  Hooks -.-> Worker\n  AdminPool --> Postgres\n  QueryPools --> Postgres\n","mermaid","",[164,165,166,174,180,186,192,198,204,210,216,222,228,235,241,246,252,258,264,270,276,282],"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],{},"  Client[\"Serverless \u002F Edge Client\"]\n",[167,181,183],{"class":169,"line":182},3,[167,184,185],{},"  \n",[167,187,189],{"class":169,"line":188},4,[167,190,191],{},"  subgraph Fastify[\"Fastify Web Server\"]\n",[167,193,195],{"class":169,"line":194},5,[167,196,197],{},"    Hooks[\"Authentication & Rate Limiting\"]\n",[167,199,201],{"class":169,"line":200},6,[167,202,203],{},"    AdminPool[\"PostgreSQL Admin Pool\"]\n",[167,205,207],{"class":169,"line":206},7,[167,208,209],{},"    QueryPools[\"Per-Key Query Pools\"]\n",[167,211,213],{"class":169,"line":212},8,[167,214,215],{},"    JsonDB[(\"data\u002Fdata.json + Lock\")]\n",[167,217,219],{"class":169,"line":218},9,[167,220,221],{},"    Worker[(\"SQLite Analytics Worker\")]\n",[167,223,225],{"class":169,"line":224},10,[167,226,227],{},"  end\n",[167,229,231],{"class":169,"line":230},11,[167,232,234],{"emptyLinePlaceholder":233},true,"\n",[167,236,238],{"class":169,"line":237},12,[167,239,240],{},"  Postgres[(\"PostgreSQL Server\")]\n",[167,242,244],{"class":169,"line":243},13,[167,245,234],{"emptyLinePlaceholder":233},[167,247,249],{"class":169,"line":248},14,[167,250,251],{},"  Client -->|\"HTTPS JSON\"| Hooks\n",[167,253,255],{"class":169,"line":254},15,[167,256,257],{},"  Hooks --> AdminPool\n",[167,259,261],{"class":169,"line":260},16,[167,262,263],{},"  Hooks --> QueryPools\n",[167,265,267],{"class":169,"line":266},17,[167,268,269],{},"  Hooks --> JsonDB\n",[167,271,273],{"class":169,"line":272},18,[167,274,275],{},"  Hooks -.-> Worker\n",[167,277,279],{"class":169,"line":278},19,[167,280,281],{},"  AdminPool --> Postgres\n",[167,283,285],{"class":169,"line":284},20,[167,286,287],{},"  QueryPools --> Postgres\n",[149,289],{},[152,291,293],{"id":292},"core-subsystems","Core Subsystems",[295,296,298],"h3",{"id":297},"_1-http-layer-fastify","1. HTTP Layer (Fastify)",[145,300,301,302,305,306,309],{},"Fastify manages request routing, JSON parsing, payload size enforcement, compression, and error responses. Authentication and rate limiting execute as early lifecycle hooks. Public access is strictly limited to ",[164,303,304],{},"GET \u002Fhealth"," and ",[164,307,308],{},"HEAD \u002Fhealth",".",[295,311,313],{"id":312},"_2-administrative-postgresql-pool","2. Administrative PostgreSQL Pool",[145,315,316,317,320],{},"A dedicated connection pool configured by ",[164,318,319],{},"database.url"," serves internal gateway operations:",[322,323,324,328,335,338],"ul",{},[325,326,327],"li",{},"Verifying database identities and validating schemas.",[325,329,330,331,334],{},"Managing persistent execution state in the ",[164,332,333],{},"http_postgres_gateway"," schema.",[325,336,337],{},"Performing administrative actions (creating\u002Frenaming databases, listing tables).",[325,339,340],{},"Provisioning restricted PostgreSQL roles for scoped API keys.",[342,343,344],"warning",{},"The admin pool is completely segregated from client query pools. Client queries never execute on the administrative connection.",[295,346,348],{"id":347},"_3-per-key-query-pools","3. Per-Key Query Pools",[145,350,351],{},"Client SQL runs through isolated pools segregated by database name and API key identity.",[322,353,354,365,375],{},[325,355,356,360,361,364],{},[357,358,359],"strong",{},"Verification:"," Before checkout, each session is verified against PostgreSQL's ",[164,362,363],{},"pg_stat_activity"," to guarantee it is idle and healthy.",[325,366,367,370,371,374],{},[357,368,369],{},"Session Reset:"," After every request, the gateway issues ",[164,372,373],{},"DISCARD ALL"," and rolls back uncommitted transactions before returning the connection to the pool.",[325,376,377,380,381,384],{},[357,378,379],{},"Global Budgeting:"," A process-wide connection cap (",[164,382,383],{},"database.pool.maxGlobalQueries",") bounds total query connections across all pools.",[295,386,388,389,392],{"id":387},"_4-api-key-metadata-store-datadatajson","4. API-Key Metadata Store (",[164,390,391],{},"data\u002Fdata.json",")",[145,394,395,396,399],{},"Stores the administrator password hash, API key records, database identity bindings, and HMAC seed material used to derive credentials for scoped PostgreSQL roles. Writers are serialized using a SQLite lock file (",[164,397,398],{},"data\u002Fdata.json.lock",").",[295,401,403],{"id":402},"_5-rate-limit-store","5. Rate-Limit Store",[322,405,406,416],{},[325,407,408,411,412,415],{},[357,409,410],{},"Redis Mode (Production):"," Distributed atomic counters shared across multiple gateway replicas using Redis ",[164,413,414],{},"EVAL"," scripts.",[325,417,418,421],{},[357,419,420],{},"In-Memory Mode (Local Dev):"," Process-local rate-limiting windows when Redis is disabled.",[295,423,425],{"id":424},"_6-sqlite-analytics-worker","6. SQLite Analytics Worker",[145,427,428],{},"Query counts and failed-query diagnostics are buffered in memory and flushed asynchronously to SQLite via a dedicated worker thread. Analytics writes never block SQL execution.",[149,430],{},[152,432,434],{"id":433},"request-lifecycle","Request Lifecycle",[145,436,437],{},"The lifecycle of an authenticated client query through the three core phases:",[157,439,441],{"className":159,"code":440,"language":161,"meta":162,"style":162},"flowchart LR\n  subgraph P1[\"1. Ingress & Auth\"]\n    direction TB\n    S1[\"POST \u002Fquery\"] --> S2[\"IP Rate Limiter\"]\n    S2 --> S3[\"API Key & DB Auth\"]\n    S3 --> S4[\"Key Rate Limiter\"]\n  end\n\n  subgraph P2[\"2. Pool & Execution\"]\n    direction TB\n    S5[\"Role Resolution\"] --> S6[\"Pool Checkout\"]\n    S6 --> S7[\"Timeout Limits (30s)\"]\n    S7 --> S8[\"PostgreSQL Execution\"]\n  end\n\n  subgraph P3[\"3. Result & Return\"]\n    direction TB\n    S9[\"Serialization\"] --> S10[\"Async Analytics\"]\n    S10 --> S11[\"DISCARD ALL Cleanup\"]\n    S11 --> S12[\"Client Response\"]\n  end\n\n  P1 ==> P2\n  P2 ==> P3\n",[164,442,443,448,453,458,463,468,473,477,481,486,490,495,500,505,509,513,518,522,527,532,537,542,547,553],{"__ignoreMap":162},[167,444,445],{"class":169,"line":170},[167,446,447],{},"flowchart LR\n",[167,449,450],{"class":169,"line":176},[167,451,452],{},"  subgraph P1[\"1. Ingress & Auth\"]\n",[167,454,455],{"class":169,"line":182},[167,456,457],{},"    direction TB\n",[167,459,460],{"class":169,"line":188},[167,461,462],{},"    S1[\"POST \u002Fquery\"] --> S2[\"IP Rate Limiter\"]\n",[167,464,465],{"class":169,"line":194},[167,466,467],{},"    S2 --> S3[\"API Key & DB Auth\"]\n",[167,469,470],{"class":169,"line":200},[167,471,472],{},"    S3 --> S4[\"Key Rate Limiter\"]\n",[167,474,475],{"class":169,"line":206},[167,476,227],{},[167,478,479],{"class":169,"line":212},[167,480,234],{"emptyLinePlaceholder":233},[167,482,483],{"class":169,"line":218},[167,484,485],{},"  subgraph P2[\"2. Pool & Execution\"]\n",[167,487,488],{"class":169,"line":224},[167,489,457],{},[167,491,492],{"class":169,"line":230},[167,493,494],{},"    S5[\"Role Resolution\"] --> S6[\"Pool Checkout\"]\n",[167,496,497],{"class":169,"line":237},[167,498,499],{},"    S6 --> S7[\"Timeout Limits (30s)\"]\n",[167,501,502],{"class":169,"line":243},[167,503,504],{},"    S7 --> S8[\"PostgreSQL Execution\"]\n",[167,506,507],{"class":169,"line":248},[167,508,227],{},[167,510,511],{"class":169,"line":254},[167,512,234],{"emptyLinePlaceholder":233},[167,514,515],{"class":169,"line":260},[167,516,517],{},"  subgraph P3[\"3. Result & Return\"]\n",[167,519,520],{"class":169,"line":266},[167,521,457],{},[167,523,524],{"class":169,"line":272},[167,525,526],{},"    S9[\"Serialization\"] --> S10[\"Async Analytics\"]\n",[167,528,529],{"class":169,"line":278},[167,530,531],{},"    S10 --> S11[\"DISCARD ALL Cleanup\"]\n",[167,533,534],{"class":169,"line":284},[167,535,536],{},"    S11 --> S12[\"Client Response\"]\n",[167,538,540],{"class":169,"line":539},21,[167,541,227],{},[167,543,545],{"class":169,"line":544},22,[167,546,234],{"emptyLinePlaceholder":233},[167,548,550],{"class":169,"line":549},23,[167,551,552],{},"  P1 ==> P2\n",[167,554,556],{"class":169,"line":555},24,[167,557,558],{},"  P2 ==> P3\n",[149,560],{},[152,562,564],{"id":563},"execution-modes-durability-matrix","Execution Modes & Durability Matrix",[566,567,568,588],"table",{},[569,570,571],"thead",{},[572,573,574,579,582,585],"tr",{},[575,576,578],"th",{"align":577},"left","Work Type",[575,580,581],{"align":577},"Input \u002F Queue Location",[575,583,584],{"align":577},"Outcome Storage",[575,586,587],{"align":577},"Restart Behavior",[589,590,591,608,626,643],"tbody",{},[572,592,593,599,602,605],{},[594,595,596],"td",{"align":577},[357,597,598],{},"Immediate Query",[594,600,601],{"align":577},"Request memory",[594,603,604],{"align":577},"HTTP response body",[594,606,607],{"align":577},"No replay; outcome unknown if interrupted",[572,609,610,615,618,623],{},[594,611,612],{"align":577},[357,613,614],{},"Async Query",[594,616,617],{"align":577},"Process scheduler",[594,619,620],{"align":577},[164,621,622],{},"http_postgres_gateway.async_queries",[594,624,625],{"align":577},"Record survives; interrupted work not replayed",[572,627,628,633,635,640],{},[594,629,630],{"align":577},[357,631,632],{},"Atomic Batch",[594,634,617],{"align":577},[594,636,637],{"align":577},[164,638,639],{},"http_postgres_gateway.transactions",[594,641,642],{"align":577},"Record survives; idempotent retry supported",[572,644,645,650,653,656],{},[594,646,647],{"align":577},[357,648,649],{},"Queued Transaction",[594,651,652],{"align":577},"Process heap memory",[594,654,655],{"align":577},"Process heap until committed",[594,657,658],{"align":577},"Lost on restart; must be recreated",[149,660],{},[152,662,664],{"id":663},"transaction-lifecycle-commit-staging","Transaction Lifecycle & Commit Staging",[145,666,667,668,671],{},"For atomic batches (",[164,669,670],{},"POST \u002Ftransaction\u002Fexecute","):",[673,674,675,685,697,703,712,722],"ol",{},[325,676,677,680,681,684],{},[357,678,679],{},"Idempotency Check:"," If an ",[164,682,683],{},"Idempotency-Key"," header is present, the gateway verifies the normalized fingerprint against previous submissions.",[325,686,687,690,691,693,694,309],{},[357,688,689],{},"Persistence:"," The batch is recorded in PostgreSQL in the ",[164,692,639],{}," table with status ",[164,695,696],{},"pending",[325,698,699,702],{},[357,700,701],{},"Execution:"," Statements are executed in order inside a transaction block.",[325,704,705,708,709,309],{},[357,706,707],{},"Result Staging:"," Results are staged before issuing ",[164,710,711],{},"COMMIT",[325,713,714,717,718,721],{},[357,715,716],{},"Commit Confirmation:"," The gateway commits the transaction and immediately updates status to ",[164,719,720],{},"committed",". Results are exposed only after commit confirmation is written.",[325,723,724,727,728,730,731,734],{},[357,725,726],{},"Failure & Unknown States:"," If connection to PostgreSQL is lost during ",[164,729,711],{},", the transaction status becomes ",[164,732,733],{},"unknown",". The client must inspect application state before retrying.",[149,736],{},[152,738,740],{"id":739},"scaling-boundaries-multi-process-clusters","Scaling Boundaries & Multi-Process Clusters",[145,742,743],{},"When scaling to multiple gateway instances behind a load balancer:",[322,745,746,755,764,770],{},[325,747,748,751,752,754],{},[357,749,750],{},"Durable Records:"," Async query and atomic batch records in ",[164,753,333],{}," can be read or polled by any replica connected to the same administrative database.",[325,756,757,760,761,763],{},[357,758,759],{},"Shared Metadata:"," Replicas must share ",[164,762,391],{}," over a filesystem that provides reliable POSIX SQLite locking and atomic file renaming.",[325,765,766,769],{},[357,767,768],{},"Distributed Rate Limiting:"," Redis is required for unified rate limits across replicas.",[325,771,772,775],{},[357,773,774],{},"Queued Transactions:"," Interactive queued transactions are held in process memory. Workflows using queued transactions require sticky sessions (session affinity).",[777,778,779],"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":781},[782,783,792,793,794,795],{"id":154,"depth":176,"text":155},{"id":292,"depth":176,"text":293,"children":784},[785,786,787,788,790,791],{"id":297,"depth":182,"text":298},{"id":312,"depth":182,"text":313},{"id":347,"depth":182,"text":348},{"id":387,"depth":182,"text":789},"4. API-Key Metadata Store (data\u002Fdata.json)",{"id":402,"depth":182,"text":403},{"id":424,"depth":182,"text":425},{"id":433,"depth":176,"text":434},{"id":563,"depth":176,"text":564},{"id":663,"depth":176,"text":664},{"id":739,"depth":176,"text":740},"In-depth technical architecture, state boundaries, dual-pool model, and scaling boundaries.","md",null,{},{"icon":24},{"title":802,"description":803},"Architecture · HTTP PostgreSQL Gateway","Component architecture, request lifecycles, connection pool verification, state ownership, and scaling boundaries.","lQI4pUzqAMDU7ZNdYglTN9c0yW5khpDxcpZ2RAch_zc",[806,808],{"title":16,"path":17,"stem":18,"description":807,"icon":19,"children":-1},"Get up and running with HTTP PostgreSQL Gateway in under 5 minutes.",{"title":33,"path":34,"stem":35,"description":809,"icon":36,"children":-1},"How HTTP PostgreSQL Gateway bridges the gap between serverless functions and relational databases.",1795399273837]