v1.0 — Zero Dependencies, 4KB

Why fetch when you can just

GRAB?

Generate Request {to: API from: Browser}

Debugging fetch requests is a bitch. Make the switch!

Functionally Brilliant, Elegantly Simple. One function, no dependencies, minimalist syntax with more features than alternatives.

NPM VersionGitHub DiscussionsPRs Welcome
npm i grab-url
GRAB - Generate Request to API from Browser

GRAB is the FBEST Request Manager: Functionally Brilliant, Elegantly Simple Tool

23+ features packed into 4KB. No bloat, no dependencies, just pure functionality.

Auto-JSON Convert

Pass parameters and get response or error in JSON, handling other data types automatically.

Reactive Loading

Sets .isLoading=true on response object for React, Vue, Svelte — any framework works.

Debug Logging

Global log() prints colored JSON structure, response timing. Ctrl+I opens DevTools overlay.

Mock Server

Configure grab.mock for dev/testing. Supports conditional responses and delays.

Cancel Duplicates

cancelOngoingIfNew or cancelNewIfOngoing prevents request cascading.

Timeout & Retry

Configurable timeout (default 30s) with retryAttempts for auto-retry on failure.

CLI Testing

npm i -g grab-url for command line API testing with params and JSON payloads.

Request History

All requests stored in grab.log for debugging and analytics.

Infinite Scroll

Built-in pagination that auto-loads and merges next page on scroll.

Instance Config

Create separate instances with grab.instance() for different APIs.

Frontend Cache

Set cache: true for instant repeat requests from browser memory.

Regrab On Error

Auto-retry on timeout, window refocus, network change, or stale data.

Framework Agnostic

Works anywhere — React, Vue, Svelte, vanilla JS. No lifecycle hooks needed.

TypeScript Tooltips

Full type inference with hover tooltips and autocomplete for options.

Rate Limiting

Built-in rate limiting prevents multi-click cascading responses.

Request Hooks

Global onRequest interceptor for auth headers and request modification.

File Upload

FormData support with base64 conversion option for JSON APIs.

Jest Testing

Easy unit testing with mock setup and grab.log assertions.

Proxy Support

Node.js proxy support with HttpsProxyAgent for server-side requests.

Repeat & Poll

Repeat request X times or poll every X seconds for live updates.

Auto-Unzip

Automatically extracts ZIP responses into { data: { filename: content } }. Set unzip: false to disable.

DOM Parsing

Automatically parses HTML responses. Pass dom: "selector" for CSS extraction or dom: false to disable.

OpenAPI SDKs

Generate a typed client or MCP server from any OpenAPI spec — every endpoint gets caching, retries and mocks.

Simple Syntax, Powerful Results

Why fetch things when you can just GRAB? One function handles everything — JSON conversion, loading states, caching, retries, and more.

import grab from 'grab-url';

// Simple GET request
const data = await grab('users');

// POST with auto-JSON
await grab('users', {
  post: true,
  email: 'jane@example.com',
  age: 25
});

// GET with query parameters
const searchResults = await grab('search', {
  query: 'javascript',
  page: 1,
  limit: 10
});

How GRAB Compares

Stop trying to make fetch happen! See how GRAB stacks up against the competition.

FeatureGRABAxiosTanStackSWRAlovaKy
Size4KB13KB39KB4.2KB4KB4KB
Zero Dependencies
isLoading State
Auto JSON
Request Deduplication
Caching
Mock Testing
Rate Limiting
Auto Retry
Pagination Support
Debug Logging
Request History

Partial support or requires additional configuration

One Spec, Two Ways to Ship

Point either generator at any OpenAPI spec. Both send requests through grab, so every endpoint gets caching, retries, rate limiting, dedupe and mocks for free.

For your app

Typed Client SDK

Generate a fully typed TypeScript SDK from an OpenAPI spec with Hey API, wired to send every request through grab instead of axios or fetch.

npx heyapi-grab ./openapi.yaml ./src/client
Caching & mocksAutomatic retriesRate limiting

For AI agents

MCP Server

Generate a production-ready MCP server from the same spec with the mcp-use framework, so Claude, ChatGPT and other agents can call your API as a tool.

npx api2ai ./openapi.yaml ./my-mcp-server
Built-in inspectorAuth & approvalsRisk classification