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

@thinksoftai/sdk

v1.3.1

Published

Official JavaScript/TypeScript SDK for ThinkSoft AI Developer API

Readme

@thinksoftai/sdk

Official JavaScript/TypeScript SDK for ThinkSoft Developer API.

Installation

npm install @thinksoftai/sdk

Quick Start

import { ThinkSoft } from '@thinksoftai/sdk'

// Initialize client
const client = new ThinkSoft({
  appId: 'your-app-id'
})

// Authenticate user
await client.auth.sendOtp('[email protected]')
const { token, user } = await client.auth.verifyOtp('[email protected]', '123456')

// Fetch data
const contacts = await client.from('contacts').list()

Authentication

Login with ThinkSoft (Email OTP)

// Send OTP to user's email
const result = await client.auth.sendOtp('[email protected]')
if (!result.success) {
  console.error(result.error)
}

// Verify OTP and get token
const auth = await client.auth.verifyOtp('[email protected]', '123456')
if (auth.success) {
  console.log('User:', auth.user)
  // Token is automatically stored and used for subsequent requests
}

Using API Key (Backend)

const client = new ThinkSoft({
  appId: 'your-app-id',
  token: 'ts_secret_your_api_key'  // API key for server-side usage
})

Manual Token Management

// Set token manually
client.auth.setToken('your-token')

// Get current token
const token = client.auth.getToken()

// Get current user
const user = client.auth.getUser()

// Check authentication status
if (client.auth.isAuthenticated()) {
  // User is logged in
}

// Logout
client.auth.logout()

Token Refresh (Auto & Manual)

The SDK automatically refreshes tokens before they expire. You can also manually check and refresh:

// Check if token is expired (with 5-minute buffer)
if (client.auth.isTokenExpired()) {
  console.log('Token expired or expiring soon')
}

// Manually refresh session
const result = await client.auth.refreshSession()
if (result.success) {
  console.log('Token refreshed!')
}

// Ensure valid token before operations
const isValid = await client.auth.ensureValidToken()

Note: Auto-refresh happens automatically before API calls when the token is within 5 minutes of expiry.

Create Apps with AI

Create new apps dynamically using natural language prompts:

// Create a new app using AI
const result = await client.createApp({
  prompt: 'Create a CRM app for Sales Department with leads, contacts, and deals tracking'
})

if (result.success) {
  console.log('App created:', result.app.name)
  console.log('App ID:', result.app.app_id)
  console.log('URL:', result.app.url)
}

// Create a store app
const storeResult = await client.createApp({
  prompt: 'Create an e-commerce store for selling electronics',
  type: 'storeapp'
})

The created app will be available in your ThinkSoft dashboard under "My Apps".

CRUD Operations

List Records

// List all
const { data, count } = await client.from('contacts').list()

// With filtering
const { data } = await client.from('contacts').list({
  filter: { status: 'active' },
  sort: 'created_at:desc',
  limit: 10,
  offset: 0
})

Get Single Record

const contact = await client.from('contacts').get('record-id')

Create Record

const newContact = await client.from('contacts').create({
  name: 'John Doe',
  email: '[email protected]'
})

Update Record

const updated = await client.from('contacts').update('record-id', {
  name: 'Jane Doe'
})

Delete Record

await client.from('contacts').delete('record-id')

Helper Methods

// Find first matching record
const contact = await client.from('contacts').findFirst({ email: '[email protected]' })

// Count records
const total = await client.from('contacts').count()
const activeCount = await client.from('contacts').count({ status: 'active' })

Database & Schema

// Get all tables in the database
const tables = await client.tables()
// [{ id, slug, name, icon, fieldCount }]

// Get table schema
const schema = await client.from('contacts').schema()
// { id, slug, name, fields: [...] }

// Get table fields only
const fields = await client.from('contacts').fields()
// [{ name, label, type, required, options }]

TypeScript

The SDK is fully typed. You can provide types for your data:

interface Contact {
  id: string
  name: string
  email: string
  status: 'active' | 'inactive'
}

// Typed queries
const contacts = await client.from<Contact>('contacts').list()
// contacts.data is Contact[]

const contact = await client.from<Contact>('contacts').get('id')
// contact is Contact

Configuration

const client = new ThinkSoft({
  // Required
  appId: 'your-app-id',

  // Optional
  baseUrl: 'https://thinksoftai.com/api/v1',  // Custom API URL
  token: 'your-token',                         // Pre-set auth token
  storage: 'localStorage'                      // 'localStorage' | 'memory' | 'none'
})

React Example

import { ThinkSoft } from '@thinksoftai/sdk'
import { useState, useEffect } from 'react'

const client = new ThinkSoft({ appId: 'xxx' })

function ContactsList() {
  const [contacts, setContacts] = useState([])
  const [loading, setLoading] = useState(true)

  useEffect(() => {
    client.from('contacts')
      .list({ sort: 'created_at:desc' })
      .then(({ data }) => setContacts(data))
      .finally(() => setLoading(false))
  }, [])

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

  return (
    <ul>
      {contacts.map(c => (
        <li key={c.id}>{c.name}</li>
      ))}
    </ul>
  )
}

Node.js Example

const { ThinkSoft } = require('@thinksoftai/sdk')

const client = new ThinkSoft({
  appId: 'xxx',
  token: process.env.THINKSOFT_API_KEY,
  storage: 'memory'  // Use memory storage in Node.js
})

async function main() {
  const { data: contacts } = await client.from('contacts').list()
  console.log(contacts)
}

main()

License

MIT