PostgREST — turns any PostgreSQL database directly into a fast, RESTful API. It serves a full CRUD API driven by your schema, roles, and views, with JWT auth and row-level security — no backend code required. Deployed as a host-networked, stateless Nomad service (bring your own PostgreSQL).
Needs nomad-pack on PATH. The script only adds the nomploy registry and runs this pack.
Source ↗ Project ↗ ★ 27.7k ⚑ Report an issue
Save as values.hcl, edit, then run:
# The name of the Nomad job.
job_name = "postgrest"
# The Nomad namespace to deploy into.
namespace = "default"
# The datacenters to deploy to.
datacenters = ["*"]
# The PostgREST container image. Pin a tag in production.
image = "postgrest/postgrest:latest"
# Host port for the REST API (PGRST_SERVER_PORT).
port = 3027
# PostgreSQL connection URI (PGRST_DB_URI). Point at your database with an authenticator role, e.g. postgres://authenticator:PASS@127.0.0.1:5432/app.
db_uri = "postgres://authenticator:change-me@127.0.0.1:5432/postgres"
# Database schema(s) to expose (PGRST_DB_SCHEMAS).
db_schema = "public"
# Role used for unauthenticated requests (PGRST_DB_ANON_ROLE).
db_anon_role = "web_anon"
# Secret used to verify JWTs for authenticated requests (PGRST_JWT_SECRET). Leave empty to allow only anonymous access.
jwt_secret = ""
# How many instances to run. PostgREST is stateless, so you can run several behind a load balancer.
count = 1
# Placement constraints. On a nomploy cluster: attribute = "$${meta.nomploy_control_plane}", operator = "=", value = "true".
constraints = []
# Resources for the PostgREST task.
resources = {
cpu = 300
memory = 256
}
| Name | Type | Default | Description |
|---|---|---|---|
| job_name | string | "postgrest" | The name of the Nomad job. |
| namespace | string | "default" | The Nomad namespace to deploy into. |
| datacenters | list | ["*"] | The datacenters to deploy to. |
| image | string | "postgrest/postgrest:latest" | The PostgREST container image. Pin a tag in production. |
| port | number | 3027 | Host port for the REST API (PGRST_SERVER_PORT). |
| db_uri set me | string | "postgres://authenticator:change-me@127.0.0.1:5432/postgres" | PostgreSQL connection URI (PGRST_DB_URI). Point at your database with an authenticator role, e.g. postgres://authenticator:PASS@127.0.0.1:5432/app. |
| db_schema | string | "public" | Database schema(s) to expose (PGRST_DB_SCHEMAS). |
| db_anon_role | string | "web_anon" | Role used for unauthenticated requests (PGRST_DB_ANON_ROLE). |
| jwt_secret key | string | "" | Secret used to verify JWTs for authenticated requests (PGRST_JWT_SECRET). Leave empty to allow only anonymous access. |
| count | number | 1 | How many instances to run. PostgREST is stateless, so you can run several behind a load balancer. |
| constraints | list | [] | Placement constraints. On a nomploy cluster: attribute = "$${meta.nomploy_control_plane}", operator = "=", value = "true". |
| resources | object | {
cpu = 300
memory = 256
} | Resources for the PostgREST task. |
No variables match.
PostgREST — serves a full RESTful API straight from a PostgreSQL database. Your schema, views, functions, and roles are the API; it handles CRUD, filtering, pagination, JWT auth, and delegates authorization to PostgreSQL row-level security — no backend code to write.
Single host-networked Nomad service. Stateless (bring your own PostgreSQL) — raise count to scale.
nomad-pack registry add nomploy https://github.com/Nomploy/nomad-packs
nomad-pack run postgrest --registry=nomploy
| Variable | Default | Description |
|---|---|---|
port |
3027 |
REST API port (PGRST_SERVER_PORT). |
db_uri |
postgres://authenticator:change-me@127.0.0.1:5432/postgres |
Connection URI (PGRST_DB_URI). Point at your database. |
db_schema |
public |
Schema(s) to expose (PGRST_DB_SCHEMAS). |
db_anon_role |
web_anon |
Role for unauthenticated requests (PGRST_DB_ANON_ROLE). |
jwt_secret |
"" |
JWT verification secret (PGRST_JWT_SECRET); empty = anonymous only. |
count |
1 |
Instances to run (stateless — safe to scale). |
image |
postgrest/postgrest:latest |
Container image. Pin a tag in production. |
resources |
{ cpu = 300, memory = 256 } |
Task resources. |
Pairs with the postgres pack (co-located on the node, reachable at 127.0.0.1:5432). Create an
authenticator login role plus an anonymous role, then hit http://<node-ip>:3027/<table>. Set a JWT
secret for authenticated, role-based access. See the PostgREST docs for the schema/role setup.