Skip to content

Effect GQL

Build type-safe, composable GraphQL APIs with the power of Effect-TS

Type-Safe End-to-End

Define your schema once with Effect Schema. Get automatic TypeScript types, GraphQL types, and runtime validation.

Effect-Powered Resolvers

Resolvers are Effect programs with built-in error handling, service injection, and composability.

Service Integration

Use Effect’s Layer system for dependency injection. No magic, just types.

Functional & Immutable

Immutable builder pattern with pipe-able API. Compose your schema from reusable parts.

import { Effect } from "effect"
import * as S from "effect/Schema"
import { GraphQLSchemaBuilder } from "@effect-gql/core"
// Define your schema with Effect Schema
const UserSchema = S.Struct({
id: S.String,
name: S.String,
email: S.String,
})
// Build your GraphQL schema
const schema = GraphQLSchemaBuilder.empty
.objectType({ name: "User", schema: UserSchema })
.query("user", {
type: UserSchema,
args: S.Struct({ id: S.String }),
resolve: (args) => Effect.succeed({
id: args.id,
name: "Alice",
email: "alice@example.com",
}),
})
.buildSchema()

Schema Builder

Fluent, immutable API for building GraphQL schemas with full type inference.

Automatic Validation

Arguments validated automatically using Effect Schema before resolvers run.

Subscriptions

First-class subscription support using Effect Streams.

DataLoader Integration

Built-in batching and caching with Effect-based DataLoaders.

Structured Errors

Type-safe error handling that integrates with GraphQL’s error system.

Request Context

Request-scoped context using Effect’s Layer system.