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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@pooflabs/web

v0.0.19

Published

JavaScript SDK for Tarobase API

Readme

Tarobase JS SDK

Tarobase is the web3 alternative to firebase. It is a powerful platform that simplifies the integration of hybrid on-chain actions and data for modern web and mobile applications.

Welcome to the Tarobase JavaScript SDK! This SDK allows you to interact with the Tarobase platform seamlessly from your JavaScript or TypeScript applications. Whether you're building a web app, a Node.js service, or a React Native application (support coming soon), the Tarobase JS SDK provides the tools you need.

Table of Contents

Installation

Install the SDK via npm:

npm install @tarobase/js-sdk

Or with Yarn:

yarn add @tarobase/js-sdk

Getting Started

Initialization

Before using the SDK, initialize it with your Application ID. You can obtain your appId by creating an application on the Tarobase Console. The console also allows you to configure your application's policies, including data storage preferences (on-chain or off-chain) and data schemas.

import { init } from '@tarobase/js-sdk';

init({appId: 'YOUR_APP_ID' });

Authentication

To authenticate users, use the login function:

import { login } from '@tarobase/js-sdk';

// Start the login process
login();

You can also listen for authentication state changes:

import { onAuthStateChanged } from '@tarobase/js-sdk';

onAuthStateChanged((user) => {
	if (user) {
		console.log('User logged in:', user.address);
	} else {
		console.log('User logged out');
	}
});

Usage

Get Current User

import { getCurrentUser } from '@tarobase/js-sdk';

const user = await getCurrentUser();
if (user) {
	console.log('Current user:', user.address);
} else {
	console.log('No user is currently logged in.');
}

Set Data

import { set } from '@tarobase/js-sdk';

const path = 'path/to/data';
const data = { key: 'value' };

await set(path, data);

console.log(`Data set at ${path}`);

On-Chain and Off-Chain Data

The set and get functions automatically handle whether data is stored on-chain or off-chain based on your application's policy configuration in the Tarobase Console.

On-Chain Data:

  • If the data path corresponds to on-chain storage defined in your application policy, the set function will store data on-chain.

  • The data must adhere to the fields schema defined in your Tarobase policy.

  • Transactions are handled automatically, and users may be prompted to approve blockchain transactions.

Off-Chain Data:

  • If the data path corresponds to off-chain storage, the set function will store data off-chain.

Important:

  • Manage your data storage preferences and define policies at the Tarobase Console.

  • Ensure that for on-chain data, the parameters you provide to set match the fields specified in your Tarobase policy.

  • The policy also controls what can be set or get in your application.

  • For information on how to form your policy specifically for your app's use-cases, view the policy docs here.

Subscribe

await subscribe('path/to/data', {}, (data) => { 
	console.log('Data updated:', data); }
);

Get Data

import { get } from '@tarobase/js-sdk';

const path = 'messages/abc123';
const data = await get(path);

const collection = 'messages';
// For colletion queries, include a plain english prompt to filter your results accordingly,
// smart queries will be constructed on your behalf by tarobase.
const data = await get(path, { prompt: "where text starts with the letter f" });

console.log(`Data at ${path}:`, data);

Note: Similar to set, the get and subscribe functions will automatically retrieve data from on-chain or off-chain storage based on your application's configuration.

Additional Resources

For more comprehensive examples, detailed guides, and API references, please visit our documentation site:

React Native Support

Support for React Native is coming soon! Stay tuned for updates, and feel free to check back on our documentation site for the latest information.

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

License

This Tarobase JS SDK project is licensed under the MIT License.


Thank you for using the Tarobase JS SDK! If you have any questions or need further assistance, feel free to crete an issue.