Skip to content
github-actions[bot] edited this page Mar 3, 2025 · 23 revisions

Zimic

TypeScript-first HTTP integrations

Docs   •   Examples   •   Issues   •   Roadmap

CI  Coverage  License  Stars

NPM Downloads - @zimic/http  Bundle size - @zimic/http
NPM Downloads - @zimic/fetch  Bundle size - @zimic/fetch
NPM Downloads - @zimic/interceptor  Bundle size - @zimic/interceptor 


Contents


Zimic is a set of lightweight, thoroughly tested, TypeScript-first HTTP integration libraries.

Libraries

@zimic/http

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, and FormData objects, fully compatible with their native counterparts.

Learn more:

@zimic/fetch

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-safe fetch-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 using onRequest and onResponse listeners.

Learn more:

@zimic/interceptor

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:

Examples

Visit our examples to see how to use Zimic with popular frameworks, libraries, and use cases.

Changelog

The changelog is available on our GitHub Releases page.

Contributing

Interested in contributing to Zimic? Check out our contributing guide to get started!