
Nitro Fetch
Route existing Axios instances through react-native-nitro-fetch via a custom adapter so interceptors and instances stay intact while HTTP uses the native client.
Overview
Nitro-fetch is an agent skill for the Build phase that wires Axios to react-native-nitro-fetch through an explicit custom adapter without monkey-patching global fetch.
Install
npx skills add https://github.com/margelo/react-native-skills --skill nitro-fetchWhat is this skill?
- Custom Axios adapter backed by react-native-nitro-fetch instead of default fetch
- Preserves interceptors, create() instances, transformRequest, and cancelToken behavior
- Explicit adapter pin—do not monkey-patch globalThis.fetch
- Documents common wrong short adapter patterns from community configs
- Handles headers, body, cache no-store, response text parsing, and validateStatus concerns
- Documents explicit adapter boundary versus global fetch monkey-patching
Adoption & trust: 1 installs on skills.sh; 126 GitHub stars; 3/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
What problem does it solve?
Your React Native app uses Axios features but default fetch is slow or inconsistent, and patching globalThis.fetch breaks clarity and reliability.
Who is it for?
React Native developers already using axios and react-native-nitro-fetch who want a maintainable adapter implementation.
Skip if: Greenfield apps that can use fetch or nitro APIs directly with no axios layer, or web-only projects.
When should I use this skill?
User configures Axios in React Native with nitro-fetch, needs a custom adapter, or asks about interceptors and native HTTP integration.
What do I get? / Deliverables
Axios requests run through react-native-nitro-fetch via a pinned adapter while interceptors and instance APIs keep working.
- Production-oriented nitroAxiosAdapter implementation
- Axios instance config using the custom adapter at the instance boundary
Recommended Skills
Journey fit
How it compares
Integration recipe for Axios plus nitro-fetch—not a general REST client skill or MCP server.
Common Questions / FAQ
Who is nitro-fetch for?
Solo builders shipping React Native apps who standardize on Axios but want native HTTP performance from react-native-nitro-fetch.
When should I use nitro-fetch?
During Build when configuring HTTP for a React Native app and you need an axios adapter, baseURL/interceptors compatibility, or to avoid global fetch monkey-patches.
Is nitro-fetch safe to install?
Check the Security Audits panel on this page and review adapter code before it handles auth tokens or production API URLs.
SKILL.md
READMESKILL.md - Nitro Fetch
# Axios adapter for nitro-fetch ## Mental model Axios supports custom **adapters**: the last-mile function that actually makes the HTTP call. If you replace it with one backed by `react-native-nitro-fetch`, every axios feature you already use — interceptors, `create()` instances, `transformRequest`, `cancelToken` — keeps working, and every request now goes through the native client. Pin the adapter explicitly — **do not** try to route axios through nitro-fetch by swapping `globalThis.fetch`. Monkey-patching globals is fragile and hides which code is actually using nitro; an explicit adapter at the axios instance boundary is the right integration point. ## Common wrong answer The short adapter below circulates on GitHub (for example the Jellify app's [`src/configs/axios.config.ts`](https://github.com/Jellify-Music/App/blob/main/src/configs/axios.config.ts)): ```ts const nitroAxiosAdapter: AxiosAdapter = async (config) => { const response = await fetch(config.url!, { method: config.method?.toUpperCase(), headers: config.headers, body: config.data, cache: 'no-store', }); const text = await response.text(); const data = text.length > 0 ? JSON.parse(text) : null; const headers: Record<string, string> = {}; response.headers.forEach((v, k) => (headers[k] = v)); return { data, status: response.status, statusText: response.statusText, headers, config, request: null }; }; ``` It works for GET-returning-JSON and **nothing else**. Problems: - `config.url!` ignores `baseURL` and `params` — `axios.create({ baseURL: ... })` is silently a no-op. - `JSON.parse(text)` throws on `arraybuffer`/`blob`/HTML/empty bodies. - `validateStatus` is ignored — 500s resolve instead of throwing `AxiosError`. - `signal` and `cancelToken` are ignored — cancelled requests keep running natively. - `config.timeout` is set on the instance but never enforced by the adapter. - `cache: 'no-store'` is hard-coded, defeating HTTP caching across the whole app. - `config.headers` in axios 1.x is an `AxiosHeaders` instance — passing it raw can drop per-method defaults. - External abort listener is never removed — leaks on long-lived signals. ## Recipe — full adapter ```ts import axios, { AxiosAdapter, AxiosError, AxiosHeaders, AxiosResponse, InternalAxiosRequestConfig, } from 'axios'; import { fetch } from 'react-native-nitro-fetch'; const nitroAxiosAdapter: AxiosAdapter = async (config) => { const url = buildFullURL(config); // Merge axios's signal / cancelToken / timeout into one AbortController // so native code sees a single abort event. const controller = new AbortController(); const abortWith = (reason?: unknown) => controller.abort(reason); const external = config.signal; const onExternalAbort = () => abortWith((external as any)?.reason); if (external) { if (external.aborted) abortWith((external as any).reason); else external.addEventListener('abort', onExternalAbort, { once: true }); } config.cancelToken?.promise.then((cancel) => abortWith(cancel)); let timeoutId: ReturnType<typeof setTimeout> | undefined; if (config.timeout && config.timeout > 0) { timeoutId = setTimeout(() => { abortWith( new AxiosError( `timeout of ${config.timeout}ms exceeded`, AxiosError.ECONNABORTED, config, ), ); }, config.timeout); } try { const response = await fetch(url, { method: (config.method ?? 'get').toUpperCase(), headers: AxiosHeaders.from(config.headers as any).toJSON() as Record< string, string >, // `config.data` is already transformed by axios's transformRequest // pipeline by the time the adapter sees it (string / FormData / // URLSearchParams / Blob / ArrayBuffer). Don't re-