Introduction
Understanding what CallApi is all about
What is CallApi?
CallApi is a modern Fetch API wrapper that adds essential features for real-world HTTP requests. If you know Fetch, you already know CallApi as it's a drop-in replacement with the same API, meaning you can use it anywhere Fetch works.
Built-in features include request deduplication, automatic retries, structured error handling, lifecycle hooks, schema validation, and a plugin system. Works everywhere: browsers, Node.js 18+, Deno, Bun, and edge workers.
Why CallApi?
Most HTTP clients either lack critical features or ship with bloated bundles. CallApi addresses common pain points while staying lightweight:
- Modern standards: Built on Fetch API, not legacy XMLHttpRequest
- Complete feature set: Deduplication, retries, interceptors, validation—all included out of the box
- Intuitive API: Simple, consistent interface without verbose configuration
- Full TypeScript support: Automatic type inference from validation schemas
- Lightweight: Less than 6KB minified and gzipped with zero dependencies
- Extensible: Plugin system for custom functionality
Features
CallApi aims to be the most comprehensive as well as intuitive fetching library out there. It provides a wide range of features out of the box and still allows you to extend it with plugins. Here are some of the features:
Request Deduplication
Eliminates duplicate requests and by effect, race conditions.
Interceptors/Hooks
Callback functions that allow running of side effects at various points within the request/response lifecycle.
Smart Response Parser
Automatically detects and parses response types (JSON, text, binary) based on Content-Type headers.
Content Type Detection
Automatically sets request Content-Type headers based on body type (JSON, form data, etc.).
Dynamic URL Parameters and Query Support
Convenient syntax for adding url parameters as well as query strings to the request url.
Extensible
Plugins and hooks to extend the functionality.
Schema Validation
Allows you to validate the both request details and response data, both on the type level and at runtime.
Retries
Advanced retry mechanisms with linear and exponential backoff strategies or custom retry conditions.
Last updated on