Serverless GraphQL endpoint for PostgresSQL using AWS, serverless and PostGraphQL
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

Serverless graphql endpoint for PostgresSQL database using AWS, serverless and postgraphql

Official lambda implementation from the postgraphql-creators:

How to use my implementation:


💾 Install Serverless

👯 Clone the repo

git clone
cd serverless-postgraphql

💾 Install

npm install

🚀 Rebuild and Deploy

npm run rebuild-and-deploy

☕ Coffeetime: AWS takes ~10min to setup the Postgres DB

  • From the result of the serverless deployment take the pgEndpoint and insert it in:
    • package.json-file in the config of PGCON (line 7)
    • serverless.yml-file in the environment-variable named PGCON (line 21)

🚀 Rebuild and Deploy Again

npm run rebuild-and-deploy

You are all set now. You can now query the resulting endpoint as you wish via POST and GET.

One example to authenticate a user would be:

mutation {
  authenticate(input: {email: "", password: "iFbWWlc"}) {

You can try this by entering the following in your browser:


For most other queries you need to be authorised. Authorization in postgraphql is done via the jwtToken. Set this in your following requests as Authorization header:

Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhIjoxLCJiIjoyLCJjIjozfQ.hxhGCCCmGV9nT1slief1WgEsOsfdnlVizNrODxfh1M8

Running Locally

💾 Install Postgres 🐘

⌨️ Initialize the database

npm run init-local-db

⌨️ Run the local server

npm run local-server