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

@achado/client

v0.0.2

Published

Achado JavaScript client for web applications

Readme

@achado/client

Consumer-facing Achado JavaScript SDK package. This package provides a clean, simplified API for integrating Achado analytics into your web applications.

Overview

@achado/client is the recommended package for most users. It acts as the consumer-facing API layer (similar to 's js-client package) while importing functionality from the internal @achado/core package.

Installation

npm install @achado/client
# or
pnpm add @achado/client
# or
yarn add @achado/client

Quick Start

Basic Usage

import { AchadoClient, initialize } from '@achado/client';

// Option 1: Quick initialization (recommended)
const client = await initialize({
  apiKey: 'your-api-key-here',
  debug: true,
});

// Option 2: Manual initialization
const client = new AchadoClient({
  apiKey: 'your-api-key-here',
  debug: true,
});
await client.initialize();

// Track events
client.track('user_signed_up', {
  plan: 'pro',
  source: 'landing_page',
});

// Identify users
client.identify('user-123', {
  name: 'John Doe',
  email: '[email protected]',
  plan: 'pro',
});

With Plugins

import { AchadoClient } from '@achado/client';
import { WebAnalyticsPlugin } from '@achado/web-analytics';
import { SessionReplayPlugin } from '@achado/session-replay';

const webAnalytics = new WebAnalyticsPlugin({
  enablePageViews: true,
  enableClickTracking: true,
});

const sessionReplay = new SessionReplayPlugin({
  enabled: true,
  sampleRate: 0.1, // Record 10% of sessions
});

const client = new AchadoClient({
  apiKey: 'your-api-key-here',
  plugins: [webAnalytics, sessionReplay],
});

await client.initialize();

API Reference

Core Exports

// Main client class
export { AchadoClient } from '@achado/core';

// Type definitions
export type {
  AchadoConfig,
  AchadoEvent,
  AchadoUser,
  Logger,
  StorageAdapter,
  Plugin,
  PluginContext,
} from '@achado/core';

// Utility functions
export {
  generateId,
  generateSessionId,
  generateAnonymousId,
  getCurrentTimestamp,
} from '@achado/core';

// Global access and debugging
export { _getAchadoGlobal } from '@achado/core';

// Version information
export { SDK_VERSION, getClientMetadata } from '@achado/core';

// Plugin base class
export type { BasePlugin } from '@achado/core';

Convenience Functions

initialize(config: AchadoConfig): Promise<AchadoClient>

Quick initialization function that creates and initializes a client in one step:

const client = await initialize({
  apiKey: 'your-api-key',
  debug: true,
  userId: 'user-123',
});

instance(apiKey?: string): AchadoClient | undefined

Global instance accessor for debugging and multi-client scenarios:

// Get the default instance
const client = instance();

// Get a specific instance by API key
const specificClient = instance('your-api-key');

Global Access

For debugging purposes, you can access Achado instances globally:

// In browser console
window.__ACHADO__.instance(); // Get default instance
window.__ACHADO__.instance('your-api-key'); // Get specific instance
window.__ACHADO__.instances; // See all instances

TypeScript Support

This package includes full TypeScript definitions. All types are re-exported from the core package for convenience:

import type { AchadoConfig, AchadoEvent, AchadoUser } from '@achado/client';

const config: AchadoConfig = {
  apiKey: 'your-api-key',
  debug: true,
};

const user: AchadoUser = {
  userId: 'user-123',
  anonymousId: 'anon-456',
  sessionId: 'session-789',
  properties: {},
  traits: {},
};

Relationship to @achado/core

This package serves as the consumer-facing API layer:

  • @achado/client: Public API for end users (this package)
  • @achado/core: Internal infrastructure and implementation

This separation follows the same pattern as 's architecture:

  • 's js-client ≈ Achado' client
  • 's client-core ≈ Achado' core

Tree Shaking

This package is designed to be tree-shakable. Only the functions and classes you import will be included in your bundle:

// Only imports the client class and initialize function
import { AchadoClient, initialize } from '@achado/client';

// Only imports type definitions (zero runtime cost)
import type { AchadoConfig } from '@achado/client';

Examples

Advanced Usage

For advanced use cases, you can import directly from @achado/core:

// Direct core imports for advanced users
import { AchadoLogger, NetworkManager } from '@achado/core';

However, for most applications, the client package provides everything you need.

License

MIT