Example JavaScript/TypeScript native backend that reads a W7S-managed Postgres binding from env.DB.
This repo needs an existing W7S Postgres binding config ID before it can deploy. W7S currently binds existing managed Postgres configs; it does not create the origin database or rotate its credentials for the app.
backend/src/index.ts: backend source that queriesselect now().dist/server/wrangler.json: runtime metadata that enables Node.js compatibility for the Postgres driver.w7s.example.json: manifest shape for theDBbinding..github/workflows/deploy.yml: manual deploy workflow that writesw7s.jsonfrom a binding ID input.
Run the Deploy workflow manually and pass the Postgres binding config ID:
postgres-binding-id: <your-managed-postgres-binding-id>
The workflow builds backend/src/index.ts into dist/server/index.js, writes:
{
"bindings": {
"hyperdrive": [
{
"binding": "DB",
"id": "<your-managed-postgres-binding-id>"
}
]
}
}Then it deploys with w7s-io/w7s-cloud@v1.