Gqlkit
Just types and functions — write TypeScript, generate GraphQL.
Install / Use
/learn @izumin5210/GqlkitREADME
gqlkit
Just types and functions — write TypeScript, generate GraphQL.
</div>How it works
- Write TypeScript types in
src/gqlkit/schema/→ become GraphQL types - Write resolver functions using
defineQuery,defineMutation,defineField→ become GraphQL resolvers - Run
gqlkit gen→ outputstypeDefsandresolverstosrc/gqlkit/__generated__/
Highlights
- Implement first - Write types and resolvers, generate schema when ready. No edit-regenerate-implement loops.
- Just types and functions - Plain TypeScript with a thin API. No complex generics, no decorators.
- Type-safe - TypeScript types become GraphQL types. Resolver signatures checked at compile time.
Getting started
1. Install dependencies
# Runtime dependencies
npm install @gqlkit-ts/runtime graphql @graphql-tools/schema
# Development dependency
npm install -D @gqlkit-ts/cli
2. Create types and resolvers
// src/gqlkit/gqlkit.ts
import { createGqlkitApis } from "@gqlkit-ts/runtime";
import { Context } from "./context.js";
export const { defineField, defineQuery, defineMutation } = createGqlkitApis<Context>();
// src/gqlkit/schema/task.ts
import type { IDString, NoArgs } from "@gqlkit-ts/runtime";
import { defineQuery, defineMutation } from "../gqlkit.js";
export type Task = {
id: IDString;
title: string;
completed: boolean;
};
const tasksData: Task[] = [];
// Query
export const tasks = defineQuery<NoArgs, Task[]>(() => tasksData);
// Mutation
export const createTask = defineMutation<{ input: { title: string } }, Task>(
(_root, { input }) => {
const task: Task = {
id: crypto.randomUUID(),
title: input.title,
completed: false,
};
tasksData.push(task);
return task;
}
);
3. Generate schema and resolvers
gqlkit gen
This generates:
src/gqlkit/__generated__/typeDefs.ts- GraphQL schema ASTsrc/gqlkit/__generated__/resolvers.ts- Resolver mapsrc/gqlkit/__generated__/schema.graphql- SDL file
4. Create the executable schema
// src/schema.ts
import { makeExecutableSchema } from "@graphql-tools/schema";
import { typeDefs } from "./gqlkit/__generated__/typeDefs.js";
import { resolvers } from "./gqlkit/__generated__/resolvers.js";
export const schema = makeExecutableSchema({ typeDefs, resolvers });
5. Start a GraphQL server (e.g., Yoga)
npm install graphql-yoga
// src/server.ts
import { createServer } from "node:http";
import { createYoga } from "graphql-yoga";
import { schema } from "./schema.js";
const yoga = createYoga({ schema });
const server = createServer(yoga);
server.listen(4000, () => {
console.log("Server running at http://localhost:4000/graphql");
});
Run the server and open http://localhost:4000/graphql to access GraphiQL:
mutation {
createTask(input: { title: "Learn gqlkit" }) {
id
title
completed
}
}
query {
tasks {
id
title
completed
}
}
Documentation
For detailed usage, features, and API reference, visit the documentation site:
Related Skills
node-connect
352.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
111.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
Writing Hookify Rules
111.1kThis skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.
review-duplication
100.6kUse this skill during code reviews to proactively investigate the codebase for duplicated functionality, reinvented wheels, or failure to reuse existing project best practices and shared utilities.
