Sign inSign up

oualitsen/graphlink

By oualitsen

Updated 7 days ago

Image
0

503

oualitsen/graphlink repository overview

Define your GraphQL schema once. Get a fully typed client and server scaffold — for Dart, Flutter, Java, TypeScript, Kotlin, and Spring Boot — in milliseconds.

GraphLink (glink) reads .graphql schema files and generates production-ready, idiomatic code for your target language. Generated files have zero runtime dependency on GraphLink — delete the tool tomorrow, everything still compiles.

This image ships glink as a single static binary on a scratch base: no OS, no shell, no dependencies. Multi-arch: linux/amd64 and linux/arm64.

  • No generics at the Java call siteGetVehicleResponse res = client.queries.getVehicle("42");, fully resolved, no TypeReference or Map<String,Object> casting.
  • Cache control lives in the schema@glCache / @glCacheInvalidate directives drive TTL, tag-based invalidation, partial-query caching, and offline fallback in the generated client.
  • Minimal query strings — no full-schema dumps that trip Spring Boot's strict GraphQL validation.
  • Inline error handling@glCaptureErrors returns a FullResponse with data + errors side by side, no try/catch.
  • Single source of truth — one schema drives the Dart, Java, TypeScript, and Kotlin clients plus the Spring Boot / Express-Apollo server (controllers/resolvers + service interfaces). Add a field once, regenerate, every end stays in sync.

Quick start

glink auto-discovers glink.json / glink.yaml / glink.yml in the working directory:

docker run --rm -v "$(pwd)":/workspace -w /workspace oualitsen/graphlink

CLI flags

FlagDescription
-c, --config <path>Explicit path to config file (.json, .yaml, .yml)
-w, --watchWatch schema files and regenerate on every save
-v, --versionPrint the glink version
-h, --helpShow usage
docker run --rm -v "$(pwd)":/workspace -w /workspace oualitsen/graphlink -c config.json
docker run --rm -v "$(pwd)":/workspace -w /workspace oualitsen/graphlink -w

Example: schema → config → generate

# schema/vehicle.graphql
type Vehicle {
  id: ID!
  brand: String!
  model: String!
  fuelType: FuelType!
}

enum FuelType { GASOLINE DIESEL ELECTRIC HYBRID }

type Query {
  getVehicle(id: ID!): Vehicle! @glCache(ttl: "2m", tags: ["vehicles"])
}
// glink.json
{
  "schemaPaths": ["schema/*.graphql"],
  "mode": "client",
  "typeMappings": { "ID": "String", "Float": "double", "Int": "int", "Boolean": "bool" },
  "outputDir": "lib/generated",
  "clientConfig": { "dart": { "packageName": "my_app" } }
}
docker run --rm -v "$(pwd)":/workspace -w /workspace oualitsen/graphlink

Generated code appears under outputDir on the host — the container just writes into the bind-mounted working directory.

Set "mode": "server" (with serverConfig) to instead emit a Spring Boot or Express/Apollo server: controllers/resolvers, service interfaces, types, inputs, and enums — implement the interface, the routing is already wired.

Supported targets

TargetStatus
Dart clientStable
Flutter client (UI widget generation)Stable
Java clientStable
Kotlin clientStable
TypeScript clientStable
Spring Boot serverStable
Express / Apollo (Node.js) serverStable

Tags

  • latest — most recent release
  • <version> (e.g. 1.4.0) — pinned release, matches GitHub tag v1.4.0

Tag summary

Content type

Image

Digest

sha256:3ee03b987

Size

3.9 MB

Last updated

7 days ago

docker pull oualitsen/graphlink