About openapi-typescript
Used by
- Bigcommerce: Node SDK for the BigCommerce API
- Budibase: low code platform for creating internal tools, workflows, and admin panels
- Fedora
fmn
: tools and APIs for Fedora’s messaging infra - Fingerprint: device fingerprinting for high-scale applications
- Google Firebase CLI: Official CLI for Google’s Firebase platform
- GitHub Octokit: Official SDK for the GitHub API
- Lotus: open source pricing & packaging infra
- Jitsu: modern, open source data ingestion / data pipelines
- Medusa: building blocks for digital commerce
- Netlify: the modern development platform
- Nuxt: The Intuitive Vue framework
- Relevance AI: build and deploy AI chains
- Revolt: open source user-first chat platform
- Spacebar: a free, open source, self-hostable Discord-compatible chat/voice/video platform
- Supabase: The open source Firebase alternative.
- Twitter API: Official SDK for the Twitter API
Project goals
- Support converting any valid OpenAPI schema to TypeScript types, no matter how complicated.
- Generated types should be statically-analyzable and runtime-free (with minor exceptions like enums.
- Don’t validate schemas; there are existing libraries for that like Redocly.
- Generated types should match your original schema as closely as possible, preserving original capitalization, etc.
- Typegen only needs Node.js to run (no Java, Python, etc.) and works in any environment.
- Support fetching OpenAPI schemas from files as well as local and remote servers.
Differences
vs. swagger-codegen
openapi-typescript was created specifically to be a lighterweight, easier-to-use alternative to swagger-codegen that doesn’t require the Java runtime or running an OpenAPI server. Nor does it generate heavyweight clientside code. In fact, all the code openapi-typescript generates is runtime free static types for maximum performance and minimum client weight.
vs. openapi-typescript-codegen
These 2 projects are unrelated. openapi-typescript-codegen is a Node.js alternative to the original swagger-codegen, but ends up being the same in practice. openapi-typescript has the same advantage of being runtime free whereas openapi-typescript-codegen can generate some pretty heavy bundles, up to 250 kB
or more depending on the schema complexity.
vs. tRPC
tRPC is an opinionated type-safe framework for both server and client. It demands both your server and client be written in tRPC (which means Node.js for the backend).
If you fit into this usecase, it’s a great experience! But for everyone else, openapi-typescript (and openapi-fetch) is a more flexible, lower-level solution that can work for any technology choice (or even be incrementally-adopted without any cost).
Contributors
This library wouldn’t be possible without all these amazing contributors: