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

@orchard9ai/crime-api-client

v0.1.1

Published

TypeScript client for Crime API generated with Orval

Readme

@orchard9ai/crime-api-client

TypeScript client for the Crime API, generated with Orval from the OpenAPI specification.

Installation

npm install @orchard9ai/crime-api-client
# or
pnpm add @orchard9ai/crime-api-client
# or
yarn add @orchard9ai/crime-api-client

Usage

Initialize the API Client

import { initializeCrimeApi, getAPIDocumentation } from '@orchard9ai/crime-api-client';

// Initialize with your API configuration
initializeCrimeApi({
  baseURL: 'http://localhost:24570',
  jwt: 'your-jwt-token', // Optional: for JWT authentication
  apiKey: 'your-api-key', // Optional: for API key authentication
  projectKey: 'your-project-key', // Optional: for project key authentication
  omnipotentKey: 'your-omnipotent-key', // Optional: for admin authentication
});

// Get the API functions
const api = getAPIDocumentation();

Authentication Types

The Crime API supports multiple authentication methods:

  1. JWT Authentication: Used for user sessions
  2. API Key Authentication: Used for server-side integrations
  3. Project Key Authentication: Used for project-specific access
  4. Omnipotent Authentication: Used for admin operations

Example API Calls

const { initializeCrimeApi, getAPIDocumentation } = require('@orchard9ai/crime-api-client');

// Initialize the client
initializeCrimeApi({
  baseURL: 'http://localhost:24570'
});

// Get API functions
const api = getAPIDocumentation();

async function example() {
  // Register a new user
  const registerResponse = await api.postAuthRegisterEmail({
    email: '[email protected]',
    password: 'securePassword123',
    companyName: 'My Company',
    companyWebsite: 'https://mycompany.com'
  });

  // Update client with JWT
  initializeCrimeApi({
    baseURL: 'http://localhost:24570',
    jwt: registerResponse.token
  });

  // Get current session
  const session = await api.getAuthSession();

  // Create a project
  const companyId = registerResponse.company.id;
  const project = await api.postCompaniesCompanyIdProjects(companyId, {
    name: 'My Project',
    description: 'Project description'
  });

  // Create a project key
  const projectKey = await api.postCompaniesCompanyIdProjectsIdKeys(
    companyId,
    project.id,
    { type: 'write' }
  );

  // Track events using project key authentication
  initializeCrimeApi({
    baseURL: 'http://localhost:24570',
    projectKey: projectKey.key
  });

  // Track an event
  await api.postEvents({
    code: 'page_view',
    endUserId: 'user-123',
    context: { page: '/dashboard' }
  });
}

Known Issues

  1. Event Registration: Before tracking events, they must be registered through the company events API.

API Documentation

The full API documentation is available in the OpenAPI specification file (openapi.yaml).

Available Endpoints

  • Authentication: Register, login, password reset, session management
  • Companies: Company management and settings
  • Projects: Project creation and management
  • Events: Event tracking and analytics
  • End Users: User management and insights
  • Goals & KPIs: Goal setting and KPI tracking
  • Personas: User persona management
  • Analytics: Insights and metrics
  • Team: Team member management
  • Admin: Administrative operations (requires omnipotent auth)

Docker Development

The Crime API runs in Docker. See the main API documentation for Docker setup:

cd ../api
docker-compose -f docker-compose.dev.yml up -d

Default ports:

  • API: http://localhost:24570
  • PostgreSQL: localhost:24572
  • ClickHouse: localhost:24573
  • Redis: localhost:24575

Development

Building the Package

pnpm install
pnpm run generate  # Regenerate from OpenAPI spec
pnpm run build     # Build the package

Running the Example

node example.js

Updating the OpenAPI Specification

  1. Update the openapi.yaml file
  2. Run pnpm run generate to regenerate the client code
  3. Run pnpm run build to build the package

License

MIT