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

@kontenbase/sdk

v0.10.5

Published

Kontenbase SDK

Readme

Kontenbase SDK

This is the Official Node JS and Browser client/library for Kontenbase API. Visit https://kontenbase.com. More information about the product and see documentation at http://docs.kontenbase.com for more technical details.

API Documentation

Please check Kontenbase API Reference.

Installation

Node.js

To install kontenbase in a node project:

npm install --save @kontenbase/sdk

Usage

Configure package with your account's API key obtained from your Kontenbase Dashboard.

const { KontenbaseClient } = require('@kontenbase/sdk');

const kontenbase = new KontenbaseClient({
  apiKey: '*******************',
});

Authentication

Use kontenbase auth services for manage your user.

Register

const { user, token, error } = await kontenbase.auth.register({
  firstName: 'Ega',
  lastName: 'Radiegtya',
  email: '[email protected]',
  password: 'password',
});

Login

const { user, token, error } = await kontenbase.auth.login({
  email: '[email protected]',
  password: 'password',
});

User

const { user, error } = await kontenbase.auth.user();
// Get user with filter:
// lookup
const { user, error } = await kontenbase
  .auth
  .user({ filterKey: filterValue, ... });

Update

const { user, error } = await kontenbase.auth.update({ firstName: 'Ega' });

Logout

const { user, token, error } = await kontenbase.auth.logout();

Database

Create

const { data, error } = await kontenbase.service('posts').create({
  name: 'Post 1',
  notes: 'Hello kontenbase',
});

Create Many

const { data, error } = await kontenbase.service('posts').createMany([
  {
    name: 'Post 1',
    notes: 'Hello kontenbase',
  },
  {
    name: 'Post 2',
    notes: 'Hello world',
  },
]);

Get

const { data, error } = await kontenbase
  .service('posts')
  .getById('605a251d7b8678bf6811k3b1');
// Get record with filters:
// select
// lookup
const { data, error } = await kontenbase
  .service('posts')
  .getById('605a251d7b8678bf6811k3b1', { filterKey: filterValue, ... });

Update

const { data, error } = await kontenbase
  .service('posts')
  .updateById('605a251d7b8678bf6811k3b1', {
    notes: 'Hello world',
  });

Update Many

const { data, error } = await kontenbase.service('posts').updateMany([
  {
    _id: '605a251d7b8678bf6811k3b1',
    notes: 'Hello world',
  },
  {
    _id: '605a251d7b8678bf6811k3b2',
    notes: 'Hello kontenbase',
  },
]);

Delete

const { data, error } = await kontenbase
  .service('posts')
  .deleteById('605a251d7b8678bf6811k3b1');

Delete Many

const { data, error } = await kontenbase
  .service('posts')
  .deleteMany(['605a251d7b8678bf6811k3b1', '605a251d7b8678bf6811k3b2']);

Link

const { data, error } = await kontenbase
  .service('posts')
  .link('605a251d7b8678bf6811k3b1', {
    categories: '61d26e8e2adb12b85c33029c',
  });

Unlink

const { data, error } = await kontenbase
  .service('posts')
  .unlink('605a251d7b8678bf6811k3b1', {
    categories: '61d26e8e2adb12b85c33029c',
  });

Find

const { data, error } = await kontenbase.service('posts').find();
// sort
// 1 = ascending
// -1 = descending
const { data, error } = await kontenbase
  .service('posts')
  .find({ sort: [{ name: 1 }] });
// skip
const { data, error } = await kontenbase.service('posts').find({ skip: 10 });
// limit
const { data, error } = await kontenbase.service('posts').find({ limit: 10 });
// select
const { data, error } = await kontenbase
  .service('posts')
  .find({ select: ['name'] });
// lookup into multiple link to record fields
const { data, error } = await kontenbase
  .service('posts')
  .find({ lookup: ['categories'] });
// lookup into all link to record fields
const { data, error } = await kontenbase.service('posts').find({ lookup: '*' });
// lookup into all link to record fields but only show the ids
const { data, error } = await kontenbase
  .service('posts')
  .find({ lookup: { _id: '*' } });
// lookup into all link to record fields and show all data
const { data, error } = await kontenbase
  .service('posts')
  .find({ lookup: { '*': '*' } });
// where
const { data, error } = await kontenbase
  .service('posts')
  .find({ where: { name: 'Ega' } });
// not equal
const { data, error } = await kontenbase
  .service('posts')
  .find({ where: { name: { $ne: 'Ega' } } });
// contains
const { data, error } = await kontenbase
  .service('posts')
  .find({ where: { name: { $contains: 'Ega' } } });
// not contains
const { data, error } = await kontenbase
  .service('posts')
  .find({ where: { name: { $notContains: 'Ega' } } });
// include
const { data, error } = await kontenbase
  .service('posts')
  .find({ where: { name: { $in: ['Ega'] } } });
// not include
const { data, error } = await kontenbase
  .service('posts')
  .find({ where: { name: { $nin: ['Ega'] } } });
// less then
const { data, error } = await kontenbase
  .service('posts')
  .find({ where: { total: { $lt: 10 } } });
// less then equal
const { data, error } = await kontenbase
  .service('posts')
  .find({ where: { total: { $lte: 10 } } });
// greater then
const { data, error } = await kontenbase
  .service('posts')
  .find({ where: { total: { $gt: 10 } } });
// greater then equal
const { data, error } = await kontenbase
  .service('posts')
  .find({ where: { total: { $gte: 10 } } });

Count

// count all records
const { data, error } = await kontenbase.service('posts').count();
// count with filters
const { data, error } = await kontenbase
  .service('posts')
  .count({ filterKey: filterValue, ... });

Storage

Upload

// from client
const file = event.target.files[0];
const { data, error } = await kontenbase.storage.upload(file);
// from server
const file = req.files[0];
const { data, error } = await kontenbase.storage.upload(
  file.buffer,
  file.originalname,
);

Realtime

Event

  • *
  • CREATE_RECORD
  • UPDATE_RECORD
  • DELETE_RECORD

Subscribe

kontenbase.realtime.subscribe('posts', { event: '*' }, (message) => {
  if (message.error) {
    console.log(message.error);
    return;
  }

  console.log(message.event, message.payload);
});

Unsubscribe

const key = await kontenbase.realtime.subscribe(
  'posts',
  { event: '*' },
  (message) => {
    if (message.error) {
      console.log(message.error);
      return;
    }

    console.log(message.event, message.payload);
  },
);

kontenbase.realtime.unsubscribe(key);

Field

Find

const { data, error } = await kontenbase.service('posts').field.find();

Get

const { data, error } = await kontenbase
  .service('posts')
  .field.getById('605a251d7b8678bf6811k3b1');

CDN

You can now use plain <script>s to import kontenbase from CDNs, like:

<script src="https://cdn.jsdelivr.net/npm/@kontenbase/sdk"></script>

Then you can use it from a global kontenbase variable:

<script>
  const { createClient } = kontenbase;
  const client = createClient({
    apiKey: '*******************',
  });

  client
    .service('posts')
    .find()
    .then((res) => {
      if (res.error) {
        console.log(res.error);
        return;
      }

      console.log(res);
    });
</script>