Gathering detailed insights and metrics for lucent-flow
Gathering detailed insights and metrics for lucent-flow
Gathering detailed insights and metrics for lucent-flow
Gathering detailed insights and metrics for lucent-flow
A data fetching and state management library for Typescript
npm install lucent-flow
Typescript
Module System
Node Version
NPM Version
TypeScript (94.68%)
CSS (3.88%)
JavaScript (1.25%)
HTML (0.18%)
Total Downloads
674
Last Day
18
Last Week
587
Last Month
674
Last Year
674
MIT License
5 Stars
44 Commits
3 Forks
1 Watchers
16 Branches
5 Contributors
Updated on May 09, 2025
Minified
Minified + Gzipped
Latest Version
0.1.2
Package Id
lucent-flow@0.1.2
Unpacked Size
169.40 kB
Size
42.03 kB
File Count
78
NPM Version
10.8.2
Node Version
20.19.1
Published on
May 07, 2025
Cumulative downloads
Total Downloads
Last Day
100%
18
Compared to previous day
Last Week
574.7%
587
Compared to previous week
Last Month
0%
674
Compared to previous month
Last Year
0%
674
Compared to previous year
5
3
28
Lucent-Flow is a lightweight, blazing-fast state management and data-fetching library for React and TypeScript. Designed to be tiny, reactive, and composable — with middleware support like logging and persistence baked in.
1npm install lucent-flow
1// Import core functionality 2import { createStore } from "lucent-flow"; 3 4// Import middleware 5import { logger, devtools } from "lucent-flow"; 6 7// Create a store with middleware 8const useStore = createStore( 9 (set) => ({ 10 count: 0, 11 increment: () => set((state) => ({ count: state.count + 1 })), 12 }), 13 [logger(), devtools()] 14); 15 16// Use in your components 17function Counter() { 18 const { count, increment } = useStore(); 19 return <button onClick={increment}>Count: {count}</button>; 20}
See our documentation for detailed guides on:
LucentQuery provides a powerful and flexible way to handle data fetching with built-in caching, retries, and optimistic updates.
1// Import LucentQuery 2import { lucentQuery, QueryBuilder } from "lucent-flow"; 3 4// 1. Create a base query instance 5const api = lucentQuery({ 6 baseUrl: "https://api.example.com", 7 // Optional: Add default headers 8 headers: { 9 "Content-Type": "application/json", 10 }, 11}); 12 13// 2. Use in your store 14const usePostStore = createStore((set) => ({ 15 posts: [], 16 loading: false, 17 error: null, 18 19 fetchPosts: async () => { 20 set({ loading: true }); 21 try { 22 const result = await api({ 23 url: "/posts", 24 method: "GET", 25 }); 26 set({ posts: result.data, loading: false }); 27 } catch (error) { 28 set({ error, loading: false }); 29 } 30 }, 31}));
1// 1. Create a QueryBuilder instance 2const queryBuilder = new QueryBuilder("https://api.example.com"); 3 4// 2. Build complex queries 5const fetchPosts = async (filters) => { 6 const query = queryBuilder 7 .from("posts") 8 .where("status", "published") 9 .sort("createdAt", "desc") 10 .paginate(1, 10) 11 .include("author") 12 .build(); 13 14 return await api(query); 15}; 16 17// 3. Use in your component 18function PostList() { 19 const { posts, fetchPosts } = usePostStore(); 20 21 useEffect(() => { 22 fetchPosts({ status: "published" }); 23 }, []); 24 25 return ( 26 <div> 27 {posts.map((post) => ( 28 <div key={post.id}>{post.title}</div> 29 ))} 30 </div> 31 ); 32}
1const api = lucentQuery({ 2 baseUrl: "https://api.example.com", 3 // Cache configuration 4 cache: { 5 ttl: 5 * 60 * 1000, // 5 minutes 6 maxSize: 100, 7 }, 8 // Retry configuration 9 retry: { 10 maxAttempts: 3, 11 delay: 1000, 12 }, 13 // Request interceptors 14 requestInterceptors: [ 15 async (config) => { 16 // Add auth token 17 config.headers.Authorization = `Bearer ${token}`; 18 return config; 19 }, 20 ], 21 // Response interceptors 22 responseInterceptors: [ 23 async (response) => { 24 // Handle response 25 return response; 26 }, 27 ], 28});
For more details, see our API Documentation and Query Guide.
No vulnerabilities found.
No security vulnerabilities found.