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

@bahterabase/sdk-js

v0.1.0

Published

Official BahteraBase Client SDK for JavaScript and TypeScript (PostgreSQL, Auth, Storage, Realtime, Edge Functions, AI & Vectors)

Downloads

87

Readme

🚢 @bahterabase/sdk-js

Official JavaScript & TypeScript client library for BahteraBase — The Open-Source-Friendly Backend-as-a-Service (PostgreSQL, Auth, Storage, Realtime, Edge Functions, AI & Vectors).

npm version License


📦 Installation

Install via npm:

npm install @bahterabase/sdk-js

Or using yarn / pnpm / bun:

# Yarn
yarn add @bahterabase/sdk-js

# pnpm
pnpm add @bahterabase/sdk-js

# Bun
bun add @bahterabase/sdk-js

Install directly from GitHub:

npm install github:kangpcode/bahterabase#workspace=@bahterabase/sdk-js

⚡ Quick Start

import { createClient } from '@bahterabase/sdk-js';

// 1. Initialize the client
const bahtera = createClient(
  'https://your-project.bahterabase.io',
  'bb_anon_your_public_anon_key'
);

// 2. Database Query with Filter & Pagination
const { data: users, error } = await bahtera
  .from('profiles')
  .select('id, full_name, email, role')
  .eq('role', 'admin')
  .order('created_at', { ascending: false })
  .limit(10);

if (error) {
  console.error('Error fetching users:', error);
} else {
  console.log('Users:', users);
}

🧩 Features & Modules

1. 🔐 Authentication (bahtera.auth)

// Sign Up with Email & Password
const { data, error } = await bahtera.auth.signUp({
  email: '[email protected]',
  password: 'super-secure-password',
});

// Sign In
const { session, user } = await bahtera.auth.signInWithPassword({
  email: '[email protected]',
  password: 'super-secure-password',
});

// Get current user / session
const currentUser = bahtera.auth.getUser();

// Sign Out
await bahtera.auth.signOut();

2. 🗄️ Database CRUD (bahtera.from(tableName))

// Insert
const { data: inserted } = await bahtera.from('posts').insert({
  title: 'Hello BahteraBase',
  content: 'Building modern fullstack apps with ease',
  published: true,
});

// Update
const { data: updated } = await bahtera.from('posts')
  .update({ published: false })
  .eq('id', 'post_123');

// Delete
const { data: deleted } = await bahtera.from('posts')
  .delete()
  .eq('id', 'post_123');

// Call Postgres Stored Procedures (RPC)
const { data: report } = await bahtera.rpc('calculate_monthly_revenue', {
  year: 2026,
  month: 9,
});

3. 📦 Object Storage (bahtera.storage)

// Upload a file to bucket
const { data: file, error } = await bahtera.storage
  .from('avatars')
  .upload('users/user_1.png', imageFile, {
    contentType: 'image/png',
  });

// Get public URL
const publicUrl = bahtera.storage.from('avatars').getPublicUrl('users/user_1.png');

// Download file
const { blob } = await bahtera.storage.from('avatars').download('users/user_1.png');

4. ⚡ Realtime Subscriptions (bahtera.channel)

const room = bahtera.channel('room:general');

// Listen to custom broadcast events
room.on('broadcast', { event: 'message' }, (payload) => {
  console.log('New message:', payload);
});

// Listen to Postgres Database Changes (CDC)
room.on('postgres_changes', { event: 'INSERT', schema: 'public', table: 'messages' }, (payload) => {
  console.log('New message in DB:', payload.new);
});

// Subscribe to channel
room.subscribe((status) => {
  if (status === 'SUBSCRIBED') {
    // Send a broadcast message
    room.send({
      type: 'broadcast',
      event: 'message',
      payload: { text: 'Hello from BahteraBase SDK!' },
    });
  }
});

5. 🚀 Edge Functions (bahtera.functions)

// Invoke Serverless Edge Function
const { data, error } = await bahtera.functions.invoke('send-welcome-email', {
  body: { email: '[email protected]', name: 'Budi' },
});

6. ✨ AI & Vector Search (bahtera.ai)

// Generate text embeddings (1536-dim pgvector compatible)
const { embedding } = await bahtera.ai.generateEmbedding('Semantic search query');

// Perform Cosine Similarity Vector Search
const { data: similarArticles } = await bahtera.ai.vectorSearch({
  table: 'articles',
  vectorColumn: 'embedding',
  queryVector: embedding,
  similarityThreshold: 0.75,
  limit: 5,
});

📄 License

Apache-2.0 © kangpcode