A Go framework for end-to-end type-safe APIs
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@latestYour Go struct becomes the TypeScript type. Change a field in Go, your frontend knows instantly.
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)
}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: stringThree layers, one source of truth. No manual steps between them.
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)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", ... }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 }Generic Go functions capture request and response types at compile time. json, query, header, and form tags route input automatically.
Struct tags like validate:"required,email" are enforced at runtime and reflected into your OpenAPI schema.
First-class plugins that start your Go server, proxy requests, and regenerate types on every save.
Declare uploads with form tags. The TypeScript client gets correct multipart/form-data types automatically.
Scalar API reference at /docs and an OpenAPI spec at /openapi.json — generated, never stale.
Implements http.Handler. Works with any middleware, any router, any test framework. Zero lock-in.
One command scaffolds a full-stack Go + React, Svelte, or Next.js app with end-to-end types.
npm create shiftapi@latest