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

@openbaseapp/js

v0.3.0

Published

OpenBase JavaScript/TypeScript client SDK — mirrors the Supabase JS API

Downloads

7

Readme

openbase-js

The official JavaScript/TypeScript client SDK for OpenBase — a Supabase-compatible backend powered by Telegram.

Installation

npm install openbase-js

Quick Start

import { createClient } from 'openbase-js'

const openbase = createClient(
  'http://localhost:3001',  // Your OpenBase API URL
  'your-anon-key'          // Your project's anon key
)

Database

Query Rows

// Select all rows
const { data, error } = await openbase
  .from('posts')
  .select('*')

// Select with filters
const { data } = await openbase
  .from('posts')
  .select('id, title, created_at')
  .eq('status', 'published')
  .order('created_at', { ascending: false })
  .limit(10)

Insert Rows

const { data, error } = await openbase
  .from('posts')
  .insert({ title: 'Hello World', body: 'My first post' })

Update Rows

const { data, error } = await openbase
  .from('posts')
  .update({ title: 'Updated Title' })
  .eq('id', 'some-uuid')

Delete Rows

const { data, error } = await openbase
  .from('posts')
  .delete()
  .eq('id', 'some-uuid')

Row Count

const { count } = await openbase
  .from('posts')
  .select('*', { count: 'exact', head: true })

Authentication

Sign Up

const { data, error } = await openbase.auth.signUp({
  email: '[email protected]',
  password: 'securepassword',
})

// data.user — the created user
// data.session — { access_token, refresh_token, expires_at }

Sign In

const { data, error } = await openbase.auth.signIn({
  email: '[email protected]',
  password: 'securepassword',
})

Sign Out

await openbase.auth.signOut()

Get Current User

const { data: user } = await openbase.auth.getUser()

Refresh Session

The SDK automatically refreshes the access token using the refresh token when a request returns 401. You can also manually refresh:

const { data: session } = await openbase.auth.refreshSession()

Storage

Upload File

const file = new File(['hello'], 'hello.txt', { type: 'text/plain' })

const { data, error } = await openbase.storage
  .from('avatars')
  .upload('public/hello.txt', file)

Download File

const { data, error } = await openbase.storage
  .from('avatars')
  .download('public/hello.txt')

Download with Image Transforms

const { data } = await openbase.storage
  .from('avatars')
  .download('profile.png', {
    transform: { width: 200, height: 200, format: 'webp' },
  })

Create Signed URL

const { data, error } = await openbase.storage
  .from('avatars')
  .createSignedUrl('private/doc.pdf', 3600) // expires in 1 hour

List Files

const { data, error } = await openbase.storage
  .from('avatars')
  .list('public/')

Delete File

const { data, error } = await openbase.storage
  .from('avatars')
  .remove(['public/hello.txt'])

Realtime

Subscribe to database changes in real-time via WebSockets:

const subscription = openbase
  .channel('posts-changes')
  .on('postgres_changes', {
    event: 'INSERT',
    schema: 'public',
    table: 'posts',
  }, (payload) => {
    console.log('New post:', payload.new)
  })
  .subscribe()

Listen to All Events

const subscription = openbase
  .channel('all-changes')
  .on('postgres_changes', {
    event: '*',
    schema: 'public',
    table: 'posts',
  }, (payload) => {
    console.log(`${payload.eventType}:`, payload)
  })
  .subscribe()

Unsubscribe

subscription.unsubscribe()

Environment Variables

When using the SDK in a frontend framework (Next.js, Vite, etc.):

NEXT_PUBLIC_OPENBASE_URL=http://localhost:3001
NEXT_PUBLIC_OPENBASE_ANON_KEY=your-anon-key
const openbase = createClient(
  process.env.NEXT_PUBLIC_OPENBASE_URL!,
  process.env.NEXT_PUBLIC_OPENBASE_ANON_KEY!
)

License

MIT