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

@admiral-vrm/sdk-node

v1.0.2

Published

The Admiral SDK for NodeJS simplifies the process of using Admiral's APIs for applications written in server-side JavaScript.

Readme

Admiral SDK for NodeJS

Provides a simple interface for using Admiral's APIs for applications written in server-side JavaScript. Visit us at Admiral for more information.

Requirements

Node.js 16 or later (see engines in package.json).

Installation

Install the package to your project:

npm install @admiral-vrm/sdk-node
# or
yarn add @admiral-vrm/sdk-node

Configuration

  • propertyID (required): Your Admiral property ID (e.g. "A-1234-1").
  • tokenSecretKey (recommended when using Proxy): Secret used to sign visitor tokens. Set a strong, unique value in production; otherwise a default is used (not suitable for production). Can also be set via ADMIRAL_TOKEN_SECRET_KEY.
  • proxy: Optional. When using proxyAdmiral: true, set proxy.host (and optionally scheme, prefix).
  • protectOptions: Optional. For Protect/Partner API: partnerApiEndpoint, cacheTimeout. API credentials are configured inside the Protect integration (see examples).

Documentation

Admiral

The Admiral class is the main class for the Admiral SDK. It contains configuration for the Admiral object, such as the property ID, environment, enabling Protect and Proxy, and additional parameters.

export const admiral = new Admiral({
  propertyID: "A-1234-1",
  environment: "production",
  protect: true,
  proxyAdmiral: true,
  tokenSecretKey: process.env.ADMIRAL_TOKEN_SECRET_KEY, // recommended for production
  proxy: {
    host: "host.com",
    scheme: "https",
  },
});

The class provides the following methods:

getPossibleHandlers(): string[]

Returns an array of possible Admiral prefix handlers that can be used as prefixes when using the proxy functionality.

fetchSSRBootstraps(): Promise

Fetches Admiral bootstrap scripts for server-side rendering. Returns a promise containing:

  • admiral: Array of bootstrap script strings, each of these should be script tags

fetchBootstraps(): Promise<string[]>

Fetches Admiral bootstrap scripts. Returns a promise containing an array of script strings.

renderSSRBootstraps(payload: AdmiralSSRBootstrapWrapper, format: "html" | "react" = "react"): React.ReactNode[]

Renders the Admiral bootstrap scripts for server-side rendering as React components. Takes a bootstrap wrapper payload from fetchSSRBootstraps and returns an array of React script elements.

Parameters:

  • payload: Object containing array of bootstrap scripts under admiral key

handleRequestAsMiddleware(req: MiddlewareRequest): Promise

Handles Admiral middleware functionality including proxy requests and Protect functionality. Returns a promise containing the middleware response with:

  • response: Response object (optional)
  • headers: Headers object (optional)
  • cookies: ResponseCookies object (optional)

Parameters:

  • req: MiddlewareRequest object containing the incoming request details

Usage with Next.js and React

See the Next.js example for more information with a full example and documentation on how to use the Admiral SDK with Next.js.

The ProtectEmbed component is a React component that can be used to embed the Protect functionality into a React application.

Usage with Express.js / Node.js

See the Express.js example for more information with a full example and documentation on how to use the Admiral SDK with Express.

The ProtectHTMLEmbed library allows embedding HTML with Protect functionality into your application without using React.