v1.0 — Zero Dependencies, 4KB

Why fetch when you can just

GRAB?

Generate Request {to: API from: Browser}

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

20+ 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.

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

Ready to GRAB your data?

Debugging fetch requests is a bitch. Make the switch!

🌟 Star this repo so it will grow and get updates!

MIT License — Why fetch things when you can just GRAB?