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

@mayhem93/nexxus-api-lib

v0.0.1

Published

API library for the Nexxus backend

Readme

@mayhem93/nexxus-api

REST API server for Nexxus - Authentication, device management, subscriptions, and model operations


Overview

The API package is the main entry point for client applications interacting with Nexxus. It provides RESTful endpoints for user authentication, device registration, subscription management, and CRUD operations on application models.

Key Responsibility: Validate requests and queue operations to worker pipeline (does not write app models directly to database).


Features

🔐 Authentication

  • Local Strategy: Username/password with JWT tokens
  • OAuth: Google authentication
  • Optional Mode: Disable authentication for development/testing
  • Device-specific Tokens: Each device gets unique JWT for security

📱 Device Management

  • Register devices for receiving real-time updates
  • Device information and status tracking
  • Multi-device support per user

📡 Subscription Management

  • Subscribe to channels (filtered or unfiltered)
  • Unsubscribe from channels
  • List active subscriptions per device

📦 Model Operations (CRUD)

  • Create: Queue model creation to Writer Worker
  • Read: Direct database queries with FilterQuery support
  • Update: Queue updates (JsonPatch) to Writer Worker
  • Delete: Queue deletion to Writer Worker

Important: App model writes are queued, not executed directly. Only User model writes happen immediately.


Architecture

Client Request
      ↓
   API Server (Express)
      ↓
   ┌──────────────────────┐
   │  Authentication      │ → JWT validation
   │  Request Validation  │ → Schema checking
   └──────────────────────┘
      ↓
   ┌──────────────────────┐
   │  Route Handlers      │
   │  - /user/*           │ → Direct DB writes
   │  - /device/*         │ → Redis operations
   │  - /subscription/*   │ → Redis operations
   │  - /model/:type      │ → Queue to Writer
   └──────────────────────┘
      ↓
   Message Queue (RabbitMQ)
      ↓
   Writer Worker (processes queued operations)

Routes

User Endpoints

  • POST /user/register - Create new user account
  • POST /user/login - Authenticate and get JWT token
  • GET /user/profile - Get current user information
  • PATCH /user/profile - Update user profile
  • DELETE /user/account - Delete user account

Device Endpoints

  • POST /device/register - Register device for push notifications
  • GET /device/:deviceId - Get device information
  • DELETE /device/:deviceId - Unregister device

Subscription Endpoints

  • POST /subscription - Subscribe to a channel
  • DELETE /subscription/:subscriptionId - Unsubscribe from channel
  • GET /subscription/device/:deviceId - List device subscriptions

Model Endpoints

  • POST /model/:type - Create model instance (queued)
  • GET /model/:type - Search/query model instances
  • GET /model/:type/:id - Get specific model instance
  • PATCH /model/:type/:id - Update model instance (queued, JsonPatch)
  • DELETE /model/:type/:id - Delete model instance (queued)

Configuration

{
  api: {
    port: 3000,
    auth: {
      enabled: true,
      strategies: ['local', 'google'],
      jwt: {
        secret: 'your-secret-key',
        expiresIn: '7d'
      },
      google: {
        clientId: 'your-google-client-id',
        clientSecret: 'your-google-client-secret',
        callbackURL: 'http://localhost:3000/auth/google/callback'
      }
    }
  }
}

Dependencies

  • Express - HTTP server framework
  • Passport - Authentication middleware
  • jsonwebtoken - JWT token generation/validation
  • @mayhem93/nexxus-core - Shared models, types, FilterQuery
  • @mayhem93/nexxus-database - Database operations
  • @mayhem93/nexxus-message-queue - Queue operations to workers
  • @mayhem93/nexxus-redis - Device and subscription storage

Status

🚧 Work in Progress - API surface may change as the project evolves.


Related Packages


License

MPL-2.0