Small wrapper around fetch designed to perform more predictable and type-safe network requests.
✨ | Features | |
---|---|---|
🪶 | Lightweight | 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 |
Visit fetchtastic-docs.vercel.app to view the full documentation.
npm
npm install fetchtastic
pnpm
pnpm add fetchtastic
yarn
yarn add fetchtastic
deno
import { fetchtastic } from 'https://deno.land/x/fetchtastic/lib/mod.ts';
const api = new Fetchtastic('https://jsonplaceholder.typicode.com')
.setOptions({ cache: 'default', mode: 'cors' })
.headers({
Accept: 'application/json',
'Content-Type': 'application/json',
});
const blogData = await api
.searchParams({ page: 1, per_page: 12 })
.get('/posts')
.json(PostSchema.parse);
await api.post('/albums', { title: 'My New Album' }).resolve();
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.