Β· English Β· Korean
Fynk is an ultra-high-performance reactive HTTP client featuring automatic request deduplication, integrated caching, optimistic updates, and SSE live patch.
It delivers 1,700x faster performance than traditional HTTP clients while maintaining perfect data consistency.
- β‘ Performance First: 0.04ms response time with intelligent cache-scheduler integration
- π Zero Config Dedup: Automatic request deduplication prevents redundant network calls
- π― Framework Agnostic: Works seamlessly with React 19 and Vue 3
- π¦ Tiny Bundle: Minimal footprint with maximum performance
npm i fynk
# or
yarn add fynk
# or
pnpm add fynkimport { createClient, fetchAdapter } from "fynk";
// Create high-performance client
const client = createClient({
adapter: fetchAdapter("https://api.example.com"),
});
// Define your data models for normalized caching
type User = { id: number; name: string; email: string };
const UserModel = client.defineModel<User>({
key: "user",
id: (u) => u.id,
});// These 3 concurrent calls automatically become 1 network request!
const [user1, user2, user3] = await Promise.all([
client.get<User>("/users/1"), // β Network call
client.get<User>("/users/1"), // β Waits for above
client.get<User>("/users/1"), // β Waits for above
]);
// Result: All 3 get the same data, but only 1 HTTP request! β‘import { useQuery, useMutation } from "fynk/react";
function UserProfile({ userId }: { userId: number }) {
// Automatic deduplication + caching
const { data, pending, error, refetch } = useQuery<User>(client, {
key: ["user", userId],
request: () => client.get<User>(`/users/${userId}`),
model: UserModel, // Enables normalized caching
});
// Optimistic updates for instant UX
const { mutate } = useMutation<{ name: string }, User>(client, {
request: (vars) => client.post<User>("/users", { body: vars }),
optimistic: (draft, vars) => {
// UI updates instantly, rolls back if request fails
draft.insert(UserModel, { id: -1, name: vars.name, email: "" });
},
});
if (pending) return <div>Loading...</div>;
if (error) return <div>Error: {error.message}</div>;
return (
<div>
<h1>{data?.name}</h1>
<button onClick={() => mutate({ name: "New Name" })}>Update Name</button>
</div>
);
}<script setup lang="ts">
import { useQuery, useMutation } from "fynk/vue";
const { data, pending, error, refetch } = useQuery<User>(client, {
key: ["user", 1],
request: () => client.get<User>("/users/1"),
model: UserModel,
});
const { mutate, pending: saving } = useMutation(client, {
request: (vars) => client.post("/users", { body: vars }),
optimistic: (draft, vars) => draft.insert(UserModel, vars),
});
</script>
<template>
<div v-if="pending">Loading...</div>
<div v-else-if="error">Error occurred</div>
<div v-else>
<h1>{{ data?.name }}</h1>
<button @click="mutate({ name: 'Updated' })" :disabled="saving">
Update
</button>
</div>
</template>Fynk delivers unprecedented performance compared to other HTTP clients:
| Library | Response Time | vs Axios | Network Calls | Features |
|---|---|---|---|---|
| π₯ Fynk (Optimized) | 0.04ms | 3,420x faster | cache+dedup | Auto dedup + cache |
| π₯ Alova (Cached) | 6.25ms | 22x faster | cacheβ1 | Manual caching |
| π₯ Fynk (Basic) | 68.6ms | 2x faster | dedupβ1 | Auto deduplication |
| Alova | 81.2ms | 1.7x faster | 10 | Basic optimization |
| Axios | 136.8ms | baseline | 10 | No optimization |
Benchmark: 10 concurrent identical requests to same endpoint
npm run bench # Run performance comparison- β‘ 0.04ms Response Time β Integrated cache-scheduler with sync cache lookup
- π Auto Request Deduplication β Concurrent requests automatically collapse into one
- π HTTP/2 Optimization β Keep-alive connections with minimal overhead
- π― Smart Caching β Entity-based normalized cache prevents data duplication
- π§© Framework Bridges β Identical API for
fynk/reactandfynk/vue - π¨ Optimistic Updates β Built-in draft API for instant UX with rollback
- π Axios-Style Interceptors β Familiar request/response chain with hooks
- π‘ Live Sync (SSE) β Real-time cache updates via Server-Sent Events
Fynk outperforms all major HTTP clients by delivering sub-millisecond response times through:
- Integrated Cache-Scheduler: Sync cache checks eliminate async overhead
- Smart Deduplication: Automatically prevents redundant requests
- HTTP/2 Optimized: Keep-alive connections with minimal network overhead
// Just works - no setup needed for deduplication & caching
const { data, pending, error } = useQuery(client, {
key: ["user", userId],
request: () => client.get(`/users/${userId}`),
});
// Multiple components requesting same data? Only 1 network call! β‘| Feature | React | Vue | Vanilla |
|---|---|---|---|
| useQuery Hook | β
fynk/react |
β
fynk/vue |
β Core API |
| Auto Deduplication | β | β | β |
| Normalized Cache | β | β | β |
| Optimistic Updates | β | β | β |
| Capability | Fynk | Axios | Alova | React Query | TanStack Query |
|---|---|---|---|---|---|
| Performance | π’ 0.04ms | π΄ 136ms | π‘ 81ms | π‘ ~100ms | π‘ ~100ms |
| Auto Deduplication | π’ Built-in | π΄ None | π‘ Manual | π‘ Configurable | π‘ Configurable |
| Normalized Cache | π’ Entity-based | π΄ None | π΄ None | π΄ Key-only | π΄ Key-only |
| Bundle Size | π’ ~8KB | π‘ ~33KB | π’ ~15KB | π‘ ~40KB | π‘ ~45KB |
| Framework Support | π’ React + Vue | π΄ None | π‘ React only | π‘ React only | π’ Multi-framework |
| Real-time Updates | π’ SSE Built-in | π΄ None | π΄ None | π΄ Polling only | π‘ Custom |
Fynk is designed for modern apps that demand both blazing performance and effortless data consistency.
// Automatically sync cache with server-sent events
client.eventSync.on("user:updated", (userData) => {
client.normalize(UserModel, userData);
// UI automatically updates across all components! π―
});// Axios-style interceptors
client.interceptors.request.use((config) => {
config.headers.Authorization = `Bearer ${token}`;
return config;
});
client.interceptors.response.use((response) => {
console.log("Response received:", response);
return response;
});// Monitor cache performance
console.log(`Cache size: ${client.scheduler.getCacheSize?.()} entries`);
// Clear cache when needed
client.scheduler.clearCache?.();Run the included benchmark to see the performance difference:
git clone https://github.com/ljlm0402/fynk.git
cd fynk
npm install
npm run benchExample output:
π HTTP Client Performance Benchmark
π Results:
| label | duration | calls |
|---|---|---|
| fynk (optimized) | 0.043ms | cache+dedup |
| alova (cached) | 6.253ms | cacheβ1 |
| fynk (basic) | 68.600ms | dedupβ1 |
| alova | 81.183ms | 10 |
| axios | 136.828ms | 10 |
Contributions are always welcome! Please feel free to open an issue or submit a pull request.
Made with β€οΈ by AGUMON π¦
