Grats, for TypeScript 7 and Effect

Your docblocks are the schema.

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.

TypeScriptUser.ts
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);
}
Generated SDLgenerated/schema.graphql
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
}

Four parts, one schema

This site is a Gratos server

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.

Reference

Latest release: 0.2.0 · Source on GitHub