grx v0.8.3 is out

GraphQL, resolved
in plain Go.

Your structs are the schema and your methods are the resolvers. grx serves them as a fast GraphQL API with subscriptions, persisted queries and guard rails, from an ordinary http.Handler.

POST/graphql · DetailScreen($pid: "post_1")

Response

Resolving

0/6 fields

Structs are the schema

Your Go types already describe your API.

grx reads your structs and methods once at startup and builds the schema clients see. Hover a line to follow the edge from Go to GraphQL.

gograph/user.go
type User struct {
ID string `gql:"id,nonNull"`
Name string `gql:"name,nonNull"`
Bio *string `gql:"bio"`
}
type UserArgs struct {
ID string `gql:"id,nonNull"`
}
type Query struct{}
func (Query) User(ctx context.Context, args UserArgs) (*User, error)
type Subscription struct{}
func (Subscription) UserUpdated(ctx context.Context) (<-chan *User, error)
gqlschema (generated at startup)
type User {
id: String!
name: String!
bio: String
}
type Query {
user(id: String!): User
}
type Subscription {
userUpdated: User
}

Exported methods on Query become fields: User → user.

Fits your stack

grx owns GraphQL. You own everything else.

Routing, TLS, CORS, auth extraction and your database stay where they already live. grx sits in the middle of the request and nowhere else.

  1. Your router

    net/http, Chi, Gin, Echo, Fiber

  2. Transport

    HTTP, WebSocket, SSE

  3. Parse

    persisted queries

  4. Validate

    depth & size limits

  5. Execute

    authorizers, plugins

  6. Your resolvers

    plain Go methods

Benchmarks

Same queries. A fraction of the work.

parse → validate → execute → JSON on identical fixtures for grx, graph-gophers and graphql-go. grx does it with far fewer allocations, so there is less GC pressure under real traffic.

grx graph-gophers graphql-goµs per op · lower is better

Nested query

post(id) → author

120.218.569.49

12.7×

Feed timeline

feed → posts → author

23610252.5

4.5×

Persisted compound

fragments, aliases, variables

275.8101.366.8

4.1×

Five minutes

From empty folder to a live API.

  • One module: go get it. Go 1.25 or newer.
  • GraphiQL built in: on any path you choose.
  • Plain JSON over HTTP: so any GraphQL client works, or curl.
Follow the walkthrough
~/api — zsh

❯

Your turn

Resolve your first query today.

Open source, MIT licensed, and built to live inside the Go service you already run.