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

@applica-software-guru/iam-client

v5.0.96

Published

TypeScript client for the Applica IAM service. Provides a centralized, framework-agnostic `IamClient` with dedicated services for each entity, plus a React Admin adapter.

Readme

@applica-software-guru/iam-client

TypeScript client for the Applica IAM service. Provides a centralized, framework-agnostic IamClient with dedicated services for each entity, plus a React Admin adapter.

| Info | Details | | ---------- | -------------------------------------------- | | Version | 5.0.* | | Author | Roberto Conte Rosito (Applica) | | Repository | https://bitbucket.org/applicaguru/iam-client | | License | MIT |

Installation

npm install @applica-software-guru/iam-client

Quick Start

import { createIamClient } from '@applica-software-guru/iam-client';

const iam = createIamClient({
  apiUrl: 'https://server.com/api',
  apiKey: 'your-system-api-key' // optional, see "Authentication" below
});

await iam.auth.login({ username: '[email protected]', password: 'secret' });
const tenants = await iam.tenants.search({ keyword: 'test' });
const { user } = await iam.users.getById('user-id');
await iam.roles.register({ code: 'EDITOR', name: 'Editor', permissions: ['read', 'write'] });

Authentication

The IAM backend uses three security chains with different authentication requirements:

| Endpoints | Auth required | Notes | | ------------------------------------------------------- | --------------------------- | ---------------------------------------------------------------------------------------------------- | | /auth/** | None | Public endpoints (login, register, activate, recover) | | /tenants/** | System API key only | Requires x-api-key header matching the server's iam.api-key. Bearer tokens are not accepted. | | /users/**, /roles/**, /projects/**, /devices/** | Bearer token or API key | Any of these methods works: JWT from login, system API key, or tenant API key |

How authentication works in the client

When you set apiKey on the client, the x-api-key header is sent on every request. When a user is logged in, the Authorization: Bearer <token> header is also sent. The API key takes priority if both are present.

Scenario 1 — Server-side / admin scripts (no user login):

Use the system API key. This grants ROLE_SYSTEM and gives access to all endpoints including /tenants/**:

const iam = createIamClient({
  apiUrl: 'https://server.com/api',
  apiKey: 'your-system-api-key'
});

// No login needed — the API key authenticates all requests
await iam.tenants.register({ code: 'new-tenant', name: 'New Tenant' });
await iam.users.search({});
await iam.roles.register({ code: 'EDITOR', name: 'Editor' });

Scenario 2 — Browser app with logged-in user:

After login, the Bearer token authenticates requests to /users/**, /roles/**, /projects/**, /devices/**. No API key needed for these endpoints:

const iam = createIamClient({ apiUrl: 'https://server.com/api' });

await iam.auth.login({ username: '[email protected]', password: 'secret' });

// These work with the Bearer token from login
await iam.users.search({});
await iam.roles.register({ code: 'EDITOR', name: 'Editor' });
await iam.projects.search({});

// This will FAIL — /tenants/** requires the system API key, not a Bearer token
await iam.tenants.search({}); // ❌ 403

Scenario 3 — Browser app that also needs tenant management:

Provide both. The API key handles /tenants/**, the Bearer token handles everything else (or the API key handles everything):

const iam = createIamClient({
  apiUrl: 'https://server.com/api',
  apiKey: 'your-system-api-key'
});

await iam.auth.login({ username: '[email protected]', password: 'secret' });

// All endpoints work
await iam.tenants.search({});
await iam.users.search({});

What is the system API key and where to find it

The system API key is configured server-side in the IAM backend's application.yaml:

iam:
  api-key: 'your-secret-key-here'

This is the master key that grants ROLE_SYSTEM access. It is set by the server administrator and should be treated as a secret. The GodAuthenticationFilter on the backend reads the x-api-key header from incoming requests and compares it against this configured value.

There is no API endpoint to generate or rotate this key — it is a static configuration value managed at deployment time. To change it, update the iam.api-key property in the server configuration and restart the IAM service.

Important: The system API key gives unrestricted access to all endpoints. Never expose it in client-side browser code in production. It is intended for server-to-server communication, admin scripts, and development environments.

Tenant API keys

In addition to the system API key, each tenant can have its own API key (configured via setup.tenants[].api-key in application.yaml). A tenant API key authenticates requests to /users/**, /roles/**, /projects/**, /devices/** with the tenant's configured roles, but does not grant access to /tenants/**.

Architecture

IamClient
  ├── auth: AuthService          → /auth/*
  ├── users: UserService         → /users/*
  ├── tenants: TenantService     → /tenants/*
  ├── projects: ProjectService   → /projects/*
  ├── roles: RoleService         → /roles/*
  └── devices: DeviceService     → /devices/*

Documentation

| Topic | Description | | ----------------------------------------------------- | ------------------------------------------------- | | Getting Started | Installation, configuration, entry points | | Architecture | IamClient structure, HttpClient, project layout | | AuthService | Authentication, session, impersonation, PIN login | | UserService | User CRUD, roles, tenant/project assignment | | TenantService | Tenant CRUD (requires system API key) | | ProjectService | Project CRUD within tenants | | RoleService | Role and permission management | | DeviceService | Device management for PIN authentication | | Error Handling & Pagination | FailureResponse, error codes, pagination | | Storage | LocalStorage, MemoryStorage, custom IStorage | | React Admin | ApplicaAuthProvider, getClient() | | Type Reference | All TypeScript types and DTOs |

Scripts

npm run build     # Build with Vite
npm test          # Run tests with Vitest
npm run eslint    # Lint with ESLint
npm run format    # Format with Prettier

License

MIT