Repo of the Day
Oualitsen/graphlink: Type-safe code generator for GraphQL schemas — produces clients and server interfaces for Dart, Flutter, Java, and Spring Boot. Features built-in caching with TTL/tag-based invalidation, JSON serialization, and auto-generated fragmen…
Published: Oct 10, 2026
Open repository ↗Type-safe code generator for GraphQL schemas — produces clients and server interfaces for Dart, Flutter, Java, and Spring Boot. Features built-in caching with TTL/tag-based invalidation, ...
Summary
GraphLink is a CLI tool (glink) that reads a single .graphql schema file and generates type-safe client and server code for Dart, Flutter, Java, Spring Boot, TypeScript, Kotlin, and Express/Apollo. The generated files have no runtime dependency on GraphLink itself, so generated artifacts compile and run independently of the generator. It also bakes cache TTLs, tag-based invalidation, and error capture into the schema via custom directives.
What it is useful for
Teams that maintain one GraphQL backend and ship clients across multiple stacks — for example a Flutter mobile app and a Java/Spring Boot backend, or a TypeScript web client and a Java service. GraphLink is documented to produce:
- Fully resolved return types for Java (no generics like
TypeReference<GraphQLResponse<Map<String, Object>>>at the call site), which it claims other Java GraphQL clients require. - Schema-driven caching via
@glCache(ttl: "...", tags: [...])and@glCacheInvalidate(tags: [...])directives. Cache entries are keyed by operation name plus variables, and tag invalidation propagates from mutations. Persistent storage is not built in — you implementGraphLinkCacheStoreyourself. - Minimal query strings per request, avoiding the full-schema dumps that can break Spring Boot's strict GraphQL validation.
- Inline error handling via
@glCaptureErrors(orcaptureErrors: trueglobally), returning aFullResponsewithdataanderrorsside by side. - Server scaffolding: in
mode: "server", it generates Spring@Controllerclasses wired into Spring GraphQL, plus anVehicleServiceinterface you implement, and similarly for Express/Apollo with a generatedcreateServer()entry point.
How engineers can use it
Install the CLI by downloading the native binary for your platform from the releases page (macOS ARM/x64, Linux x64/ARM64, Windows x64 are listed) and placing it on your PATH, or add it as a dev dependency with flutter pub add --dev graphlink / dart pub add --dev graphlink.
Typical workflow:
- Author a
.graphqlschema. Add directives such as@glCache(ttl: "2m", tags: ["vehicles"])on queries and@glCacheInvalidate(tags: ["vehicles"])on mutations that should bust them. - Add a
glink.json(or.yaml/.yml) in the project root withschemaPaths,mode("client"or"server"),typeMappings, andoutputDir. - Run
glinkto generate,glink -c config.jsonfor an explicit config, orglink -wto watch and regenerate on save. Regeneration is documented as taking milliseconds even on large schemas.
Then call generated methods like client.queries.getVehicle("42") in Java, Dart, or TypeScript — all return fully typed objects. For server targets, implement the generated service interface; routing and controller wiring are produced for you. Full per-target guides and a directives reference live at graphlink.dev/docs (see the README for links).