A Go framework for end-to-end type-safe APIs

Write Go.
TypeScript keeps up.

Define typed handler functions in Go. ShiftAPI generates an OpenAPI 3.1 spec at runtime and a fully-typed TypeScript client via Vite/Next.js HMR — no codegen CLI, no manual spec, no drift.

$npm create shiftapi@latest
Get Started
Go
Structs
compile time
OAS
OpenAPI 3.1
runtime
TS
Types
build time
</>
Typed Client
your frontend

Write Go. Get TypeScript. Done.

Your Go struct becomes the TypeScript type. Change a field in Go, your frontend knows instantly.

main.go
type Input struct {
    Name string `json:"name"`
}

type Output struct {
    Hello string `json:"hello"`
}

func greet(r *http.Request, in Input) (*Output, error) {
    return &Output{Hello: in.Name}, nil
}

func main() {
    api := shiftapi.New()
    shiftapi.Handle(api, "POST /greet", greet)
    shiftapi.ListenAndServe(":8080", api)
}
auto-generated
app.ts
import { client } from "@shiftapi/client";

// Fully typed — inferred from your Go structs
const { data } = await client.POST("/greet", {
    body: { name: "frank" },
});

console.log(data.hello);
//              ^? (property) hello: string

How it works

Three layers, one source of truth. No manual steps between them.

1

Define typed handlers

Write standard Go functions with struct input/output types. Use json, query, path, and header struct tags — ShiftAPI routes them automatically.

shiftapi.Handle(api, "POST /greet", greet)
2

OpenAPI 3.1 spec generated at runtime

ShiftAPI reflects your Go types into a complete OpenAPI 3.1 schema. Served at /openapi.json — always matches your code, never maintained by hand.

GET /openapi.json → { "openapi": "3.1", ... }
3

TypeScript client via HMR

A Vite or Next.js plugin fetches the spec from your running Go server and generates a fully-typed client. Save a Go file, types update instantly.

const { data } = await client.POST("/greet", ...) // ^? { hello: string }

Built for real projects

Type-Safe Handlers

Generic Go functions capture request and response types at compile time. json, query, header, and form tags route input automatically.

Validation Included

Struct tags like validate:"required,email" are enforced at runtime and reflected into your OpenAPI schema.

Vite & Next.js

First-class plugins that start your Go server, proxy requests, and regenerate types on every save.

File Uploads

Declare uploads with form tags. The TypeScript client gets correct multipart/form-data types automatically.

Interactive Docs

Scalar API reference at /docs and an OpenAPI spec at /openapi.json — generated, never stale.

Just net/http

Implements http.Handler. Works with any middleware, any router, any test framework. Zero lock-in.

Start building in 30 seconds

One command scaffolds a full-stack Go + React, Svelte, or Next.js app with end-to-end types.

$npm create shiftapi@latest