| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A lightweight GraphQL toolkit for full-stack TypeScript projects.
If your server and client live in the same codebase — a Next.js app, a monorepo, a full-stack TypeScript project — Typograph lets you define your schema once in plain TypeScript and share it across both sides. Fully typed end-to-end, no codegen, no build step, no .graphql files to keep in sync.
It's not trying to replace Apollo, Pothos, or any other GraphQL stack. It's the minimal option for when you own both ends and just want types to flow through.
https://www.youtube.com/watch?v=oCRgS9mvTAo
Define your schema once and share it:
// schema.ts — imported by both server and client
import {
createTypeDefBuilder,
t,
type Resolvers,
} from "@overstacked/typograph";
const builder = createTypeDefBuilder();
const post = builder.type({
id: t.id().notNull(),
title: t.string().notNull(),
});
type Post = typeof post;
export const typeDefs = builder.combineTypeDefs([
builder.typeDef({
Post: post,
Query: {
getPost: builder.query({
input: { id: t.id().notNull() },
output: t.type<Post>("Post"),
}),
},
Mutation: {},
}),
]);
export const resolvers: Resolvers<typeof typeDefs> = {
Query: {
getPost: ({ id }) => ({ id, title: "Hello World" }),
},
};Wire up the server (Next.js route handler shown — works with Yoga, Apollo, or any executor):
// app/api/graphql/route.ts
import { createYoga, createSchema } from "graphql-yoga";
import { typeDefs, resolvers } from "@/schema";
const { handleRequest } = createYoga({
schema: createSchema({ typeDefs: typeDefs.toSDL(), resolvers }),
graphqlEndpoint: "/api/graphql",
fetchAPI: { Response },
});
export { handleRequest as GET, handleRequest as POST };Query it from the client with full inference — no codegen:
// app/post/page.tsx
"use client";
import { createUrqlIntegration } from "@overstacked/typograph/integrations/urql";
import { typeDefs } from "@/schema";
const { useQuery } = createUrqlIntegration(typeDefs);
export default function Post() {
const [result] = useQuery(
{
getPost: { id: true, title: true },
// ^? boolean — only real fields are selectable
},
{ variables: { id: "1" } },
);
const data = result.data;
// ^? { getPost: { id: string; title: string } } | undefined
return <h1>{data?.getPost.title}</h1>;
}npm install @overstacked/typograph graphqlIntegrations available for urql, Apollo, React Query, or any GraphQL client.
Full docs at typographdocs.netlify.app. Run locally with npm --prefix docs run dev.
MIT
| Back | FazBrowse Home | New Git URL |