What grx is
grx in plain language - a Go GraphQL server built from structs, with HTTP, realtime transports, hooks, and production controls.
grx is a GraphQL server and runtime for Go. You describe your API in code: exported structs and methods become GraphQL types, fields, and resolvers (schema.Config feeding grx.WithSchema). The library turns that bundle into an executable schema, runs query, mutation, and optional subscription operations, and returns spec-shaped JSON - all behind a normal net/http.Handler so Chi, Gin, Echo, Fiber, ServeMux, or bare ListenAndServe can host it equally.
Dependencies
Runtime dependencies are deliberately small (see go.mod in the repo). You integrate databases, caches, Auth0, OTLP exporters, etc. - grx wires the GraphQL mechanics and transports.
Who it is for
- Teams shipping production GraphQL backends in Go who want reflection-driven schema authoring instead of parallel SDL/codegen upkeep.
- Services that sometimes need realtime pushes (WebSocket, SSE, optional pub/sub) without swapping frameworks.
- Engineers who prefer readable extension points: plugins, authorizers, and custom transports - not a sprawling plugin ecosystem.
What you get (feature surface)
These are concrete capabilities surfaced by the codebase and documented here - not marketing bullets.
Schema and execution
| Capability | Meaning |
|---|---|
| Code-first schema | Structs + gql struct tags model object types, arguments, descriptions, deprecation - Define your schema. |
| Roots | Required Query, optional Mutation and Subscription via schema.Config. |
| Executor | Lex, parse, validate, and execute GraphQL documents with behavior documented in the relevant execution guides. |
| Structured errors | Field errors with path and locations; masking for clients via Security. |
Networking and ergonomics
| Capability | Meaning |
|---|---|
| GraphQL over HTTP | Default handler accepts JSON bodies on your configured path - Transports. |
| Optional GraphiQL | WithPlaygroundPath serves the bundled sandbox for dev - turn it off in production (Introspection). |
| Router-neutral | Everything is http.Handler - mount anywhere (Get started). |
| CORS wiring | Configure CORS in the host HTTP server or framework around the returned http.Handler. |
| Gzip responses | Optional WithResponseGzip for JSON payloads. |
Realtime graph
| Capability | Meaning |
|---|---|
Subscription resolvers | Go methods returning <-chan YourType; runtime streams payloads per event. |
| WebSocket + SSE transports | First-class subscriptions doc + optional Memory backend (Redis adapter for multi-node fan-out cases). |
Safety and operations
| Capability | Meaning |
|---|---|
| Toggle introspection | WithDisableIntrospection rejects __schema / __type. |
| Request bounds | Timeouts (WithRequestTimeout), MaxHTTPRequestBytes, variable caps, selection/alias/root limits - Limits. |
| APQ / trust lists | WithPersistedQueries, TrustedDocuments, RequirePersistedQuery (server.Config) patterns. |
| Auth hooks | Operation + field-level authorizers and HTTP middleware layering - Authentication & authorization. |
Observability & extension
| Capability | Meaning |
|---|---|
| Lifecycle plugins | Parse / validation / resolve hooks (plugins package, concepts). |
| Custom transports | Add protocols beside the default HTTP pipeline - guide. |
How it differs from hand-rolling GraphQL.js-style stacks
Conceptually identical moving parts (schema + resolvers + transport) - grx concentrates them in Go types and one handler tree rather than layering Node + SDL + codegen. Use it when idiomatic structs, low ceremony, and net/http integration outweigh a JavaScript-heavy toolchain.
Next steps
- Run your first server (
go.mod,graphpackage,grx.NewServer). - Define your schema in Go for tagging and composition patterns.
- Bookmark Security, Introspection, Limits (or Production hardening) before shipping beyond localhost.
Numbers versus other servers: Benchmarks. Package-level API browsing: Reference.
Last updated on