Skip to main content
Home

Small wrapper around fetch designed to perform more predictable and type-safe network requests, with zero dependencies.

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
70%
Published
9 months ago (1.1.0)

🌩️ Fetchtastic

Small wrapper around fetch designed to perform more predictable and type-safe network requests, with zero dependencies.

GitHub issues GitHub commit activity bundle.js npm npm

Features
🪶 Lightweight Less than 3kB gzipped
🧩 Composable Safely reuse previous configurations
😀 Intuitive Clean and easy to use API
🛡️ Type safe Strongly typed, written in TypeScript
🛠️ Isomorphic Compatible with modern browsers, Node.js and Deno
Well Tested Covered by unit tests

📖 Documentation

Visit fveracoechea.github.io/fetchtastic to view the full documentation.

⚡Getting Started

npm install fetchtastic

Fetchtastic is built on standard web APIs and runs everywhere fetch is available.

  • Modern browsers
  • Node.js >= v18
  • Deno
  • Service Workers
  • Netlify Edge Functions
  • Vercel Edge Functions
  • and more...

Basic usage

const api = fetchtastic('https://jsonplaceholder.typicode.com')
  .setOptions({ cache: 'default', mode: 'cors' })
  .appendHeader('Content-Type', 'application/json');

const blogPosts = await api
  .get('/posts')
  .setSearchParams({ page: 1, per_page: 12 })
  .json();

await api.url('/albums').post({ title: 'My New Album' }).resolve();

🕹️ Contributing

Contributions are welcome and highly appreciated. However, before you jump right into it, we would like you to review our Contribution Guidelines to make sure you have a smooth experience.

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@fveracoechea/fetchtastic

Import symbol

import * as fetchtastic from "@fveracoechea/fetchtastic";
or

Import directly with a jsr specifier

import * as fetchtastic from "jsr:@fveracoechea/fetchtastic";

Add Package

pnpm i jsr:@fveracoechea/fetchtastic
or (using pnpm 10.8 or older)
pnpm dlx jsr add @fveracoechea/fetchtastic

Import symbol

import * as fetchtastic from "@fveracoechea/fetchtastic";

Add Package

yarn add jsr:@fveracoechea/fetchtastic
or (using Yarn 4.8 or older)
yarn dlx jsr add @fveracoechea/fetchtastic

Import symbol

import * as fetchtastic from "@fveracoechea/fetchtastic";

Add Package

npx jsr add @fveracoechea/fetchtastic

Import symbol

import * as fetchtastic from "@fveracoechea/fetchtastic";

Add Package

bunx jsr add @fveracoechea/fetchtastic

Import symbol

import * as fetchtastic from "@fveracoechea/fetchtastic";