pg_server
pg_server · HTTP application server in a PostgreSQL background worker
Overview
PostgreSQL · 17
Usage
Sources:
pg_server embeds an HTTP runtime in a PostgreSQL background worker. The reviewed source is version 0.1.0, with pgrx 0.20.1 and a documented PostgreSQL 17 development workflow. It is an experimental application runtime, with no verified license grant.
Start the Worker
Install the matching library and create the database named pg_server before enabling preloading. The database name is fixed in the reviewed worker source. Preserve other preload entries and restart PostgreSQL:
The worker connects to that database and listens on loopback port 8080. Preloading starts the worker; the optional SQL greeting function is not its startup mechanism. Loading the library after server startup only emits a warning.
Install the Application
In the pg_server database, apply the upstream application script with a role authorized to install its objects:
The script enables pgcrypto and creates the site_code and site_data schemas, routing functions, templates and application data structures. The worker calls site_code.handle_request; missing application objects produce HTTP errors. Changes to stored routes and templates take effect without recompiling the library.
Operational Boundary
The HTTP thread passes work back to the PostgreSQL worker for SPI access. Keep application code and database privileges under administrator control. The documented endpoint is local HTTP; it does not establish a public TLS or production authentication deployment. Back up both application schemas and review the upstream restore script before reapplying it. A missing database or occupied port prevents startup; fix that condition and restart the configured instance.