Typed HTTP control for every runtime

Ship through the storm.

A zero-runtime-dependency TypeScript HTTP client for React, React Native, Expo, browsers, Node.js, SSR, Deno, and Bun—with one consistent API.

npm install stormfetch
0 RUNTIME DEPENDENCIESTYPESCRIPT READYESM + COMMONJSNODE 18+

Built by Pradeep Kumar Sheoran (Stack Developer), BSG Technologies.
Visit BSG Technologies to meet, learn, contribute, discuss, or accept a coffee invitation.

Learn Here

80-function explorer.

Search by function name or purpose. Expand any entry for syntax, parameters, return value, example output, common errors, and a practical use case.

Showing all 80 functions

No matching function.
Try a task such as “upload”, “cache”, “offline”, or “request”.
Complete static function directory80 functions, readable without JavaScript

Client setup

fastApi
Ready starter client. Syntax: fastApi.get(url)
createStormFetchClient
Recommended reusable client. Syntax: createStormFetchClient(options?)
createFastApiClient
Backward-compatible factory alias. Syntax: createFastApiClient(options?)
createTypedStormFetchClient
Compile-time endpoint map typing. Syntax: createTypedStormFetchClient<T>(options?)
createReactNativeStormFetchClient
React Native and Expo-safe client. Syntax: createReactNativeStormFetchClient(options?)
createStormFetchServerClient
SSR and backend client. Syntax: createStormFetchServerClient(options?)

HTTP calls

request
Fully configurable request. Syntax: client.request(config)
fetch
Fetch-like normalized call. Syntax: client.fetch(url, config?)
get
Read a resource. Syntax: client.get<T>(url, config?)
post
Create or trigger an action. Syntax: client.post(url, data?, config?)
put
Replace a full resource. Syntax: client.put(url, data?, config?)
patch
Update selected fields. Syntax: client.patch(url, data?, config?)
delete
Remove a resource. Syntax: client.delete(url, config?)
head
Read headers without a body. Syntax: client.head(url, config?)
options
Inspect server capabilities. Syntax: client.options(url, config?)
query
Send an HTTP QUERY body. Syntax: client.query(url, data?, config?)
GET
Uppercase alias of get. Syntax: client.GET(url, config?)
POST
Uppercase alias of post. Syntax: client.POST(url, data?, config?)
PUT
Uppercase alias of put. Syntax: client.PUT(url, data?, config?)
PATCH
Uppercase alias of patch. Syntax: client.PATCH(url, data?, config?)
DELETE
Uppercase alias of delete. Syntax: client.DELETE(url, config?)
HEAD
Uppercase alias of head. Syntax: client.HEAD(url, config?)
OPTIONS
Uppercase alias of options. Syntax: client.OPTIONS(url, config?)
QUERY
Uppercase alias of query. Syntax: client.QUERY(url, data?, config?)

API and body helpers

postJson
Explicit JSON POST. Syntax: client.postJson(url, data?, config?)
postForm
URL-encoded form POST. Syntax: client.postForm(url, data, config?)
postMultipart
Multipart fields and files. Syntax: client.postMultipart(url, data, config?)
graphql
GraphQL operation. Syntax: client.graphql(query, variables?, config?)
batch
Parallel ordered requests. Syntax: client.batch(requests)
poll
Repeat GET until stopped. Syntax: client.poll(url, options)
resource
Build REST CRUD helpers. Syntax: client.resource(basePath)
contract
Build named typed endpoints. Syntax: client.contract(definition)
createFormData
Build multipart data. Syntax: createFormData(data)
createReactNativeFile
Create mobile file descriptor. Syntax: createReactNativeFile(uri, name, type)
isReactNativeFile
Validate mobile file descriptor. Syntax: isReactNativeFile(value)
download
Fetch and optionally save a file. Syntax: client.download(url, fileName?, config?)
saveBlob
Save a browser Blob. Syntax: saveBlob(blob, fileName?)
generateStormFetchServicesFromOpenApi
Generate TypeScript services. Syntax: generateStormFetchServicesFromOpenApi(document, options?)

DOM and scraping

getHtml
Fetch HTML as text. Syntax: client.getHtml(url, config?)
getXml
Fetch XML as text. Syntax: client.getXml(url, config?)
getDom
Fetch and parse a document. Syntax: client.getDom(url, config?)
parseDom
Parse existing markup. Syntax: parseDom(html, mimeType?)
scrape
Fetch and extract typed fields. Syntax: client.scrape(url, schema, config?)

Cache and debugging

clearCache
Clear memory cache. Syntax: client.clearCache(key?)
clearCacheAsync
Clear async storage too. Syntax: client.clearCacheAsync(key?)
invalidateTags
Remove tagged records. Syntax: client.invalidateTags(tags)
prefetch
Load and cache early. Syntax: client.prefetch(url, config?)
dehydrateCache
Export cache snapshot. Syntax: client.dehydrateCache()
hydrateCache
Restore cache snapshot. Syntax: client.hydrateCache(snapshot)
cacheKeys
Inspect stored keys. Syntax: client.cacheKeys()
cacheManager
Compact cache facade. Syntax: client.cacheManager.keys()
history
Read redacted history. Syntax: client.history()
clearHistory
Remove history. Syntax: client.clearHistory()
replay
Repeat recorded request. Syntax: client.replay(requestId)
toCurl
Create redacted curl command. Syntax: client.toCurl(idOrConfig)
toHAR
Export redacted HAR. Syntax: client.toHAR()
subscribe
Observe lifecycle events. Syntax: client.subscribe(listener)
policy
Apply route-matched defaults. Syntax: client.policy(match, config)
createStormFetchDevTools
Create headless inspector. Syntax: createStormFetchDevTools(client, options?)
mountStormFetchDevTools
Mount browser inspector. Syntax: mountStormFetchDevTools(client, element, options?)

Streams and live data

streamText
Read text chunks. Syntax: client.streamText(url, config?)
streamJson
Read one streamed JSON value. Syntax: client.streamJson(url, config?)
streamNdjson
Read JSON objects per line. Syntax: client.streamNdjson(url, config?)
sse
Connect to Server-Sent Events. Syntax: client.sse(url, options?)

Offline and mobile

flushOfflineQueue
Send queued mutations. Syntax: client.flushOfflineQueue()
offlineQueueSnapshot
Inspect pending and dead letters. Syntax: client.offlineQueueSnapshot()
retryOfflineRequest
Retry one offline request. Syntax: client.retryOfflineRequest(id)
discardOfflineRequest
Discard one offline request. Syntax: client.discardOfflineRequest(id)
retryOfflineBatch
Retry selected dead letters. Syntax: client.retryOfflineBatch(ids?)
reconcileOfflineRequest
Replace conflicted data and retry. Syntax: client.reconcileOfflineRequest(id, config)
createMemoryOfflineQueueStorage
In-memory queue storage. Syntax: createMemoryOfflineQueueStorage(initial?)
createJsonOfflineQueueStorage
JSON persistence adapter. Syntax: createJsonOfflineQueueStorage(storage, options?)
nativeUpload
Run native background upload. Syntax: client.nativeUpload(options)
nativeDownload
Run native background download. Syntax: client.nativeDownload(options)
startNativeUpload
Create pausable upload task. Syntax: client.startNativeUpload(options)
startNativeDownload
Create pausable download task. Syntax: client.startNativeDownload(options)
usePlugin
Install a verified plugin. Syntax: client.usePlugin(plugin)
removePlugin
Remove plugin by name. Syntax: client.removePlugin(name)
installedPlugins
Inspect installed plugin metadata. Syntax: client.installedPlugins()
dispose
Release listeners and plugins. Syntax: client.dispose()
01

Foundation lesson

createStormFetchClient(options?)

Purpose
Create one reusable client with shared base URL, timeout, authentication, retries, cache, and security rules.

Syntax

import { createStormFetchClient } from 'stormfetch';

const api = createStormFetchClient({
  baseURL: 'https://api.example.com',
  timeout: 10_000
});

Returns
A FastApiClient instance. Reuse it throughout the application.

ParameterRequiredMeaning
optionsNoShared URL, timeout, auth, retry, cache, security, adapters, and hooks.

Output
A configured client; it does not send a request until a request method is called.

Errors
Most invalid request settings surface when the client sends a request. Catch normalized errors with isStormFetchError.

Use case
One central api.ts for dashboards, shops, mobile apps, and SSR services.

02

First request

client.get<TData>(url, config?)

Purpose
Read a resource and receive typed data plus status, headers, request ID, and duration.

try {
  const response = await api.get<User>('/users/1');
  console.log(response.status, response.data.name);
} catch (error) {
  if (isStormFetchError(error)) {
    console.log(error.code, error.requestId);
  }
}

Expected output

200 Asha
ParameterRequiredMeaning
urlYesAPI path or an allowed absolute URL.
configNoParams, headers, cache, retry, timeout, signal, security, response type.

Returns
Promise<FastApiResponse<TData>>. Read your result from response.data.

Errors
Timeout, cancellation, network or DNS failure, rejected status, security policy block, invalid response, or body limit.

Use cases
Profiles, product lists, dashboards, settings, and search results.

03

Files without guesswork

postMultipart(url, data, config?)

Purpose
Send files and regular fields as multipart form data. Browser/Node can use File, Blob, or FormData; React Native uses a native file descriptor.

const body = api.createFormData({
  name: 'avatar',
  file: selectedFile
});

const result = await api.postMultipart(
  '/uploads', body
);

Example output

{ "uploaded": true, "id": "file_42" }
ParameterRequiredMeaning
urlYesUpload endpoint.
dataYesPlain object or FormData.
configNoProgress, signal, limits, headers, and request policy.

Returns
A normal response promise with the server upload result.

Errors
File/body-size policy, serialization depth, circular input, cancellation, network failure, or server validation.

Use cases
Avatars, invoices, documents, media, and mixed field/file forms.

Defense + recovery

Secure by configuration. Reliable by policy.

StormFetch provides application-layer controls and transport options. They strengthen client behavior; they do not replace secure server validation, authorization, TLS operations, or infrastructure controls.

Request boundary controls

Allowed and blocked hosts/CIDRs, HTTPS enforcement, private-network and cloud-metadata blocking, DNS checks, and method policies.

Failure recovery

Timeouts, cancellation, bounded retries, safe retry policy, deduplication, priority queues, circuit breaker, and offline mutations.

Observable behavior

Request IDs, durations, redacted history, replay, curl/HAR export, structured events, metrics, and an OpenTelemetry bridge.

Credential and content safety

XSRF origin checks, redirect credential stripping, payload limits, decompression guard, TLS/mTLS options, certificate pins, and redaction.

One package, focused entrypoints

Meet each runtime where it is.

The root export remains compatible, while focused entrypoints help apps import the surface they actually need.

React / Browserfrom 'stormfetch'Fetch by default; XHR for upload progress. Hooks receive your React object.
React Native / Expofrom 'stormfetch/react-native'Native-safe Fetch path with injected storage, online state, and file saver.
Node.js 18+from 'stormfetch/node'HTTP/1.1, HTTP/2, proxy, TLS, streams, redirects, and size controls.
SSRcreateStormFetchServerClientForward reviewed cookies and headers with guarded browser globals.
Deno / Bunfrom 'stormfetch'Runtime detection chooses the Fetch adapter automatically.

Before / now

What changed for developers?

Short answers for freshers and evaluators comparing a basic request wrapper with the package’s current public capabilities.

Before, I repeated CRUD functions in every service. What can I do now?

Before
Write list, detail, create, replace, update, and remove wrappers by hand.

Now
Use resource('/users') for standard REST helpers or contract(definition) for named typed endpoint functions.

Before, a failed request only said “network error”. What can I do now?

Before
Guess whether the cause was timeout, cancellation, DNS, status, parsing, or policy.

Now
Use isStormFetchError, stable STORMFETCH_ERROR_CODES, request IDs, redacted history, curl, and HAR export.

Before, mobile writes were lost when the connection dropped. What can I do now?

Before
Show an error and ask the user to repeat the action.

Now
Queue supported mutations, inspect pending and dead-letter work, retry a batch, discard work, or reconcile a conflict.

Before, each platform needed a different mental model. What can I do now?

Before
Mix browser-only globals, Node transports, and native file objects.

Now
Use focused entrypoints and runtime-aware adapters while keeping the same response and error model.

Does StormFetch automatically make every request secure and enterprise-ready?

Incorrect assumption
A client library can replace secure APIs, authorization, infrastructure, and deployment review.

Accurate answer
StormFetch supplies configurable controls and diagnostics. Your team still owns backend validation, secrets, permissions, trusted network policy, and production testing.

Release without the provenance trap

Two valid publishing paths.

Use CI for normal releases and trusted provenance. Local publishing is available for deliberate manual or emergency releases authenticated with your npm account, token, or OTP.

OR

Manual / emergency

Local PowerShell release

Run the full checks, authenticate with npm, then publish without automatic provenance.

npm publish --access public

Important: do not force "provenance": true in publishConfig. A local shell has no supported CI identity provider and npm will report Automatic provenance generation not supported for provider: null.