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

kodiebase

v1.0.12

Published

JavaScript client for interacting with KodieBase

Readme

Kodiebase

A JavaScript client for interacting with the Kodiebase API. This client provides a simple interface for database operations, supporting both frontend applications (using auth tokens) and backend services (using API keys).

Getting Started

  1. Create a Kodiebase account at https://base.kodie.co.uk
  2. Create a new project in your dashboard
  3. Get your Project ID and API keys from the project settings

Installation

npm install kodiebase

Usage

Initialization

import { KodieClient } from 'kodiebase';
// OR
const { KodieClient } = require('kodiebase');

Authentication

The client supports two authentication methods: API keys (for backend services) and JWT tokens (for frontend applications).

Using API Keys

// Initialize with API key from your project settings (https://base.kodie.co.uk/dashboard/settings)
const client = new KodieClient({
  projectId: 'your-project-id',
  apiKey: 'your-api-key'
});

// The client will automatically use the API key for all requests
const users = await client.findAll('users');

Using JWT Authentication

// Initialize without authentication
const client = new KodieClient({
  projectId: 'your-project-id'
});

// Method 1: Login to get a token
const loginResult = await client.login({
  email: '[email protected]',
  password: 'securepassword'
});
// Token is automatically set after successful login

// Method 2: Initialize with an existing token
const client = new KodieClient({
  projectId: 'your-project-id',
  authToken: 'your-jwt-token'  // Pass an existing JWT token
});

// Method 3: Set token manually
client.setAuthToken('your-jwt-token');

// Check authentication status
console.log(client.isAuthenticated()); // true

// Get the current auth token
const token = client.getAuthToken();

// Make authenticated requests
const users = await client.findAll('users');

// Logout (clears the token)
client.logout();

User Registration

// Register a new user
const registerResult = await client.register({
  email: '[email protected]',
  password: 'securepassword',
  firstName: 'John',
  lastName: 'Doe'
});

// The client will automatically use the token returned from registration
console.log(client.isAuthenticated()); // true

Database Operations

Find Records

// Find all records
const users = await client.findAll('users', {
  status: 'active'
});

// Find one record
const user = await client.findOne('users', {
  id: 123
});

Create Records

const newUser = await client.create('users', {
  email: '[email protected]',
  name: 'John Doe',
  status: 'active'
});

Update Records

const updateResult = await client.update('users', 
  { status: 'inactive' },  // Data to update
  { id: 123 }             // Conditions
);

Delete Records

const deleteResult = await client.delete('users', {
  id: 123
});

API Reference

Constructor

new KodieClient(config)

Configuration options:

  • projectId (required): Your project ID
  • apiKey (optional): API key for backend service authentication
  • authToken (optional): JWT token for frontend authentication
  • baseURL (optional): API endpoint URL (defaults to your project's API endpoint)

Authentication Methods

register(data)

Registers a new user.

  • data.email: User's email
  • data.password: User's password
  • data.firstName: First name
  • data.lastName: Last name
  • Returns: Promise<{ success: boolean, data: { token: string } }>

login(credentials)

Authenticates a user.

  • credentials.email: User's email
  • credentials.password: User's password
  • Returns: Promise<{ success: boolean, data: { token: string } }>

logout()

Clears the authentication token.

isAuthenticated()

Checks if the client has a valid auth token.

  • Returns: boolean

getAuthToken()

Gets the current auth token.

  • Returns: string | null

Database Methods

findAll(table, conditions = {})

Finds all records matching the conditions.

  • table: Table/collection name
  • conditions: Object containing field-value pairs
  • Returns: Promise<{ success: boolean, data: any[] }>

findOne(table, conditions = {})

Finds a single record matching the conditions.

  • table: Table/collection name
  • conditions: Object containing field-value pairs
  • Returns: Promise<{ success: boolean, data: any }>

create(table, data)

Creates a new record.

  • table: Table/collection name
  • data: Object containing the record data
  • Returns: Promise<{ success: boolean, data: any }>

update(table, data, conditions)

Updates records matching the conditions.

  • table: Table/collection name
  • data: Object containing fields to update
  • conditions: Object containing field-value pairs
  • Returns: Promise<{ success: boolean }>

delete(table, conditions)

Deletes records matching the conditions.

  • table: Table/collection name
  • conditions: Object containing field-value pairs
  • Returns: Promise<{ success: boolean }>

Response Format

All methods return standardized responses:

{
  success: boolean,
  data?: any,
  error?: string
}

Error Handling

try {
  const result = await client.findOne('users', { id: 123 });
  if (!result.success) {
    console.error('Operation failed:', result.error);
    return;
  }
  console.log('User found:', result.data);
} catch (error) {
  console.error('API Error:', error.message);
}

License

MIT