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

@traffical/sdk-spec

v0.1.0

Published

Language-agnostic specifications for Traffical SDKs - schemas and test vectors

Readme

Traffical SDK Specification

Language-agnostic specifications for implementing Traffical SDKs.

Overview

This repository contains:

  • JSON Schemas - Type definitions for configuration bundles and events
  • Test Vectors - Deterministic test fixtures for validating SDK implementations

All Traffical SDKs must implement these specifications to ensure consistent behavior across languages.

Schemas

config-bundle.schema.json

The complete configuration bundle that SDKs fetch and cache. Contains:

  • Organization and project identifiers
  • Hashing configuration (unit key, bucket count)
  • Parameters with defaults and layer membership
  • Layers with policies and allocations
  • Conditions for targeting

events.schema.json

Event payloads sent to the Traffical API:

  • Exposure events (when a user is assigned to a variant)
  • Track events (custom user actions)

traffical-config.schema.json

Local project configuration file (.traffical/config.yaml) schema.

Test Vectors

The test-vectors/ directory contains deterministic test fixtures for validating SDK implementations.

Purpose

All Traffical SDKs must produce identical results for the same inputs:

  1. Hashing consistency - FNV-1a hash produces the same bucket across all implementations
  2. Resolution correctness - Parameter resolution follows the layered priority system
  3. Condition evaluation - Context predicates are evaluated identically

Fixture Structure

test-vectors/
├── fixtures/
│   ├── bundle_*.json        # Config bundles to test against
│   └── expected_*.json      # Expected outputs for each bundle
└── README.md

Running Tests

Each SDK implementation should:

  1. Load the bundle JSON
  2. For each test case:
    • Compute buckets and verify against expectedHashing
    • Resolve parameters and verify against expectedAssignments

Hash Function Reference

Traffical uses FNV-1a (32-bit) for bucket computation:

Input: unitKeyValue + ":" + layerId
Hash: FNV-1a(input) >>> 0
Bucket: hash % bucketCount

Example

  • Input: "user-abc:layer_ui"
  • FNV-1a hash: 2947556742
  • Bucket (mod 1000): 742

FNV-1a Algorithm

FNV_OFFSET_BASIS = 2166136261
FNV_PRIME = 16777619

hash = FNV_OFFSET_BASIS
for each byte in input:
    hash = hash XOR byte
    hash = hash * FNV_PRIME
return hash >>> 0  // Ensure unsigned 32-bit

SDK Implementations

| Language | Repository | |----------|------------| | JavaScript/TypeScript | traffical/js-sdk | | Go | Coming soon | | Java | Coming soon |

License

MIT License - see LICENSE for details.