Skip to content

w7s-io/example-postgres-binding

Repository files navigation

W7S Postgres Binding Example

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.

Files

  • backend/src/index.ts: backend source that queries select now().
  • dist/server/wrangler.json: runtime metadata that enables Node.js compatibility for the Postgres driver.
  • w7s.example.json: manifest shape for the DB binding.
  • .github/workflows/deploy.yml: manual deploy workflow that writes w7s.json from a binding ID input.

Deploy

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.

About

W7S managed Postgres binding example

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors