Skip to content
Firekid Packages
PackagesReleases
Firekid Packages

Live registry data for every package Firekid publishes. Downloads, versions, changelogs and health.

Browse

  • Packages
  • Latest releases
  • How it works
  • Public JSON API
  • llms.txt

Find Firekid

  • GitHub
  • Discord
  • WhatsApp channel
  • X
  • TikTok
Firekid Packages2026
npm package

Hurl

npmstablev1.2.1published 1 day agoZero dependenciesHTTP Client

Zero-dependency HTTP client for Node.js and edge runtimes. Built on fetch. The modern replacement for axios, request, got, node-fetch, and ky. Works on Cloudflare Workers, Vercel Edge, Deno, and Bun.

npm install @firekid/hurl
npmGitHubHomepage
012345678901234567890123456789
Weekly downloads
0123456789,012345678901234567890123456789
Monthly downloads
0123456789,012345678901234567890123456789
All-time downloads
0123456789
Stars
0123456789
Forks
0123456789
Open issues
0123456789
Versions
64 kB
Unpacked size
MIT
License

Downloads

Daily downloads of Hurl

Daily downloads of Hurl. 2,015 downloads from 2026-09-06 to 2026-12-04.

0100200300Oct 1Nov 1Dec 1v1.2.1, 2026-12-04
View as table
DateDaily downloads
2026-12-04316
2026-12-0399
2026-12-02123
2026-12-0183
2026-11-30117
2026-11-29130
2026-11-2871
2026-11-27120
2026-11-26135
2026-11-25105
2026-11-2489
2026-11-2362
2026-11-22111
2026-11-2135
2026-11-200
2026-11-1919
2026-11-1855
2026-11-1781
2026-11-1675
2026-11-152
2026-11-142
2026-11-132
2026-11-120
2026-11-113
2026-11-1017
2026-11-094
2026-11-083
2026-11-0716
2026-11-063
2026-11-052
2026-11-045
2026-11-030
2026-11-021
2026-11-011
2026-10-311
2026-10-301
2026-10-2911
2026-10-281
2026-10-274
2026-10-263
2026-10-257
2026-10-242
2026-10-230
2026-10-220
2026-10-218
2026-10-200
2026-10-190
2026-10-181
2026-10-175
2026-10-164
2026-10-151
2026-10-140
2026-10-131
2026-10-120
2026-10-111
2026-10-100
2026-10-092
2026-10-080
2026-10-075
2026-10-061
2026-10-051
2026-10-040
2026-10-031
2026-10-022
2026-10-010
2026-09-301
2026-09-291
2026-09-281
2026-09-272
2026-09-261
2026-09-252
2026-09-246
2026-09-234
2026-09-220
2026-09-210
2026-09-205
2026-09-191
2026-09-181
2026-09-177
2026-09-166
2026-09-150
2026-09-141
2026-09-132
2026-09-1210
2026-09-111
2026-09-104
2026-09-090
2026-09-084
2026-09-074
2026-09-061

Health

0of 100
Freshness25 / 25
Time since the last release and the last commit
Release cadence12 / 15
9 releases in the last 12 months
Maintenance15 / 15
Open issues relative to stars
Quality signals19 / 25
TypeScript types, license, README and changelog present
Weight and risk10 / 10
Dependency count and unpacked size
Status10 / 10
Not deprecated and not archived

Activity

Daily downloads, last 12 months
DecJanFebMarAprMayJunJulAugSepOctNovMonWedFri0 downloads on 2025-11-300 downloads on 2025-12-010 downloads on 2025-12-020 downloads on 2025-12-030 downloads on 2025-12-040 downloads on 2025-12-050 downloads on 2025-12-060 downloads on 2025-12-070 downloads on 2025-12-080 downloads on 2025-12-090 downloads on 2025-12-100 downloads on 2025-12-110 downloads on 2025-12-120 downloads on 2025-12-130 downloads on 2025-12-140 downloads on 2025-12-150 downloads on 2025-12-160 downloads on 2025-12-170 downloads on 2025-12-180 downloads on 2025-12-190 downloads on 2025-12-200 downloads on 2025-12-210 downloads on 2025-12-220 downloads on 2025-12-230 downloads on 2025-12-240 downloads on 2025-12-250 downloads on 2025-12-260 downloads on 2025-12-270 downloads on 2025-12-280 downloads on 2025-12-290 downloads on 2025-12-300 downloads on 2025-12-310 downloads on 2026-01-010 downloads on 2026-01-020 downloads on 2026-01-030 downloads on 2026-01-040 downloads on 2026-01-050 downloads on 2026-01-060 downloads on 2026-01-070 downloads on 2026-01-080 downloads on 2026-01-090 downloads on 2026-01-100 downloads on 2026-01-110 downloads on 2026-01-120 downloads on 2026-01-130 downloads on 2026-01-140 downloads on 2026-01-150 downloads on 2026-01-160 downloads on 2026-01-170 downloads on 2026-01-180 downloads on 2026-01-190 downloads on 2026-01-200 downloads on 2026-01-210 downloads on 2026-01-220 downloads on 2026-01-230 downloads on 2026-01-240 downloads on 2026-01-250 downloads on 2026-01-260 downloads on 2026-01-270 downloads on 2026-01-280 downloads on 2026-01-290 downloads on 2026-01-300 downloads on 2026-01-310 downloads on 2026-02-010 downloads on 2026-02-020 downloads on 2026-02-030 downloads on 2026-02-040 downloads on 2026-02-050 downloads on 2026-02-060 downloads on 2026-02-070 downloads on 2026-02-080 downloads on 2026-02-090 downloads on 2026-02-100 downloads on 2026-02-110 downloads on 2026-02-120 downloads on 2026-02-130 downloads on 2026-02-140 downloads on 2026-02-150 downloads on 2026-02-160 downloads on 2026-02-170 downloads on 2026-02-180 downloads on 2026-02-190 downloads on 2026-02-200 downloads on 2026-02-210 downloads on 2026-02-220 downloads on 2026-02-230 downloads on 2026-02-240 downloads on 2026-02-250 downloads on 2026-02-260 downloads on 2026-02-270 downloads on 2026-02-280 downloads on 2026-03-010 downloads on 2026-03-020 downloads on 2026-03-03242 downloads on 2026-03-04195 downloads on 2026-03-05121 downloads on 2026-03-06112 downloads on 2026-03-0713 downloads on 2026-03-089 downloads on 2026-03-096 downloads on 2026-03-1032 downloads on 2026-03-1122 downloads on 2026-03-129 downloads on 2026-03-1310 downloads on 2026-03-1412 downloads on 2026-03-150 downloads on 2026-03-160 downloads on 2026-03-172 downloads on 2026-03-181 downloads on 2026-03-197 downloads on 2026-03-207 downloads on 2026-03-210 downloads on 2026-03-220 downloads on 2026-03-232 downloads on 2026-03-240 downloads on 2026-03-250 downloads on 2026-03-260 downloads on 2026-03-270 downloads on 2026-03-280 downloads on 2026-03-290 downloads on 2026-03-300 downloads on 2026-03-310 downloads on 2026-04-013 downloads on 2026-04-023 downloads on 2026-04-032 downloads on 2026-04-040 downloads on 2026-04-050 downloads on 2026-04-066 downloads on 2026-04-0732 downloads on 2026-04-080 downloads on 2026-04-090 downloads on 2026-04-105 downloads on 2026-04-113 downloads on 2026-04-12128 downloads on 2026-04-138 downloads on 2026-04-141 downloads on 2026-04-154 downloads on 2026-04-162 downloads on 2026-04-171 downloads on 2026-04-182 downloads on 2026-04-192 downloads on 2026-04-200 downloads on 2026-04-210 downloads on 2026-04-223 downloads on 2026-04-237 downloads on 2026-04-249 downloads on 2026-04-251 downloads on 2026-04-268 downloads on 2026-04-271 downloads on 2026-04-281 downloads on 2026-04-290 downloads on 2026-04-300 downloads on 2026-05-010 downloads on 2026-05-021 downloads on 2026-05-032 downloads on 2026-05-044 downloads on 2026-05-056 downloads on 2026-05-064 downloads on 2026-05-070 downloads on 2026-05-0816 downloads on 2026-05-093 downloads on 2026-05-1011 downloads on 2026-05-1137 downloads on 2026-05-129 downloads on 2026-05-134 downloads on 2026-05-142 downloads on 2026-05-154 downloads on 2026-05-161 downloads on 2026-05-1718 downloads on 2026-05-180 downloads on 2026-05-198 downloads on 2026-05-200 downloads on 2026-05-219 downloads on 2026-05-224 downloads on 2026-05-230 downloads on 2026-05-249 downloads on 2026-05-251 downloads on 2026-05-261 downloads on 2026-05-272 downloads on 2026-05-283 downloads on 2026-05-297 downloads on 2026-05-305 downloads on 2026-05-310 downloads on 2026-06-012 downloads on 2026-06-0213 downloads on 2026-06-039 downloads on 2026-06-046 downloads on 2026-06-054 downloads on 2026-06-062 downloads on 2026-06-075 downloads on 2026-06-080 downloads on 2026-06-090 downloads on 2026-06-102 downloads on 2026-06-110 downloads on 2026-06-122 downloads on 2026-06-132 downloads on 2026-06-141 downloads on 2026-06-153 downloads on 2026-06-169 downloads on 2026-06-170 downloads on 2026-06-1815 downloads on 2026-06-192 downloads on 2026-06-201 downloads on 2026-06-211 downloads on 2026-06-227 downloads on 2026-06-230 downloads on 2026-06-245 downloads on 2026-06-257 downloads on 2026-06-260 downloads on 2026-06-279 downloads on 2026-06-288 downloads on 2026-06-292 downloads on 2026-06-300 downloads on 2026-07-012 downloads on 2026-07-0210 downloads on 2026-07-030 downloads on 2026-07-040 downloads on 2026-07-053 downloads on 2026-07-060 downloads on 2026-07-070 downloads on 2026-07-085 downloads on 2026-07-090 downloads on 2026-07-101 downloads on 2026-07-113 downloads on 2026-07-120 downloads on 2026-07-131 downloads on 2026-07-141 downloads on 2026-07-151 downloads on 2026-07-160 downloads on 2026-07-174 downloads on 2026-07-180 downloads on 2026-07-191 downloads on 2026-07-203 downloads on 2026-07-210 downloads on 2026-07-222 downloads on 2026-07-231 downloads on 2026-07-247 downloads on 2026-07-259 downloads on 2026-07-266 downloads on 2026-07-271 downloads on 2026-07-280 downloads on 2026-07-290 downloads on 2026-07-301 downloads on 2026-07-310 downloads on 2026-08-011 downloads on 2026-08-020 downloads on 2026-08-035 downloads on 2026-08-043 downloads on 2026-08-051 downloads on 2026-08-068 downloads on 2026-08-070 downloads on 2026-08-081 downloads on 2026-08-090 downloads on 2026-08-1013 downloads on 2026-08-110 downloads on 2026-08-121 downloads on 2026-08-138 downloads on 2026-08-142 downloads on 2026-08-150 downloads on 2026-08-160 downloads on 2026-08-171 downloads on 2026-08-182 downloads on 2026-08-192 downloads on 2026-08-202 downloads on 2026-08-212 downloads on 2026-08-221 downloads on 2026-08-232 downloads on 2026-08-241 downloads on 2026-08-253 downloads on 2026-08-263 downloads on 2026-08-272 downloads on 2026-08-281 downloads on 2026-08-291 downloads on 2026-08-306 downloads on 2026-08-310 downloads on 2026-09-018 downloads on 2026-09-022 downloads on 2026-09-031 downloads on 2026-09-043 downloads on 2026-09-051 downloads on 2026-09-064 downloads on 2026-09-074 downloads on 2026-09-080 downloads on 2026-09-094 downloads on 2026-09-101 downloads on 2026-09-1110 downloads on 2026-09-122 downloads on 2026-09-131 downloads on 2026-09-140 downloads on 2026-09-156 downloads on 2026-09-167 downloads on 2026-09-171 downloads on 2026-09-181 downloads on 2026-09-195 downloads on 2026-09-200 downloads on 2026-09-210 downloads on 2026-09-224 downloads on 2026-09-236 downloads on 2026-09-242 downloads on 2026-09-251 downloads on 2026-09-262 downloads on 2026-09-271 downloads on 2026-09-281 downloads on 2026-09-291 downloads on 2026-09-300 downloads on 2026-10-012 downloads on 2026-10-021 downloads on 2026-10-030 downloads on 2026-10-041 downloads on 2026-10-051 downloads on 2026-10-065 downloads on 2026-10-070 downloads on 2026-10-082 downloads on 2026-10-090 downloads on 2026-10-101 downloads on 2026-10-110 downloads on 2026-10-121 downloads on 2026-10-130 downloads on 2026-10-141 downloads on 2026-10-154 downloads on 2026-10-165 downloads on 2026-10-171 downloads on 2026-10-180 downloads on 2026-10-190 downloads on 2026-10-208 downloads on 2026-10-210 downloads on 2026-10-220 downloads on 2026-10-232 downloads on 2026-10-247 downloads on 2026-10-253 downloads on 2026-10-264 downloads on 2026-10-271 downloads on 2026-10-2811 downloads on 2026-10-291 downloads on 2026-10-301 downloads on 2026-10-311 downloads on 2026-11-011 downloads on 2026-11-020 downloads on 2026-11-035 downloads on 2026-11-042 downloads on 2026-11-053 downloads on 2026-11-0616 downloads on 2026-11-073 downloads on 2026-11-084 downloads on 2026-11-0917 downloads on 2026-11-103 downloads on 2026-11-110 downloads on 2026-11-122 downloads on 2026-11-132 downloads on 2026-11-142 downloads on 2026-11-1575 downloads on 2026-11-1681 downloads on 2026-11-1755 downloads on 2026-11-1819 downloads on 2026-11-190 downloads on 2026-11-2035 downloads on 2026-11-21111 downloads on 2026-11-2262 downloads on 2026-11-2389 downloads on 2026-11-24105 downloads on 2026-11-25135 downloads on 2026-11-26120 downloads on 2026-11-2771 downloads on 2026-11-28130 downloads on 2026-11-29117 downloads on 2026-11-3083 downloads on 2026-12-01123 downloads on 2026-12-0299 downloads on 2026-12-03316 downloads on 2026-12-04
LessMore

Versions

All 9 versions
v1.2.14 Dec 202664 kB (+12 kB)

No release notes recorded for this version.

v1.1.013 Apr 202652 kB (+10 kB)

No release notes recorded for this version.

v1.0.77 Mar 202642 kB (+2.0 kB)

No release notes recorded for this version.

v1.0.66 Mar 202640 kB (+411 B)

No release notes recorded for this version.

v1.0.55 Mar 202639 kB

No release notes recorded for this version.

v1.0.45 Mar 202639 kB (+3.8 kB)

No release notes recorded for this version.

v1.0.34 Mar 202635 kB (-75 kB)

No release notes recorded for this version.

v1.0.24 Mar 2026111 kB (+76 kB)

No release notes recorded for this version.

v1.0.04 Mar 202635 kB

No release notes recorded for this version.

Dependencies

Zero dependencies

This package has no runtime dependencies.

Details

License
MIT
TypeScript types
Included
Language
TypeScript
Last commit
1 day ago
First published
4 Mar 2026

Badges

Weekly downloads badge
Version badge
Stars badge
Health badge

README

Source

@firekid/hurl

npm version npm downloads npm bundle size TypeScript License: MIT CI GitHub stars Website

@firekid/hurl is a modern, zero-dependency HTTP client for Node.js 18+, Cloudflare Workers, Vercel Edge Functions, Deno, and Bun — built on native fetch with retries, interceptors, auth helpers, in-memory caching, request deduplication, SSE streaming, circuit breaker, and full TypeScript support.

npm install @firekid/hurl

Why hurl?

Most HTTP clients make you choose between features and bundle size, or between Node.js support and edge compatibility. @firekid/hurl does neither.

import hurl from '@firekid/hurl'

// Retry automatically on failure
const res = await hurl.get('https://api.example.com/users', { retry: 3 })

// Auth, timeout, caching — all in one call
const data = await hurl.get('/users', {
  auth: { type: 'bearer', token: process.env.API_TOKEN },
  timeout: 5000,
  cache: { ttl: 60000 },
})

// Stream an AI response over SSE
const { close } = hurl.sse('https://api.openai.com/v1/chat/completions', {
  method: 'POST',
  auth: { type: 'bearer', token: process.env.OPENAI_KEY },
  body: { model: 'gpt-4o', stream: true, messages: [{ role: 'user', content: 'Hello' }] },
  onMessage: (e) => process.stdout.write(JSON.parse(e.data).choices[0].delta.content ?? ''),
  onDone: () => console.log('\ndone'),
})

// Parallel requests
const [users, posts] = await hurl.all([
  hurl.get('/users'),
  hurl.get('/posts'),
])

Comparison

Featurehurlaxioskygotnode-fetch
Zero dependencies✅❌✅❌✅
Bundle size~12KB~35KB~5KB~45KB~8KB
Node.js 18+✅✅✅✅✅
Cloudflare Workers✅❌✅❌❌
Vercel Edge✅❌✅❌❌
Deno / Bun✅⚠️✅⚠️❌
Built-in retries✅❌✅✅❌
Interceptors✅✅✅❌❌
Auth helpers✅⚠️❌❌❌
In-memory cache✅❌❌❌❌
Request deduplication✅❌❌❌❌
SSE (with POST + auth)✅❌❌❌❌
Circuit breaker✅❌❌❌❌
Upload progress✅✅❌❌❌
Download progress✅✅❌❌❌
Proxy support✅✅❌✅❌
CommonJS + ESM✅✅❌❌✅
TypeScript (built-in)✅⚠️✅✅⚠️
Throws on 4xx/5xx✅✅✅✅❌

✅ Full support   ⚠️ Partial / via plugin   ❌ Not supported


Installation

npm install @firekid/hurl
yarn add @firekid/hurl
pnpm add @firekid/hurl

Quick Start

import hurl from '@firekid/hurl'

const res = await hurl.get('https://api.example.com/users')

res.data        // parsed response body
res.status      // 200
res.headers     // Record<string, string>
res.requestId   // unique ID for this request
res.timing      // { start, end, duration }
res.fromCache   // boolean

HTTP Methods

hurl.get<T>(url, options?)
hurl.post<T>(url, body?, options?)
hurl.put<T>(url, body?, options?)
hurl.patch<T>(url, body?, options?)
hurl.delete<T>(url, options?)
hurl.head(url, options?)
hurl.options<T>(url, options?)
hurl.request<T>(url, options?)

Global Defaults

hurl.defaults.set({
  baseUrl: 'https://api.example.com',
  headers: { 'x-api-version': '2' },
  timeout: 10000,
  retry: 3,
})

hurl.defaults.get()
hurl.defaults.reset()

Authentication

// Bearer token
hurl.defaults.set({ auth: { type: 'bearer', token: 'my-token' } })

// Basic auth
hurl.defaults.set({ auth: { type: 'basic', username: 'admin', password: 'secret' } })

// API key (header)
hurl.defaults.set({ auth: { type: 'apikey', key: 'x-api-key', value: 'my-key' } })

// API key (query param)
hurl.defaults.set({ auth: { type: 'apikey', key: 'token', value: 'my-key', in: 'query' } })

Retry & Backoff

// Simple — retry 3 times with exponential backoff
await hurl.get('/users', { retry: 3 })

// Full config
await hurl.get('/users', {
  retry: {
    count: 3,
    delay: 300,
    backoff: 'exponential',
    on: [500, 502, 503],
  }
})

Retries are not triggered for abort errors. If no on array is provided, retries fire on network errors, timeout errors, and any 5xx status.


Timeout & Abort

await hurl.get('/users', { timeout: 5000 })

const controller = new AbortController()
setTimeout(() => controller.abort(), 3000)
await hurl.get('/users', { signal: controller.signal })

SSE — Server-Sent Events

Unlike the native EventSource, hurl.sse() works with POST requests, custom headers, and all auth types. This makes it directly compatible with AI APIs like OpenAI, Anthropic, and Gemini that stream over SSE.

const { close } = hurl.sse('https://api.openai.com/v1/chat/completions', {
  method: 'POST',
  auth: { type: 'bearer', token: process.env.OPENAI_KEY },
  body: {
    model: 'gpt-4o',
    stream: true,
    messages: [{ role: 'user', content: 'Hello' }],
  },
  onOpen: () => console.log('stream opened'),
  onMessage: (event) => {
    // event.data, event.event, event.id, event.retry
    const chunk = JSON.parse(event.data)
    process.stdout.write(chunk.choices[0].delta.content ?? '')
  },
  onDone: () => console.log('\nstream complete'),
  onError: (err) => console.error(err),
})

// Stop the stream at any time
close()

SSE with an instance (inherits baseUrl and auth from defaults):

const ai = hurl.create({
  baseUrl: 'https://api.openai.com/v1',
  auth: { type: 'bearer', token: process.env.OPENAI_KEY },
})

const { close } = ai.sse('/chat/completions', {
  method: 'POST',
  body: { model: 'gpt-4o', stream: true, messages: [...] },
  onMessage: (e) => console.log(e.data),
})

hurl.sse() handles the data: [DONE] sentinel automatically — it fires onDone and closes the stream. You also get a signal option if you want to tie the stream to an AbortController you control.


Circuit Breaker

The circuit breaker stops your app from hammering a failing service. After a set number of consecutive failures it opens the circuit and fast-fails all requests until a cooldown period passes, then lets one probe through to check if the service recovered.

States: CLOSED (normal) → OPEN (fast-failing) → HALF_OPEN (probing) → CLOSED

await hurl.get('https://api.example.com/users', {
  circuitBreaker: {
    threshold: 5,       // open after 5 consecutive failures
    cooldown: 30_000,   // wait 30s before probing
  },
})

With a fallback so the circuit open doesn't throw:

await hurl.get('/users', {
  circuitBreaker: {
    threshold: 3,
    cooldown: 10_000,
    fallback: () => [],   // returned as res.data when circuit is open
  },
})

Set it on an instance so every request to that API is protected:

const api = hurl.create({
  baseUrl: 'https://api.example.com',
  circuitBreaker: {
    threshold: 5,
    cooldown: 30_000,
  },
})

Use a custom key if you want multiple endpoints on the same host to have independent breakers:

await hurl.get('/payments', {
  circuitBreaker: { threshold: 3, cooldown: 15_000, key: 'payments-service' },
})

await hurl.get('/orders', {
  circuitBreaker: { threshold: 3, cooldown: 15_000, key: 'orders-service' },
})

Check the state of any breaker at any time:

import { getCircuitStats } from '@firekid/hurl'

const { state, failures } = getCircuitStats('https://api.example.com')
// state: 'CLOSED' | 'OPEN' | 'HALF_OPEN'
// failures: number

When the circuit is open and no fallback is provided, a HurlError with type CIRCUIT_OPEN is thrown:

try {
  await hurl.get('/users', { circuitBreaker: { threshold: 3, cooldown: 10_000 } })
} catch (err) {
  if (err instanceof HurlError && err.type === 'CIRCUIT_OPEN') {
    console.log('service unavailable, try again later')
  }
}

Interceptors

// Request interceptor
const remove = hurl.interceptors.request.use((url, options) => {
  return {
    url,
    options: {
      ...options,
      headers: { ...options.headers, 'x-trace-id': crypto.randomUUID() },
    },
  }
})
remove() // unregister

// Response interceptor
hurl.interceptors.response.use((response) => {
  console.log(response.status, response.timing.duration)
  return response
})

// Error interceptor
hurl.interceptors.error.use((error) => {
  if (error.status === 401) redirectToLogin()
  return error
})

// Clear all
hurl.interceptors.request.clear()
hurl.interceptors.response.clear()
hurl.interceptors.error.clear()

Caching

Caching applies to GET requests only. Responses are stored in memory with a TTL in milliseconds. Streamed responses (stream: true) are never cached.

Cache entries (and in-flight deduplication) are separated per caller identity: the Authorization, Cookie and Proxy-Authorization headers, the API-key header when auth.type is 'apikey', and the credentials mode are part of the key. Two users hitting the same URL with different tokens never share a cached response. Other headers (e.g. trace IDs) do not affect the key. The cache store is shared by all instances.

await hurl.get('/users', { cache: { ttl: 60000 } })
await hurl.get('/users', { cache: { ttl: 60000, key: 'all-users' } })
await hurl.get('/users', { cache: { ttl: 60000, bypass: true } })
import { clearCache, invalidateCache } from '@firekid/hurl'

clearCache()
invalidateCache('https://api.example.com/users') // removes every identity variant of this URL
invalidateCache('all-users') // if you used a custom cache key

Request Deduplication

When deduplicate is true and the same GET URL is called multiple times simultaneously, only one network request is made.

const [a, b] = await Promise.all([
  hurl.get('/users', { deduplicate: true }),
  hurl.get('/users', { deduplicate: true }),
])
// only one network request fired

Upload & Download Progress

const form = new FormData()
form.append('file', file)

await hurl.post('/upload', form, {
  onUploadProgress: ({ loaded, total, percent }) => {
    console.log(`Uploading: ${percent}%`)
  }
})

await hurl.get('/large-file', {
  onDownloadProgress: ({ loaded, total, percent }) => {
    console.log(`Downloading: ${percent}%`)
  }
})

Upload progress works with string, Blob, ArrayBuffer, ReadableStream and FormData bodies. A FormData body is serialized to a Blob in memory when onUploadProgress is set (so the total size is known); without it, the form is streamed by fetch as usual.


Native fetch options

These options are forwarded to fetch unchanged. Set them per request or in defaults; a per-request value wins.

OptionForwarded asNotes
credentialscredentials'include' for cross-origin cookies, 'omit' to force-drop them
modemode'cors', 'no-cors', 'same-origin'
httpCachecacheBrowser HTTP cache mode. Named httpCache because cache is hurl's own in-memory cache
referrerreferrer
referrerPolicyreferrerPolicy
integrityintegritySubresource integrity hash; a mismatch fails the request
keepalivekeepalive
prioritypriority'high', 'low', 'auto', only where the runtime supports it
const api = hurl.create({ baseUrl: 'https://api.example.com', credentials: 'include' })

await api.get('/me')                               // sends cookies cross-origin
await api.get('/public', { credentials: 'omit' })  // never sends cookies

hurl.sse() forwards credentials, mode, referrer and referrerPolicy.

Most of these only change behavior in browsers. Node's fetch accepts them but has no cookie jar or CORS.


Proxy

Native fetch does not support programmatic proxy configuration out of the box. Proxy support depends on your Node.js version:

Node.js 18 — install undici@6 (v7 dropped Node 18 support), use ProxyAgent:

// npm install undici@6
import { ProxyAgent, setGlobalDispatcher } from 'undici'
setGlobalDispatcher(new ProxyAgent('http://proxy.example.com:8080'))

Node.js 20 — undici is bundled with ProxyAgent support:

import { ProxyAgent, setGlobalDispatcher } from 'undici'
setGlobalDispatcher(new ProxyAgent('http://proxy.example.com:8080'))

Node.js 22.3+ — supports EnvHttpProxyAgent which reads HTTP_PROXY/HTTPS_PROXY env vars automatically:

import { EnvHttpProxyAgent, setGlobalDispatcher } from 'undici'
setGlobalDispatcher(new EnvHttpProxyAgent())

Node.js 24+ — native fetch respects env vars when NODE_USE_ENV_PROXY=1 is set:

NODE_USE_ENV_PROXY=1 HTTP_PROXY=http://proxy.example.com:8080 node app.js

Parallel Requests

const [users, posts] = await hurl.all([
  hurl.get('/users'),
  hurl.get('/posts'),
])

Isolated Instances

const api = hurl.create({
  baseUrl: 'https://api.example.com',
  auth: { type: 'bearer', token: 'my-token' },
  timeout: 5000,
  retry: 3,
})

await api.get('/users')

// Extend with overrides — inherits parent interceptors
const adminApi = api.extend({
  headers: { 'x-role': 'admin' }
})

Error Handling

hurl throws a HurlError on HTTP errors (4xx/5xx), network failures, timeouts, aborts, parse failures, open circuit breakers, and invalid URLs (an absolute URL that doesn't match baseUrl, or a protocol-relative URL). It never resolves silently on bad status codes.

Set throwOnError: false to receive 4xx/5xx responses without a throw:

const res = await hurl.get('/users', { throwOnError: false })
if (res.status === 404) {
  console.log('not found')
}
import hurl, { HurlError } from '@firekid/hurl'

try {
  await hurl.get('/users')
} catch (err) {
  if (err instanceof HurlError) {
    err.type        // 'HTTP_ERROR' | 'NETWORK_ERROR' | 'TIMEOUT_ERROR' | 'ABORT_ERROR' | 'PARSE_ERROR' | 'CIRCUIT_OPEN' | 'INVALID_URL'
    err.status      // 404
    err.statusText  // 'Not Found'
    err.data        // parsed error response body
    err.headers     // response headers
    err.requestId   // same ID as the request
    err.retries     // number of retries attempted
  }
}

TypeScript

type User = { id: number; name: string }

const res = await hurl.get<User[]>('/users')
res.data // User[]

const created = await hurl.post<User>('/users', { name: 'John' })
created.data.id // number

Debug Mode

Logs the full request (method, url, headers, body, query, timeout, retry config) and response (status, timing, headers, data) to the console. Errors and retries are also logged.

await hurl.get('/users', { debug: true })

Response Shape

type HurlResponse<T> = {
  data: T
  status: number
  statusText: string
  headers: Record<string, string>
  requestId: string
  timing: {
    start: number
    end: number
    duration: number
  }
  fromCache: boolean
}

Request Options

type HurlRequestOptions = {
  method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS'
  headers?: Record<string, string>
  body?: unknown
  query?: Record<string, string | number | boolean>
  timeout?: number
  retry?: RetryConfig | number
  auth?: AuthConfig
  proxy?: ProxyConfig
  cache?: CacheConfig
  circuitBreaker?: CircuitBreakerConfig
  signal?: AbortSignal
  followRedirects?: boolean
  onUploadProgress?: ProgressCallback
  onDownloadProgress?: ProgressCallback
  stream?: boolean
  throwOnError?: boolean
  debug?: boolean
  requestId?: string
  deduplicate?: boolean
  // native fetch options (see "Native fetch options")
  credentials?: 'omit' | 'same-origin' | 'include'
  mode?: 'cors' | 'no-cors' | 'same-origin'
  httpCache?: 'default' | 'no-store' | 'reload' | 'no-cache' | 'force-cache' | 'only-if-cached'
  referrer?: string
  referrerPolicy?: ReferrerPolicy
  integrity?: string
  keepalive?: boolean
  priority?: 'high' | 'low' | 'auto'
}

Environment Support

@firekid/hurl runs anywhere the Fetch API is available. No adapters, no polyfills needed.

RuntimeSupport
Node.js 18+✅
Cloudflare Workers✅
Vercel Edge Functions✅
Deno✅
Bun✅

Exports both ESM (import) and CommonJS (require).


Why Not Axios?

axios is 35KB, has no native edge runtime support, no built-in retry, no deduplication, no SSE, no circuit breaker, and carries XMLHttpRequest baggage from a different era of the web.

got dropped CommonJS in v12 — if your project uses require(), you're stuck on an old version.

ky is browser-first. No Node.js, no proxy, no streaming.

node-fetch is a polyfill. Node.js has had native fetch since v18. You don't need it anymore.

request has been deprecated since 2020.

@firekid/hurl is built for how Node.js and the edge work today — native fetch, zero dependencies, everything included, works everywhere.


API Reference

MethodDescription
hurl.get(url, options?)GET request → Promise<HurlResponse<T>>
hurl.post(url, body?, options?)POST request, body auto-serialized to JSON
hurl.put(url, body?, options?)PUT request
hurl.patch(url, body?, options?)PATCH request
hurl.delete(url, options?)DELETE request
hurl.head(url, options?)HEAD request → Promise<HurlResponse<void>>
hurl.options(url, options?)OPTIONS request
hurl.request(url, options?)Generic request, method from options
hurl.sse(url, options)Open an SSE stream → { close() }
hurl.all(requests)Run requests in parallel
hurl.create(defaults?)New isolated instance
hurl.extend(defaults?)New instance inheriting current defaults and interceptors
hurl.defaults.set(defaults)Set global defaults
hurl.defaults.get()Get current defaults
hurl.defaults.reset()Reset defaults to instance creation values
hurl.interceptors.request.use(fn)Register request interceptor
hurl.interceptors.response.use(fn)Register response interceptor
hurl.interceptors.error.use(fn)Register error interceptor
clearCache()Clear in-memory response cache
invalidateCache(key)Invalidate a URL or custom cache key (all identity variants)
getCircuitStats(key)Get state and failure count for a circuit breaker key

Contributors

HeavstalTech HeavstalTech — signal fix, cache hardening, test suite


Built with ♥️ by Firekid · MIT License

On this page
Why hurl?ComparisonInstallationQuick StartHTTP MethodsGlobal DefaultsAuthenticationRetry & BackoffTimeout & AbortSSE — Server-Sent EventsCircuit BreakerInterceptorsCachingRequest DeduplicationUpload & Download ProgressNative fetch optionsProxyParallel RequestsIsolated InstancesError HandlingTypeScriptDebug ModeResponse ShapeRequest OptionsEnvironment SupportWhy Not Axios?API ReferenceContributors

On this page

Why hurl?ComparisonInstallationQuick StartHTTP MethodsGlobal DefaultsAuthenticationRetry & BackoffTimeout & AbortSSE — Server-Sent EventsCircuit BreakerInterceptorsCachingRequest DeduplicationUpload & Download ProgressNative fetch optionsProxyParallel RequestsIsolated InstancesError HandlingTypeScriptDebug ModeResponse ShapeRequest OptionsEnvironment SupportWhy Not Axios?API ReferenceContributors