DEV Community

Cover image for Introducing Fetrix – An Advanced XMLHttpRequest Client for JavaScript
Naxrul Ahmed
Naxrul Ahmed

Posted on

Introducing Fetrix – An Advanced XMLHttpRequest Client for JavaScript

I've built Fetrix, a lightweight and extensible HTTP client designed for modern JavaScript and TypeScript applications.

While Fetch API is great, I wanted an HTTP client that provides more control over requests, progress tracking, retries, and interceptors without adding external dependencies.

That's why I built Fetrix on top of XMLHttpRequest.

✨ What makes Fetrix different?

  • Smart query parameter injection
  • Automatic JSON body serialization
  • Upload and download progress tracking
  • Request and response interceptors
  • Automatic retry on network failures and timeouts
  • Request deduplication
  • AbortController support
  • Configurable timeout
  • Custom HTTP status validation
  • Multiple response types (JSON, Blob, Text, ArrayBuffer, Document, Response)
  • FormData and multipart support
  • Zero external dependencies

💻 Simple example

import fetrix from 'fetrix';

const users = await fetrix('https://api.example.com/users', {
  method: 'GET',
  params: {
    limit: 10,
    offset: 0
  },
  responseType: 'json'
});

console.log(users);
Enter fullscreen mode Exit fullscreen mode

📦 Installation

npm install fetrix
Enter fullscreen mode Exit fullscreen mode

🔗 Check it out

Fetrix is open-source and MIT licensed.

I'd appreciate feedback, suggestions, and contributions from the JavaScript community!

JavaScript #TypeScript #OpenSource #WebDevelopment #HTTPClient

Top comments (0)