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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@keak/sdk

v1.0.4

Published

Production-ready A/B testing and experimentation SDK for React applications with visual editing, source mapping, and real-time variant testing

Downloads

455

Readme

Keak SDK

Production-ready A/B testing and experimentation SDK for React applications with visual editing, source mapping, and real-time variant testing.

Quick Start

1. Install the SDK

npm install @keak/sdk

All dependencies are bundled with the SDK - no additional packages required.

2. Auto-Setup

The CLI setup runs automatically after installation. If it doesn't run, trigger it manually:

npx keak-setup

The installer will:

  • Detect your React framework (Next.js, CRA, Vite, etc.)
  • Find your main entry file (src/index.tsx, app/layout.tsx, etc.)
  • Add the KeakProvider wrapper automatically
  • Create a backup of your original file
  • Automatically configure source mapping (enables precise element-to-code mapping)

3. Next.js 15 Setup

If you're using Next.js 15, you'll need additional configuration to enable source mapping. See the Next.js 15 Setup Guide for detailed instructions.

Basic Usage

Setup KeakProvider

The auto-setup will add KeakProvider to your app. If you need to configure it manually:

import { KeakProvider } from '@keak/sdk';

function App() {
  return (
    <KeakProvider config={{ apiKey: 'your-api-key' }}>
      {/* Your app components */}
    </KeakProvider>
  );
}

Create Experiments

Wrap your content with Experiment and Variant components:

import { Experiment, Variant } from '@keak/sdk';

export default function HeroHome() {
  return (
    <section>
      <h1>Create stunning web experiences</h1>
      
      <Experiment name="hero-description">
        <Variant name="control">
          <p>Our landing page template works on all devices, so you only have to set it up once, and get beautiful results forever.</p>
        </Variant>
        <Variant name="treatment">
          <p>Tired of generic templates and endless tweaks? Our expertly crafted landing page solution guarantees pixel-perfect performance and stunning conversions on every device.</p>
        </Variant>
      </Experiment>
    </section>
  );
}

Using the Hook

You can also use the useExperiment hook for programmatic access:

import { useExperiment } from '@keak/sdk';

function MyComponent() {
  const { variant, track, isInExperiment } = useExperiment('my-experiment');
  
  return (
    <div>
      {variant === 'treatment' && <NewFeature />}
      <button onClick={() => track('button_clicked')}>
        Click me
      </button>
    </div>
  );
}

Project Structure

keak-sdk/
├── src/
│   ├── index.tsx          # Main SDK entry point
│   ├── toolbar/           # Floating toolbar components
│   └── scripts/           # Build and utility scripts
├── dist/                  # Built output (generated)
├── package.json           # Package configuration
└── tsconfig.json          # TypeScript configuration

Available Scripts

  • npm run build - Build the SDK for production
  • npm run dev - Build the SDK in watch mode for development
  • npm run prepublishOnly - Build before publishing

Troubleshooting

Common Issues

  1. Module not found errors: Ensure the SDK is properly installed and the auto-setup has completed
  2. TypeScript errors: Ensure your project has compatible TypeScript and React versions (React >=16.8.0)
  3. KeakProvider not found: Run npx keak-setup to ensure the provider is properly added to your entry file

Next.js 15 Issues

If you're using Next.js 15 and experiencing source mapping issues, refer to the Next.js 15 Setup Guide for detailed troubleshooting steps.

License

MIT