New:Microsoft Teams Notifications Are Now Available in Socket.Learn more β†’
Get Started

@orpc/contract

Package Overview
Dependencies
Maintainers
1
Versions
1130
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@orpc/contract

latest
Source
npmnpm
Version
1.15.1
Version published
Weekly downloads
832K
-6.14%
Maintainers
1
Weekly downloads
Β 
Created
Source
oRPC logo

codecov weekly downloads MIT License Discord Ask DeepWiki

Typesafe APIs Made Simple πŸͺ„

oRPC is a powerful combination of RPC and OpenAPI, makes it easy to build APIs that are end-to-end type-safe and adhere to OpenAPI standards

Highlights

  • πŸ”— End-to-End Type Safety: Ensure type-safe inputs, outputs, and errors from client to server.
  • πŸ“˜ First-Class OpenAPI: Built-in support that fully adheres to the OpenAPI standard.
  • πŸ“ Contract-First Development: Optionally define your API contract before implementation.
  • πŸ” First-Class OpenTelemetry: Seamlessly integrate with OpenTelemetry for observability.
  • βš™οΈ Framework Integrations: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte, Angular), SWR, Pinia Colada, and more.
  • πŸš€ Server Actions: Fully compatible with React Server Actions on Next.js, TanStack Start, and other platforms.
  • πŸ”  Standard Schema Support: Works out of the box with Zod, Valibot, ArkType, and other schema validators.
  • πŸ—ƒοΈ Native Types: Supports native types like Date, File, Blob, BigInt, URL, and more.
  • ⏱️ Lazy Router: Enhance cold start times with our lazy routing feature.
  • πŸ“‘ SSE & Streaming: Enjoy full type-safe support for SSE and streaming.
  • 🌍 Multi-Runtime Support: Fast and lightweight on Cloudflare, Deno, Bun, Node.js, and beyond.
  • πŸ”Œ Extendability: Easily extend functionality with plugins, middleware, and interceptors.

Documentation

You can find the full documentation here.

Packages

@orpc/contract

Build your API contract. Read the documentation for more information.

export const PlanetSchema = z.object({
  id: z.number().int().min(1),
  name: z.string(),
  description: z.string().optional(),
})

export const listPlanetContract = oc
  .input(
    z.object({
      limit: z.number().int().min(1).max(100).optional(),
      cursor: z.number().int().min(0).default(0),
    }),
  )
  .output(z.array(PlanetSchema))

export const findPlanetContract = oc
  .input(PlanetSchema.pick({ id: true }))
  .output(PlanetSchema)

export const createPlanetContract = oc
  .input(PlanetSchema.omit({ id: true }))
  .output(PlanetSchema)

export const contract = {
  planet: {
    list: listPlanetContract,
    find: findPlanetContract,
    create: createPlanetContract,
  },
}

Sponsors

If you find oRPC valuable and would like to support its development, you can do so here: GitHub Sponsors.

πŸ† Platinum Sponsor

ScreenshotOne.com
ScreenshotOne.com

πŸ₯ˆ Silver Sponsor

ζ‘δΈŠγ•γ‚“
ζ‘δΈŠγ•γ‚“

Generous Sponsors

LN Markets
LN Markets

Sponsors

Reece McDonald
Reece McDonald
あわわわとーにゅ
あわわわとーにゅ
nk
nk
supastarter
supastarter
Dexter Miguel
Dexter Miguel
herrfugbaum
herrfugbaum
Ryota Murakami
Ryota Murakami
David Cramer
David Cramer
Valerii Petryniak
Valerii Petryniak
Valerii Strilets
Valerii Strilets
Kyle Mistele
Kyle Mistele
christ12938
christ12938
Ryan Soderberg
Ryan Soderberg
shota
shota
Ellis Driscoll
Ellis Driscoll
Hoang Nguyen
Hoang Nguyen

Backers

David Walsh
David Walsh
Robbe Vaes
Robbe Vaes
Aidan Sunbury
Aidan Sunbury
soonoo
soonoo
Kevin Porten
Kevin Porten
Denis
Denis
Christopher Kapic
Christopher Kapic
Tom Ballinger
Tom Ballinger
Sam
Sam
Titoine
Titoine
Igor Makowski
Igor Makowski
hanayashiki
hanayashiki
Lev Dubinets
Lev Dubinets
Kelly Peilin Chan
Kelly Peilin Chan
Guy Ariely
Guy Ariely
Alex
Alex
Andrey Gubanov
Andrey Gubanov

With thanks to 37 past sponsors who helped get oRPC here.

License

Distributed under the MIT License. See LICENSE for more information.

Keywords

orpc

FAQs

Package last updated on 15 Sep 2026

Related posts