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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@luxojs/react

v0.1.0-dev.3

Published

Luxo React hooks — useLuxoQuery / useLuxoMutation with compile-time field tracking

Readme


Why Luxo + React?

The path from database to screen should be short. With Luxo, it is.

Write a React component. Access user.name and user.email. At compile time, Luxo traces those field accesses and injects $select: "name, email" into the API call. The server only serializes those two fields. The SQL only queries those two columns.

// You write:
function Profile({ id }) {
  const { data: user } = useLuxoQuery(
    () => transport.call('getUser', { id }),
    [id],
  )
  return <h1>{user.name}</h1>  // ← Luxo sees this at compile time
}

// What actually runs:
// → API: getUser(id: 1, $select: "name")
// → SQL: SELECT name FROM users WHERE id = 1

// Not SELECT * — just the one column you used.

No manual optimization. No over-fetching. No useCallback wrapper around field lists.

Every layer knows exactly what the next layer needs, because the compiler already figured it out.

Install

pnpm add @luxojs/react @luxojs/client

Quick Start

import { FetchTransport } from '@luxojs/client'
import { useLuxoQuery } from '@luxojs/react'

const transport = new FetchTransport('http://localhost:4000/luvia', {
  token: localStorage.getItem('token'),
})

function UserList() {
  const { data: users, loading, error, refetch } = useLuxoQuery(
    () => transport.call('listUsers', { page: 1 }),
    [],
  )

  if (loading) return <p>Loading...</p>
  if (error) return <p>Error: {error.message}</p>

  return (
    <ul>
      {users.map(u => <li key={u.id}>{u.name}</li>)}
      <button onClick={refetch}>Refresh</button>
    </ul>
  )
}

API

useLuxoQuery<T>(queryFn, deps)

Declarative — auto-executes on mount, re-fetches when deps change. Handles loading, error, race conditions, and memory leak prevention.

const { data, loading, error, refetch } = useLuxoQuery<User[]>(
  () => transport.call('listUsers', { page }),
  [page], // re-fetches when page changes
)

| Return | Type | Description | |--------|------|-------------| | data | T \| null | Response data, null while loading | | loading | boolean | true during fetch | | error | Error \| null | Error object if request failed | | refetch | () => Promise<void> | Manually trigger re-fetch |

useLuxoMutation<T>(mutationFn)

Imperative — only runs when you call mutate(). For writes: create, update, delete, login.

const { mutate, loading, error, reset } = useLuxoMutation<AuthResult>(
  (params) => transport.call('login', params),
)

async function handleLogin() {
  const result = await mutate({ username: 'admin', password: '123' })
  transport.setToken(result.token)
}

| Return | Type | Description | |--------|------|-------------| | mutate | (params) => Promise<T> | Execute the mutation | | loading | boolean | true during mutation | | error | Error \| null | Error if mutation failed | | reset | () => void | Clear error state |

LuxoProvider + useLuxoClient

Optional context-based transport injection:

import { LuxoProvider, useLuxoClient } from '@luxojs/react'

// Root
<LuxoProvider transport={transport}>
  <App />
</LuxoProvider>

// Any child component
function Dashboard() {
  const client = useLuxoClient()
  // client is the Transport instance
}

Full Example — With Vite Plugin

For compile-time $select injection, add @luxojs/vite-plugin:

pnpm add -D @luxojs/vite-plugin
// vite.config.ts
import { luxo } from '@luxojs/vite-plugin'

export default defineConfig({
  plugins: [react(), luxo({ schema: './luxo.schema.json' })],
})

Now every useLuxoQuery call automatically gets $select based on which fields your JSX renders. Zero config, zero manual work.

Ecosystem

| Package | Description | |---------|-------------| | @luxojs/client | Core transport + binary codec | | @luxojs/react | React hooks | | @luxojs/vite-plugin | Compile-time $select + typed client codegen | | luxo_client | Dart/Flutter SDK |

Links

License

Apache-2.0 · Copyright 2026 light-speak