The compiler
Grats on TypeScript 7's compiler API. Mark classes, types and functions with docblock tags, and gratos writes the schema, or checks it in CI.
Grats, for TypeScript 7 and Effect
Gratos builds a GraphQL schema from the TypeScript you already write: mark classes, types and functions with docblock tags, and the gratos CLI writes the schema. Resolvers may return an Effect, and gratos-server serves it with @defer, @stream and subscriptions.
import type { Int } from "gratos";
/** A person using the app. @gqlType */
export class User {
/** @gqlField */
readonly name: string;
/** @gqlField */
readonly age: Int;
constructor(name: string, age: Int) {
this.name = name;
this.age = age;
}
/** Greets them by name. @gqlField */
greeting(): string {
return `Hello, ${this.name}!`;
}
}
/** The signed-in user. @gqlQueryField */
export function viewer(): User {
return new User("Ada", 36);
}type Query {
"""The signed-in user."""
viewer: User
}
"""A person using the app."""
type User {
age: Int
"""Greets them by name."""
greeting: String
name: String
}Grats on TypeScript 7's compiler API. Mark classes, types and functions with docblock tags, and gratos writes the schema, or checks it in CI.
A resolver may return Effect.Effect<A, E, R>, a field of type A, or a Stream for a subscription. Your errors and services stay typed.
gratos-server: GraphQL over HTTP from a Web Request, with @defer, @stream, subscriptions over SSE, trusted documents and an Effect layer.
A Node interface, connections and refetchable records, written in Gratos. This site is the proof: a React Router app on Relay.
Every page you read came from a Gratos schema, through Relay: rendered on the server with its query run in process, hydrated with no request, with @defer for related pages and @stream for the changelog, and search runs over a subscription.