Securing the GraphQL endpoint (Docker)

To make sure that your GraphQL endpoint and the Hasura console are not publicly accessible, you need to configure an admin secret key.

Run the Docker command with an admin-secret env var

 #! /bin/bash
 docker run -d -p 8080:8080 \
  -e HASURA_GRAPHQL_DATABASE_URL=postgres://username:[email protected]:port/dbname \
  -e HASURA_GRAPHQL_ADMIN_SECRET=myadminsecretkey \


The HASURA_GRAPHQL_ADMIN_SECRET should never be passed from the client to the Hasura GraphQL engine as it would give the client full admin rights to your Hasura instance. See Authentication & Authorization for information on setting up authentication.