Ffetch 2.0 – fetch() wrapper with timeouts, retries, circuit breaker (npmjs.com) 1 points by gkoos 10mo ago ↗ HN
[–] gkoos 10mo ago ↗ I got tired of reimplementing timeout/retry logic, so I built a thin fetch() wrapper.const client = createClient({ timeout: 5000, retries: 3, circuit: { threshold: 5, reset: 30000 } }) const response = await client('/api/data') // exactly like fetch()Drop-in replacement, zero deps, ~2KB. Has lifecycle hooks for auth/logging, exponential backoff with jitter, respects Retry-After headers, and proper AbortSignal composition. Preserves all native fetch behavior.https://github.com/gkoos/ffetchThoughts?
1 comment
[ 4.9 ms ] story [ 16.6 ms ] threadconst client = createClient({ timeout: 5000, retries: 3, circuit: { threshold: 5, reset: 30000 } }) const response = await client('/api/data') // exactly like fetch()
Drop-in replacement, zero deps, ~2KB. Has lifecycle hooks for auth/logging, exponential backoff with jitter, respects Retry-After headers, and proper AbortSignal composition. Preserves all native fetch behavior.
https://github.com/gkoos/ffetch
Thoughts?