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

@gzl10/nexus-client

v0.12.6

Published

HTTP client for Nexus Backend with auth, correlation-id, and Socket.IO support

Readme

@gzl10/nexus-client

npm version npm downloads License: MIT

Warning: This project is currently in testing/experimental phase. Use at your own risk.

HTTP client for Nexus Backend with authentication, correlation-id tracking, and Socket.IO support. Built on Axios with automatic token refresh.

Repository: https://gitlab.gzl10.com/oss/nexus

Installation

pnpm add @gzl10/nexus-client

Usage

Singleton Pattern (Recommended)

import { configureClient, getClient } from '@gzl10/nexus-client'

// Configure once at app startup
await configureClient({
  baseURL: 'http://localhost:3000/api/v1',
  useHttpOnlyCookie: true,
  onUnauthorized: () => window.location.href = '/login'
})

// Use anywhere in your app
const client = getClient()

// Authentication
await client.auth.login('[email protected]', 'password')
const { user } = await client.auth.me()
await client.auth.logout()

// Users
const users = await client.users.findAll()
const user = await client.users.findById('uuid')

// Roles
const roles = await client.users.roles.findAll()

// Storage
const file = await client.storage.upload(fileInput)
const url = client.storage.getUrl(file.id)

// System
const modules = await client.system.getModules()
const plugins = await client.system.getPlugins()

// Custom HTTP requests
const data = await client.http.get('/custom-endpoint')
await client.http.post('/custom-endpoint', { foo: 'bar' })

// Socket.IO (real-time)
client.socket.on('notification', (payload) => console.log(payload))

Factory Pattern (Advanced)

For multiple instances or testing:

import { createNexusClient } from '@gzl10/nexus-client'

const client = await createNexusClient({
  baseURL: 'http://localhost:3000/api/v1'
})

Features

| Feature | Description | | ------- | ----------- | | Auto Token Refresh | Automatic 401 retry with token refresh | | Correlation ID | Request tracing with X-Correlation-ID | | Device Fingerprint | Browser fingerprinting for device tracking | | Type-safe | Full TypeScript support | | Socket.IO | Real-time event subscriptions | | CASL Integration | Client-side ability checking |

API Reference

Auth API

| Method | Description | | ------ | ----------- | | login(email, password, options?) | Login with credentials | | register(input) | Register new user | | logout() | Logout current device | | logoutAll() | Logout all devices | | me() | Get current user | | refresh() | Refresh access token | | forgotPassword(email) | Request password reset OTP | | resetPassword(email, otp, newPassword) | Reset password with OTP |

OTP Challenge Handling

When login fails due to OTP requirement (after multiple failed attempts), the error response includes otpSent: true:

try {
  await client.auth.login(email, password)
} catch (error) {
  if (error.response?.status === 403 && error.response?.data?.otpSent) {
    // Show OTP input, then retry with OTP
    await client.auth.login(email, password, { otp: '123456' })
  }
}

Users API

| Method | Description | | ------ | ----------- | | findAll(query?) | List users with pagination | | findOne(id) | Get user by ID | | create(input) | Create user | | update(id, input) | Update user | | delete(id) | Delete user | | roles.* | Roles sub-API |

Storage API

| Method | Description | | ------ | ----------- | | upload(file, options?) | Upload file | | delete(path) | Delete file | | getUrl(path) | Get file URL |

Configuration

| Option | Description | Default | | ------ | ----------- | ------- | | baseURL | API base URL | Required | | storage | Token storage | localStorage | | useHttpOnlyCookie | Use HTTP-only cookies | false | | onUnauthorized | 401 callback | - |

Development

pnpm build      # Build library
pnpm dev        # Build with watch
pnpm typecheck  # Type check
pnpm lint       # Linting
pnpm test       # Run tests

License

MIT