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

@singlebase/singlebase-js

v0.6.1

Published

Javascript/Typescript SDK for Singlebase's API

Readme

singlebase-js

singlebase-js : Javascript/Typescript SDK for Singlebase's API.

Javascript SDK Documentation: https://docs.singlebasecloud.com/sdk/javascript

API Documentation: https://docs.singlebasecloud.com

Website: https://singlebase.cloud


About SinglebaseCloud

SinglebaseCloud is an all-in-one backend-as-a-service (BaaS) platform that provides a developer friendly API to access and manage application data, using REST API, GraphQL, or SQL.

Features:

  • LLM & AI functionalities
  • VectorDB: Vector Database for AI and LLM apps
  • Datastore: NoSQL Document Database
  • Authentication: For authentication
  • Filestore: For file storage
  • Search: For text search and vector search
  • Images: Image service to manipulate image

Learn more: https://singlebase.cloud


Install

NPM/Yarn Install

# npm
npm install @singlebase/singlebase-js 

# yarn
yarn add @singlebase/singlebase-js 

JS Module Install

<script type="module">
  import createClient  from 'https://cdn.jsdelivr.net/npm/@singlebase/singlebase-js@latest/+esm'
</script>

Quick example


// 1. import the package
import createClient from '@singlebase/singlebase-js'

/** 
 * 2. create the client config
 * 
 * CreateClientConfigType:
 *    api_url:str     // the api url 
 *    api_key:str     // your api key
 */
const createClientConfig = {
  api_url: "https://cloud.singlebaseapis.com/api/######",
  api_key: "your-api-key"
}

/**
 * 3. create the client
 */
const singlebase = createClient(createClientConfig)


/**
 * 4. use the services
 */

- singlebase.useDatastore()
- singlebase.useAuth()
- singlebase.useFilestore()
- singlebase.useXAI()

// 
//-- Datastore
// Datastore is a NoSQL document datastore
const datastore = singlebase.useDatastore()

// methods
- datastore.list
- datastore.set
- datastore.get
- datastore.insert
- datastore.update
- datastore.delete
- datastore.upsert
- datastore.query
- datastore.search 
- datastore.count

// example
const articles = await datastore.list('articles')
if (articles.ok) {
  for (const article in articles?.data) {
    console.log(article._key, article.title)
  }
}

---

// -- Filestore
const filestore = singlebase.useFilestore()

// methods
- filestore.upload
- filestore.get
- filestore.getURL
- filestore.makePublic
- filestore.setMetadata
- filestore.delete
- filestore.uploadData
- filestore.convertToMarkdown

// example
// html: <input id="myInputFile" type="file" name="uploadFile" required />
let fileInput = document.querySelector("#myInputFile").files[0]
const res = await filestore.upload(fileInput)
if (res.ok) {
  console.log('File URL', res?.data.url)
}

// -- Authentication
const auth = singlebase.useAuth()

// methods
- auth.signInWithPassword
- auth.signUpWithPassword
- auth.updateAccount // change email, password, username
- auth.updateProfile // change display_name, photo, metadata, etc..
- auth.getUser
- auth.signOut
- auth.isAuthenticated
- auth.onAuthStateChange
- auth.onStateChange
- auth.reloadAuthState
- auth.refreshSession
- auth.ensureValidSession

// example
const email = "[email protected]"
const password = "**********"
const res = await auth.signinWithPassword({email, password})
if (res.ok) {
  console.log(`Welcome ${res?.data?.display_name}`)
}

// -- GenAI
const xai = singlebase.useXAI()

// methods
- xai.generate - To generate text based on prompt
- xai.summarize - Summarize
- xai.qna - To QnA document or content
- xai.invoke


Singlebase-AuthUI

singlebase-js also integrates with the Singlebase-AuthUI which is a universal component to authenticate users.

Use the method initAuthUI to initiliaze the AuthUI.

#client.initAuthUI(authUIConfig:{}, authUILib:<bool=false, object>)

Having authUILib=true, it will load

or as Object

const authUILib = {
  url?:str - By default it will load it jsdelivr. Set a different path here
  version?:str - When url is not set, you can load a different version
  module: bool - by default it will set the script type as 'module'
}

Example loading:

singlebase.initAuthUI({
  signinCallback(user => {
    if (user?._key) {
      // ... user is logged in
    }
  })
}, true)

Or pick a different version of the lib

singlebase.initAuthUI({
  signinCallback(user => {
    if (user?._key) {
      // ... user is logged in
    }
  })
}, {version: "1.2.3"})

Inside of your HTML, add the tag below. And voila, done!

<singlebase-authui></singlebase-authui>

Full SDK Reference

Refer to the doc site for more details, please visit https://docs.singlebasecloud.com/sdk/javascript