Show HN: Zimic: TypeScript-first HTTP integrations

Share This Post

Zimic is a set of TypeScript-first HTTP integration libraries, designed with developer experience and type safety in mind.

https://zimic.dev

Background:

Ever since I first started using TypeScript, I felt that mocking HTTP responses was hard to scale with tools like MSW and Nock. Having used these libraries for a couple of years, primarily for testing, I often had to write, review, and duplicate a lot of custom abstractions on top of them, trying to ensure:

  • Mock compliance: every mock should be realistic and accurate with the real service it represents; mocks with incorrect parameters, incompatible responses, or out of sync with the actual API directly reduce test confidence;

  • Test completeness: if an application is expected make a number of requests with certain parameters, it should be clear from the tests what these expectations are and they should fail if not met;

Over the years, I’ve come to believe that the tools we use have a unique opportunity to shape our mental models and encourage good practices. So I started exploring a question:

How could a library help developers create better API mocks?

The insights I gained during my research led to the early drafts of @ zimic/interceptor and a published paper on IEEE (https://ieeexplore.ieee.org/document/11126628). From there, I started expanding Zimic’s core principles to cover more aspects of the development process, not just API mocking:

  • @ zimic/http: declare HTTP schemas, infer types from OpenAPI, and type native Web APIs.

  • @ zimic/fetch: create type-safe Fetch API clients and have your requests and responses fully typed by default.

  • @ zimic/interceptor: mock HTTP services in development and testing, and simulate responses with type safety.

Earlier this year, Zimic reached 1.0 and I’m curious to hear what you think!

https://zimic.dev


Comments URL: https://news.ycombinator.com/item?id=45715262

Points: 1

# Comments: 0

Source: zimic.dev

Subscribe To Our Newsletter

Get updates and learn from the best

More To Explore

Windows Securitym Hackers Feeds

Cloudflare Cache Confusion

Article URL: https://www.robinsloan.com/lab/cache-confusion/ Comments URL: https://news.ycombinator.com/item?id=45715898 Points: 1 # Comments: 0 Source: www.robinsloan.com

Rapid Developer-Driven Threat Modeling

Article URL: https://github.com/secureflag/rad-tm/blob/main/rad-tm.md Comments URL: https://news.ycombinator.com/item?id=45715880 Points: 1 # Comments: 0 Source: github.com

Do You Want To Boost Your Business?

drop us a line and keep in touch

We are here to help

One of our technicians will be with you shortly.