Coder Social home page Coder Social logo

hasura-schema-exporter's Introduction

hasura-schema-exporter

Export the schema of Hasura GraphQL Engine to static schema.graphql file in sync.

Motivation

There's some benefits to export the Hasura's schema and add to git commit:

  • Can notice the schema changes when update graphql-engine version
  • Run GraphQL Code Generator without starting up graphql-engine server (particularly in CI environment)
  • Fast, Role & Permission sentitive autocompletion and validation with vscode-graphql and graphql-config

We can export the Hasura's schema in several ways according to Exporting the Hasura GraphQL Schema guide, but we have to export the schema manually every time the schema change.

This tool watch the Hasura's metadata and migrations, and automatically export the schema when changed.

How to use

After following the Quickstart with Docker guide, add hasura-schema-exporter to services like below.

version: '3.6'
services:
  postgres: ...
  graphql-engine: ...
  schema-exporter:
    image: ghcr.io/wasd-inc/hasura-schema-exporter
    depends_on:
     - "graphql-engine"
    volumes:
      # metadata and migrations, schema is exported when these files are change
      - ./hasura/metadata:/hasura-metadata
      - ./hasura/migrations:/hasura-migrations
      # schema export direction
      - ./hasura/schema:/hasura-schema
    environment:
      # graphql-engine's endpoint depending on service name and port
      HASURA_GRAPHQL_ENDPOINT : http://graphql-engine:8080
      # same as graphql-engine's admin-secret
      HASURA_GRAPHQL_ADMIN_SECRET: myadminsecretkey
      # comma-separated roles to export schema (default: admin)
      HASURA_SCHEMA_EXPORTER_ROLES: admin, user, anonymous
volumes:
  db_data:

hasura-schema-exporter's People

Contributors

shinnoki avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.