Skip to content

zimicjs/zimic

Repository files navigation

Zimic

Next-gen 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 


Zimic is a collection of TypeScript-first HTTP integration libraries.

Features

  • ⚙️ TypeScript-first

    Zimic has first-class TypeScript support, providing type safety, inference, validation, and autocompletion out of the box. "Typed by default" is one of the core principles of Zimic.

  • Lightweight

    The Zimic libraries are designed with minimal bundle sizes and few external dependencies in mind, making them perfect for both client and server-side applications.

  • 📦 Developer friendly

    We believe that developer experience is key to building great applications. The Zimic API strives to be as simple and intuitive as possible, and we're always looking for ways to improve it.

  • 🧪 Thoroughly tested

    Zimic has a comprehensive test suite and high code coverage. Testing is a main part of our development process, and we take reliability and developer confidence very seriously.

Ecosystem

Zimic is split into an ecosystem of integrated packages.

@zimic/http

A collection of type-safe utilities to handle HTTP requests and responses, including headers, search params, and form data.

Status: 🌱 Beta

  • HTTP schemas

    Declare the structure of your endpoints in an HTTP schema and use it to type your HTTP requests and responses.

  • 💡 Type generation

    Infer types from OpenAPI documentation and generate ready-to-use HTTP schemas with our typegen CLI.

  • 📌 Type-safe APIs

    Declare typed Headers, URLSearchParams, and FormData objects, fully compatible with their native counterparts.

Learn more:

@zimic/fetch

A minimal (~2 kB minified and gzipped) and type-safe fetch-like API client.

Status: 🌱 Beta

  • Type-safe fetch

    Use your @zimic/http schema to create a type-safe fetch-like API client and have your requests and responses fully typed by default.

  • Zero dependencies

    @zimic/fetch has no external dependencies, making it a lightweight and fast alternative to other HTTP clients.

  • 💪 Developer experience

    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

A type-safe HTTP interceptor library for handling and mocking HTTP requests in development and testing.

Status: 🌱 Beta

  • 🌐 HTTP interceptors

    Use your @zimic/http schema to declare local and remote HTTP interceptors. Mock external services and simulate success, loading, and error states with ease and type safety.

  • 🔗 Network-level interception

    @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.

  • 💡 Readability

    @zimic/interceptor was designed to encourage clarity and readability in your mocks. Use declarative assertions to verify that your application is making the expected requests and test with confidence.

Learn more:

Tip

@zimic/fetch and @zimic/interceptor work best together, providing a seamless and type-safe experience for making and mocking HTTP requests. With that in mind, it's perfectly possible to use @zimic/interceptor with any HTTP client implementation, or @zimic/fetch with any HTTP mocking library. See our @zimic/fetch testing guide for more information.

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!