TypeScript-first HTTP integrations
Docs • Examples • Issues • Roadmap
Zimic is a set of lightweight, thoroughly tested, TypeScript-first HTTP integration libraries.
Note
🌱 This library is in beta.
@zimic/http
is a collection of type-safe utilities to handle HTTP requests and responses,
including headers, search params, and form data.
- ⭐ HTTP schemas and typegen: Declare the structure of your HTTP endpoints as a TypeScript
schema and use it to type your HTTP requests and
responses. If you have an OpenAPI v3 declaration,
zimic-http typegen
can automatically generate the types of your schema. - 📌 Type-safe native APIs: Declare type-safe
Headers
,URLSearchParams
, andFormData
objects, fully compatible with their native counterparts.
Learn more:
@zimic/http
- Getting started@zimic/http
- API reference@zimic/http
- CLI reference
Warning
🚧 This library is experimental.
@zimic/fetch
is a minimal (1 kB minified and gzipped), zero-dependency, and type-safe
fetch
-like API client.
- ✨ Type-safe
fetch
: Create a type-safefetch
-like API client. Use your@zimic/http
schema and have your requests and responses fully typed by default. - 💪 Developer experience:
@zimic/fetch
seeks to be as compatible with the native Fetch API as possible, while providing an ergonomic interface to improve type safety. Define default options to apply to your requests, such as a base URL, headers, search parameters, and more. Inspect and modify requests and responses usingonRequest
andonResponse
listeners.
Learn more:
Note
🌱 This library is in beta.
@zimic/interceptor
provides a flexible and type-safe way to intercept and mock HTTP
requests.
- 🌐 HTTP interceptors: Intercept HTTP requests and return mock responses. Use local or remote interceptors to adapt your mocks to your development and testing workflow.
- ⚡ Fully typed mocks: Use your
@zimic/http
schema and create type-safe mocks for your HTTP requests. - 🔗 Network-level interceptor:
@zimic/interceptor
combines MSW and interceptor servers to handle real HTTP requests. From you application's point of view, the mocked responses are indistinguishable from the real ones. - 🔧 Flexibility: Mock external services and reliably test how your application behaves. Simulate success, loading, and error states with ease using standard web APIs.
- 💡 Simplicity:
@zimic/interceptor
was designed to encourage clarity, simplicity, and robustness in your mocks.
Tip
@zimic/fetch
and @zimic/interceptor
are not required to be used together. @zimic/interceptor
is compatible with
any HTTP client implementation, as @zimic/fetch
works with any HTTP interceptor library. With that in mind,
@zimic/fetch
and @zimic/interceptor
work best together, providing a seamless and type-safe experience for
performing HTTP requests in your application and mocking them during development and testing.
Learn more:
@zimic/interceptor
- Getting started@zimic/interceptor
- API reference@zimic/interceptor
- CLI reference@zimic/interceptor
- Guides
Visit our examples to see how to use Zimic with popular frameworks, libraries, and use cases.
The changelog is available on our GitHub Releases page.
Interested in contributing to Zimic? Check out our contributing guide to get started!