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

@jbatch/tinycore-client

v0.1.0

Published

TinyCore client library with React hooks

Downloads

4

Readme

@jbatch/tinycore-client

TypeScript client library with React hooks for seamless TinyCore integration. Get authentication, data storage, and application management in your React apps with just a few lines of code.

Installation

npm install @jbatch/tinycore-client
# or
yarn add @jbatch/tinycore-client
# or  
pnpm add @jbatch/tinycore-client

Note: Tinycore client is not yet published tp npm

Quick Start

1. Set up the provider

Wrap your app with the TinyCore provider:

import { TinyCoreProvider } from '@jbatch/tinycore-client';

function App() {
  return (
    <TinyCoreProvider config={{ baseUrl: 'http://localhost:3000' }}>
      <MyApp />
    </TinyCoreProvider>
  );
}

2. Use authentication

import { useAuth } from '@jbatch/tinycore-client';

function AuthComponent() {
  const { login, register, logout, user, isAuthenticated, loading } = useAuth();

  if (loading) return <div>Loading...</div>;

  if (isAuthenticated) {
    return (
      <div>
        <p>Welcome, {user.email}!</p>
        <button onClick={logout}>Logout</button>
      </div>
    );
  }

  return (
    <div>
      <button onClick={() => login('[email protected]', 'password')}>
        Login
      </button>
      <button onClick={() => register('[email protected]', 'password')}>
        Register
      </button>
    </div>
  );
}

3. Store and retrieve data

import { useKVStore, useKVList } from '@jbatch/tinycore-client';

function DataComponent() {
  // Single key-value operations
  const { data, set, delete: deleteKey, loading } = useKVStore('my-app', 'user-settings');
  
  // List operations
  const { data: allItems, create, deleteKey: deleteItem } = useKVList('my-app', 'todos-');

  const updateSettings = () => {
    set({ theme: 'dark', language: 'en' });
  };

  const addTodo = () => {
    create('todos-' + Date.now(), { text: 'New todo', completed: false });
  };

  return (
    <div>
      <button onClick={updateSettings}>Update Settings</button>
      <button onClick={addTodo}>Add Todo</button>
      
      {allItems?.map(item => (
        <div key={item.key}>
          {JSON.stringify(item.value)}
          <button onClick={() => deleteItem(item.key)}>Delete</button>
        </div>
      ))}
    </div>
  );
}

4. Manage applications

import { useApplications } from '@jbatch/tinycore-client';

function AppsComponent() {
  const { applications, create, delete: deleteApp } = useApplications();

  const createApp = () => {
    create({
      id: 'my-new-app',
      name: 'My New App',
      metadata: { version: '1.0.0' }
    });
  };

  return (
    <div>
      <button onClick={createApp}>Create App</button>
      
      {applications?.map(app => (
        <div key={app.id}>
          <h3>{app.name}</h3>
          <button onClick={() => deleteApp(app.id)}>Delete</button>
        </div>
      ))}
    </div>
  );
}

Available Hooks

Authentication

  • useAuth() - Login, logout, registration, current user state
  • useRegistrationStatus() - Check if registration is allowed

Key-Value Storage

  • useKVStore(appId, key) - Single key operations (get, set, delete)
  • useKVList(appId, prefix?) - List operations with optional prefix filtering

Application Management

  • useApplications() - List, create, update, delete applications
  • useApplication(id) - Single application operations

API Classes

If you prefer direct API calls without React hooks:

import { TinyCoreApiClient, AuthApi, KVApi, ApplicationsApi } from '@jbatch/tinycore-client';

const client = new TinyCoreApiClient({ baseUrl: 'http://localhost:3000' });
const auth = new AuthApi(client);
const kv = new KVApi(client);
const apps = new ApplicationsApi(client);

// Direct API usage
const { user, token } = await auth.login('[email protected]', 'password');
client.setToken(token);

await kv.set('my-app', 'my-key', { hello: 'world' });
const item = await kv.get('my-app', 'my-key');

Configuration

The TinyCoreProvider accepts these config options:

<TinyCoreProvider config={{
  baseUrl: 'http://localhost:3000',  // Required: TinyCore server URL
  apiVersion: 'v1'                   // Optional: API version (default: 'v1')
}}>

TypeScript Support

All hooks and API methods are fully typed. The client exports all necessary types:

import type { 
  User, 
  Application, 
  KVItem, 
  LoginResponse,
  TinyCoreConfig 
} from '@jbatch/tinycore-client';

Error Handling

All hooks include error states and loading indicators:

const { data, error, loading, refetch } = useKVStore('my-app', 'my-key');

if (loading) return <div>Loading...</div>;
if (error) return <div>Error: {error}</div>;

return <div>{JSON.stringify(data)}</div>;

Examples

TODO: Provide examples

Check out example implementations: