{"id":45843973,"url":"https://github.com/sushilibdev/sushi-fetch","last_synced_at":"2026-03-07T10:03:00.700Z","repository":{"id":340773775,"uuid":"1165682433","full_name":"sushilibdev/sushi-fetch","owner":"sushilibdev","description":"Modern data fetching made simple: caching, deduplication, retries, revalidation, and middleware in one tiny library.","archived":false,"fork":false,"pushed_at":"2026-02-27T03:53:05.000Z","size":78,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-27T05:36:42.738Z","etag":null,"topics":["api-client","cache","data-fetching","fetch","http-client","javascript","swr","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sushilibdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-24T12:36:07.000Z","updated_at":"2026-02-27T03:53:09.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/sushilibdev/sushi-fetch","commit_stats":null,"previous_names":["sushilibdev/sushi-fetch"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/sushilibdev/sushi-fetch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sushilibdev%2Fsushi-fetch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sushilibdev%2Fsushi-fetch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sushilibdev%2Fsushi-fetch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sushilibdev%2Fsushi-fetch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sushilibdev","download_url":"https://codeload.github.com/sushilibdev/sushi-fetch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sushilibdev%2Fsushi-fetch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30209820,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T05:23:27.321Z","status":"ssl_error","status_checked_at":"2026-03-07T05:00:17.256Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-client","cache","data-fetching","fetch","http-client","javascript","swr","typescript"],"created_at":"2026-02-27T01:09:06.552Z","updated_at":"2026-03-07T10:03:00.695Z","avatar_url":"https://github.com/sushilibdev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# 🍣 sushi-fetch\n**The lightweight, reactive powerhouse for modern data fetching.**\n\n[![NPM Version](https://img.shields.io/npm/v/sushi-fetch?color=ff4757\u0026logo=npm\u0026style=for-the-badge)](https://www.npmjs.com/package/sushi-fetch)\n[![Bundle Size](https://img.shields.io/bundlephobia/minzip/sushi-fetch?color=2f3542\u0026label=Gzipped\u0026style=for-the-badge)](https://bundlephobia.com/package/sushi-fetch)\n[![Downloads](https://img.shields.io/npm/dm/sushi-fetch?color=5352ed\u0026style=for-the-badge)](https://www.npmjs.com/package/sushi-fetch)\n[![Stars](https://img.shields.io/github/stars/sushilibdev/sushi-fetch?style=for-the-badge\u0026color=eccc68)](https://github.com/sushilibdev/sushi-fetch)\n\n\u003cp align=\"center\"\u003e\n  \u003cb\u003eTiny footprint. Zero dependencies. Enterprise-grade features.\u003c/b\u003e\n  \u003cbr /\u003e\n  Stop shipping 15kB+ of \u003ccode\u003eaxios\u003c/code\u003e or \u003ccode\u003etanstack-query\u003c/code\u003e for simple apps. \n  \u003cbr /\u003e\n  Get Smart Batching, Offline Persistence, SWR, and Reactivity in \u003cb\u003e~3kB (Gzipped)\u003c/b\u003e.\n\u003c/p\u003e\n\n[Explore Docs](#-api-reference) • [Report Bug](https://github.com/sushilibdev/sushi-fetch/issues) • [Request Feature](https://github.com/sushilibdev/sushi-fetch/issues)\n\n\u003c/div\u003e\n\n---\n\n## 🚀 The v1.0.0 Evolution\n\nModern web apps need more than just `fetch()`. They need to survive poor networks, deduplicate aggressive UI renders, and keep data fresh automatically. Usually, you'd have to choose between \"too barebones\" (native fetch) or \"too heavy\" (GraphQL clients/TanStack).\n\n**sushi-fetch v1.0.0** is the \"Sweet Spot\". We bring Silicon Valley-grade data synchronization to a ridiculously small footprint.\n\n### ✨ The \"Secret Sauce\" (Features)\n\n* 🚦 **[NEW] Smart Batching (Event Loop Deduplication)**: Prevents network spam. 10 identical requests in the same tick? Only 1 hits the server.\n* 💾 **[NEW] Offline Persistence**: Automatically dumps cache to `localStorage` (or custom adapters) and hydrates instantly on reload.\n* 📡 **[NEW] Auto-Polling \u0026 Focus Revalidation**: Keeps your UI feeling \"alive\". Data refetches automatically when the user switches tabs or on a set interval.\n* 🧠 **Smart Memory Cache**: Built-in TTL, sliding expiration, and LRU eviction.\n* 🔄 **SWR (Stale-While-Revalidate)**: Instant UI updates with background synchronization.\n* ⚡ **Reactive Pub/Sub**: Real-time state sync across your entire UI without needing Redux or Pinia.\n* 📈 **Native Streaming**: Simple progress tracking for big uploads/downloads.\n* 🔁 **Smart Retries**: Fixed or Exponential Backoff strategies out of the box.\n* 🪶 **Zero Dependencies**: Pure, tree-shakable, strongly-typed TypeScript.\n\n---\n\n## 📦 Installation\n\n```bash\nnpm install sushi-fetch  # or pnpm, yarn, bun\n```\n\n---\n\n## 🛠 The Magic (Quick Starts)\n\n**1. The \"Indestructible\" Request (v1.0.0)**\n\nCombine our most powerful features in a single, elegant call.\n\n```ts \nimport { sushi } from 'sushi-fetch';\n\nconst data = await sushi.get('/api/dashboard', {\n  batch: true,              // Groups simultaneous calls into one network request\n  revalidateOnFocus: true,  // Silently updates data when user returns to the tab\n  pollInterval: 10000       // Keeps data fresh every 10 seconds\n});\n```\n\n**2. Offline Persistence (Zero-Config Hydration)**\n\nKeep your app working even when the signal drops. `sushi-fetch` handles the storage and hydration automatically.\n\n```ts\nimport { SushiCache } from 'sushi-fetch';\n\n// Setup persistent cache (Uses localStorage by default in browsers)\nconst persistentCache = new SushiCache({ \n  persistKey: 'my-app-offline-db' \n});\n\n// Next time the user opens the app, data loads from disk in 0ms!\n```\n\n**3. The Power of SWR (Stale-While-Revalidate)**\n\nShow the old data immediately, fetch the new one in the background. Your UI feels 10x faster.\n\n```ts\nconst { data } = await sushi.get('/api/stats', { revalidate: true });\n```\n\n**4. Real-time Progress (Streaming)**\n\nTracking download/upload progress without messing with raw Streams.\n\n```ts\nawait sushi.get('/api/large-file', {\n  onProgress: ({ percentage }) =\u003e console.log(`Downloading: ${percentage}%`),\n});\n```\n\n---\n\n## 📊 Comparison: No Bloat, Just Speed\n\n| Feature | Native Fetch | Axios | **Sushi-Fetch** |\n| :--- | :--- | :--- | :--- |\n| **Size (Gzip)**| ~0kB | ~5.5kB | **~3.5kB** |\n| **Caching** | ❌ | ❌ | ✅ (Built-in) |\n| **Smart Batching** | ❌ | ❌ | ✅ (Auto) |\n| **Offline Sync** | ❌ | ❌ | ✅ |\n| **SWR** | ❌ | ❌ | ✅ |\n| **Revalidation** | ❌ | ❌ | ✅ (On Focus / Interval) |\n| **Streaming** | ❌ (Hard) | ❌ | ✅ (Simple) |\n\n---\n\n## ⚙️ Advanced: Global Instance \u0026 Interceptors\n\nCreate a pre-configured instance for your specific API, complete with middleware and auth interception.\n\n```ts\nimport { createSushi } from 'sushi-fetch';\n\nconst api = createSushi({\n  baseUrl: '[https://api.myapp.com/v1](https://api.myapp.com/v1)',\n  interceptors: {\n    request: async (url, options) =\u003e {\n      options.token = getMySecretToken(); // Automatically attaches Bearer token\n      return options;\n    }\n  }\n});\n\n// Usage anywhere in your app:\nconst user = await api.get('/profile');\n```\n\n---\n\n## 🤝 Support the Movement\n\nThis project is a labor of love for efficient, high-performance code. If sushi-fetch helped you build a faster app, please consider:\n\n- Giving it a **Star** ⭐ (It helps others find the library!)\n- Submitting an **Issue** if you find a bug.\n- Sharing it on **Twitter/X** or **LinkedIn.**\n\n---\n\n## 📄 License\n\nMIT © sushilibdev","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsushilibdev%2Fsushi-fetch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsushilibdev%2Fsushi-fetch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsushilibdev%2Fsushi-fetch/lists"}