npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

lucent-flow

v0.1.2

Published

A lightweight, composable state & data library for React and TypeScript

Downloads

42

Readme

🔮 Lucent-Flow

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.


✨ Features

  • 🔄 Minimal global state management with React hooks
  • ⚙️ Custom middleware support (logging, persistence, etc.)
  • 🧠 Typesafe with full TypeScript support
  • 💾 AsyncStorage/localStorage persistence
  • 📦 Lightweight and tree-shakable
  • 🔌 Ready for server-side or native apps

📦 Installation

npm install lucent-flow

Quick Start

// Import core functionality
import { createStore } from "lucent-flow";

// Import middleware
import { logger, devtools } from "lucent-flow";

// Create a store with middleware
const useStore = createStore(
  (set) => ({
    count: 0,
    increment: () => set((state) => ({ count: state.count + 1 })),
  }),
  [logger(), devtools()]
);

// Use in your components
function Counter() {
  const { count, increment } = useStore();
  return <button onClick={increment}>Count: {count}</button>;
}

Core Features

  • State Management: Create stores with type-safe state and actions
  • Middleware Support: Built-in middleware for logging, devtools, and more
  • TypeScript First: Full type safety out of the box

Documentation

See our documentation for detailed guides on:

📡 LucentQuery - Data Fetching Made Simple

LucentQuery provides a powerful and flexible way to handle data fetching with built-in caching, retries, and optimistic updates.

Basic Usage

// Import LucentQuery
import { lucentQuery, QueryBuilder } from "lucent-flow";

// 1. Create a base query instance
const api = lucentQuery({
  baseUrl: "https://api.example.com",
  // Optional: Add default headers
  headers: {
    "Content-Type": "application/json",
  },
});

// 2. Use in your store
const usePostStore = createStore((set) => ({
  posts: [],
  loading: false,
  error: null,

  fetchPosts: async () => {
    set({ loading: true });
    try {
      const result = await api({
        url: "/posts",
        method: "GET",
      });
      set({ posts: result.data, loading: false });
    } catch (error) {
      set({ error, loading: false });
    }
  },
}));

Advanced Usage with QueryBuilder

// 1. Create a QueryBuilder instance
const queryBuilder = new QueryBuilder("https://api.example.com");

// 2. Build complex queries
const fetchPosts = async (filters) => {
  const query = queryBuilder
    .from("posts")
    .where("status", "published")
    .sort("createdAt", "desc")
    .paginate(1, 10)
    .include("author")
    .build();

  return await api(query);
};

// 3. Use in your component
function PostList() {
  const { posts, fetchPosts } = usePostStore();

  useEffect(() => {
    fetchPosts({ status: "published" });
  }, []);

  return (
    <div>
      {posts.map((post) => (
        <div key={post.id}>{post.title}</div>
      ))}
    </div>
  );
}

Features

  • Automatic Caching: Built-in cache management with configurable TTL
  • Optimistic Updates: Update UI before server response
  • Request Deduplication: Prevent duplicate requests
  • Retry Logic: Automatic retries for failed requests
  • Type Safety: Full TypeScript support
  • Query Builder: Chainable API for complex queries

Configuration Options

const api = lucentQuery({
  baseUrl: "https://api.example.com",
  // Cache configuration
  cache: {
    ttl: 5 * 60 * 1000, // 5 minutes
    maxSize: 100,
  },
  // Retry configuration
  retry: {
    maxAttempts: 3,
    delay: 1000,
  },
  // Request interceptors
  requestInterceptors: [
    async (config) => {
      // Add auth token
      config.headers.Authorization = `Bearer ${token}`;
      return config;
    },
  ],
  // Response interceptors
  responseInterceptors: [
    async (response) => {
      // Handle response
      return response;
    },
  ],
});

For more details, see our API Documentation and Query Guide.