https://github.com/zimicjs/zimic
Next-gen TypeScript-first HTTP integrations
https://github.com/zimicjs/zimic
api fetch http mock msw openapi service-workers tests typegen types typescript
Last synced: 5 months ago
JSON representation
Next-gen TypeScript-first HTTP integrations
- Host: GitHub
- URL: https://github.com/zimicjs/zimic
- Owner: zimicjs
- License: mit
- Created: 2023-11-21T21:14:37.000Z (almost 2 years ago)
- Default Branch: canary
- Last Pushed: 2025-05-10T21:14:34.000Z (5 months ago)
- Last Synced: 2025-05-10T22:19:08.592Z (5 months ago)
- Topics: api, fetch, http, mock, msw, openapi, service-workers, tests, typegen, types, typescript
- Language: TypeScript
- Homepage: https://zimic.dev
- Size: 5.02 MB
- Stars: 17
- Watchers: 2
- Forks: 3
- Open Issues: 25
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
![]()
Zimic
Next-gen TypeScript-first HTTP integrations
Docs
•
Examples
•
Issues
•
Roadmap[](https://github.com/zimicjs/zimic/actions/workflows/ci.yaml)
[](https://github.com/zimicjs/zimic/actions)
[](https://github.com/zimicjs/zimic/blob/canary/LICENSE.md)
[](https://github.com/zimicjs/zimic)[](https://www.npmjs.com/package/@zimic/http)
[](https://bundlephobia.com/package/@zimic/http)
[](https://www.npmjs.com/package/@zimic/fetch)
[](https://bundlephobia.com/package/@zimic/fetch)
[](https://www.npmjs.com/package/@zimic/interceptor)
[](https://bundlephobia.com/package/@zimic/interceptor)---
## Contents
- [Projects](#projects)
- [`@zimic/http`](#zimichttp)
- [`@zimic/fetch`](#zimicfetch)
- [`@zimic/interceptor`](#zimicinterceptor)
- [Examples](#examples)
- [Changelog](#changelog)
- [Contributing](#contributing)---
Zimic is a collection of TypeScript-first HTTP integration libraries.
## Projects
### `@zimic/http`
> [!NOTE]
>
> Status: :seedling: **Beta**[`@zimic/http`](./packages/zimic-http) is a collection of type-safe utilities to handle HTTP requests and responses,
including headers, search params, and form data.- :star: **HTTP schemas and typegen**: Declare the structure of your HTTP endpoints as a TypeScript
[schema](https://github.com/zimicjs/zimic/wiki/api‐zimic‐http‐schemas) and use it to type your HTTP requests and
responses. If you have an [OpenAPI v3](https://swagger.io/specification) declaration,
[`zimic-http typegen`](https://github.com/zimicjs/zimic/wiki/cli‐zimic‐typegen) can automatically generate the types
of your schema.
- :pushpin: **Type-safe native APIs**: Declare type-safe
[`Headers`](https://github.com/zimicjs/zimic/wiki/api‐zimic‐http#httpheaders),
[`URLSearchParams`](https://github.com/zimicjs/zimic/wiki/api‐zimic‐http#httpsearchparams), and
[`FormData`](https://github.com/zimicjs/zimic/wiki/api‐zimic‐http#httpformdata) objects, fully compatible with their
native counterparts.**Learn more**:
- [`@zimic/http` - Getting started](https://github.com/zimicjs/zimic/wiki/getting‐started‐http)
- [`@zimic/http` - API reference](https://github.com/zimicjs/zimic/wiki/api‐zimic‐http)
- `@zimic/http` - CLI reference
- [`zimic-http typegen`](https://github.com/zimicjs/zimic/wiki/cli‐zimic‐typegen)### `@zimic/fetch`
> [!WARNING]
>
> Status: :seedling: **Beta**[`@zimic/fetch`](./packages/zimic-fetch) is a minimal (~2 kB minified and gzipped), zero-dependency, and type-safe
`fetch`-like API client.- :sparkles: **Type-safe `fetch`**: Create a type-safe
[`fetch`-like](https://developer.mozilla.org/docs/Web/API/Fetch_API) API client. Use your
[`@zimic/http` schema](https://github.com/zimicjs/zimic/wiki/api‐zimic‐http‐schemas) and have your requests and
responses fully typed by default.
- :muscle: **Developer experience**: `@zimic/fetch` seeks to be as compatible with the
[native Fetch API](https://developer.mozilla.org/docs/Web/API/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`](https://github.com/zimicjs/zimic/wiki/api‐zimic‐fetch#fetchonrequest) and
[`onResponse`](https://github.com/zimicjs/zimic/wiki/api‐zimic‐fetch#fetchonresponse) listeners.**Learn more**:
- [`@zimic/fetch` - Getting started](https://github.com/zimicjs/zimic/wiki/getting‐started‐fetch)
- [`@zimic/fetch` - API reference](https://github.com/zimicjs/zimic/wiki/api‐zimic‐fetch)### `@zimic/interceptor`
> [!NOTE]
>
> Status: :seedling: **Beta**[`@zimic/interceptor`](./packages/zimic-interceptor) provides a readable and type-safe way to intercept and mock HTTP
requests.- :globe_with_meridians: **HTTP interceptors**: Intercept HTTP requests and return mock responses. Use
[local](https://github.com/zimicjs/zimic/wiki/getting‐started#local-http-interceptors) or
[remote](https://github.com/zimicjs/zimic/wiki/getting‐started#remote-http-interceptors) interceptors to adapt your
mocks to your development and testing workflow.
- :zap: **Fully typed mocks**: Use your
[`@zimic/http` schema](https://github.com/zimicjs/zimic/wiki/api‐zimic‐http‐schemas) and create type-safe mocks for
your HTTP requests.
- :link: **Network-level interceptor**: `@zimic/interceptor` combines [MSW](https://github.com/mswjs/msw) and
[interceptor servers](https://github.com/zimicjs/zimic/wiki/cli‐zimic‐server) to handle real HTTP requests. From you
application's point of view, the mocked responses are indistinguishable from the real ones.
- :wrench: **Flexibility**: Mock external services and reliably test how your application behaves. Simulate success,
loading, and error states with ease using [standard web APIs](https://developer.mozilla.org/docs/Web/API).
- :bulb: **Readability**: `@zimic/interceptor` was designed to encourage clarity and readability 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](https://github.com/zimicjs/zimic/wiki/getting‐started‐interceptor)
- [`@zimic/interceptor` - API reference](https://github.com/zimicjs/zimic/wiki/api‐zimic‐interceptor‐http)
- `@zimic/interceptor` - CLI reference
- [Browser](https://github.com/zimicjs/zimic/wiki/cli‐zimic‐browser)
- [Server](https://github.com/zimicjs/zimic/wiki/cli‐zimic‐server)
- `@zimic/interceptor` - Guides
- [Testing](https://github.com/zimicjs/zimic/wiki/guides‐testing‐interceptor)## Examples
Visit our [examples](./examples/README.md) to see how to use Zimic with popular frameworks, libraries, and use cases.
## Changelog
The changelog is available on our [GitHub Releases](https://github.com/zimicjs/zimic/releases) page.
## Contributing
Interested in contributing to Zimic? Check out our [contributing guide](./CONTRIBUTING.md) to get started!