Skip to main content

Grats

Implementation-First GraphQL for TypeScript

What if building a GraphQL server were as simple as just writing functions?

No Duplication

Your TypeScript resolvers are already annotated with type information. Grats uses those existing types to determine your GraphQL schema.

No Conflicts

When your implementation is your schema, there's no need for clever TypeScript tricks to validate that your code and schema match.

No Library Code

Grats extracts your schema at build time from docblock hints. No Grats code is needed at runtime.

/**
* A user in our kick-ass system!
* @gqlType */
class User {
/** @gqlField */
name: string;

/** @gqlField */
greet(args: { greeting: string }): string {
return `${args.greeting}, ${this.name}`;
}
}
Playground

Schema

"""A user in our kick-ass system!"""
type User {
greet(greeting: String!): String
name: String
}