Sign inSign up

omegabridge/gqlbridge-editor

By omegabridge

โ€ขUpdated 11 months ago

Image
2

130

omegabridge/gqlbridge-editor repository overview

โ GraphQL Dynamic Editor โ€” Docker Setup Guide

โ ๐Ÿ“˜ Overview

This Docker image runs a live GraphQL editor (Apollo Server + GraphiQL UI) that automatically reloads whenever the GraphQL schema file updates โ€” that supports schemas generated from gqlbridge (Flask-based backend).

A Python script (generate_schema.py) runs during container startup to generate the initial schema, and the Node.js server continuously watches for schema changes.
It can also proxy requests to a remote GraphQL endpoint (e.g., a Flask backend).


โ ๐Ÿ—๏ธ Directory Structure

graphql-dynamic-editor/ โ”‚ โ”œโ”€โ”€ Dockerfile โ”œโ”€โ”€ package.json โ”œโ”€โ”€ server.js # Apollo + GraphiQL server with live reload & remote proxy support โ”œโ”€โ”€ generate_schema.py # Python script to generate /app/schema.graphql โ”œโ”€โ”€ schema.graphql # GraphQL schema (auto-updated) โ”œโ”€โ”€ .env # Environment variables for DB & endpoint config โ”œโ”€โ”€ alias.yml # Defines aliases for columns, tables, and schemas


โ ๐ŸŒ Example .env File
POSTGRES_USER=admin
POSTGRES_PASSWORD=secret
POSTGRES_DB=mydb
POSTGRES_HOST=my-postgres
POSTGRES_PORT=5432

# Remote GraphQL endpoint (Flask backend)
GRAPHQL_ENDPOINT=http://host.docker.internal:5000/graphql-query

# Optional authentication token (if required)
GRAPHQL_TOKEN=<Token>
โ ๐ŸŒ Example alias.yml File
tables:
  public: # Schema name
    epics: # Table name under the above schema
      table_name: epic # Rename the table (optional)
      schema_name: test # Rename the schema of above mentioned table (optional)
      old_col: yaml # Rename a column: old_column_name: new_column_name
โ ๐Ÿš€ Run the Container
sudo docker run -d \
  --name graphql-editor \
  --env-file .env \
  -v alias.yml:/app/alias.yml \
  -p 4000:4000 \
  graphql-dynamic-editor

| ๐Ÿงฉ The --env-file .env flag passes environment variables into the container.

โ ๐Ÿง  How It Works
ComponentRole
Python (generate_schema.py)Runs on startup โ†’ connects to DB โ†’ generates /app/schema.graphql
/app/schema.graphqlThe live schema used by Apollo Server
Apollo Server (Node.js)Hosts GraphQL endpoint + GraphiQL UI
chokidar in server.jsWatches the schema file โ†’ logs when schema updates (manual restart needed)
.env fileProvides DB credentials and configuration
alias.ymlDefines aliases for tables, schemas, and columns to resolve GraphQL naming conflicts
GRAPHQL_ENDPOINTOptional remote GraphQL backend URL for proxying queries
GRAPHQL_TOKENOptional authentication token for secure remote requests
โ ๐Ÿงพ Example Log Flow
  • ๐Ÿ Running Python schema generator...
  • โœ… Schema written to /app/schema.graphql
  • ๐Ÿš€ GraphQL Editor running at http://localhost:4000/โ 
  • ๐Ÿ”„ Schema file updated โ€” reloading Apollo Server...
โ โœ… Summary
  • ๐Ÿ Automatically generates schema at container startup
  • ๐Ÿš€ Reflects live updates in the GraphiQL UI
  • ๐Ÿ”„ Supports remote GraphQL proxying (Flask backend)
  • ๐Ÿ” Optional authentication token support
  • ๐Ÿงฉ Clean Node + Python hybrid setup
  • โš™๏ธ Single-step run โ€” no manual reloads or cron jobs required
  • โš ๏ธ Exception: The editor does not currently support JSON column types.

Tag summary

Content type

Image

Digest

sha256:a378ed357โ€ฆ

Size

464.1 MB

Last updated

11 months ago

docker pull omegabridge/gqlbridge-editor:v1.0.2