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

mindsdb-sdk

v1.0.0

Published

JavaScript SDK for interacting with MindsDB APIs

Readme

JavaScript SDK for MindsDB

This SDK provides a JavaScript interface to interact with MindsDB, allowing you to manage minds, datasources, and perform queries. The SDK handles API interactions, error handling, and provides an easy-to-use interface for creating, listing, updating, and deleting minds and datasources.

Table of Contents

Installation

To install the SDK, use npm:

npm install  mindsdb-sdk

Usage

Initializing the SDK

const Client = require('mindsdb-sdk');
// Initialize the client
const client = new Client('YOUR_API_KEY');

Managing Minds

Create a Mind

const mind = await client.minds.create('my_mind', {
	modelName: 'gpt-3',
	provider: 'OpenAI',
	datasources: ['datasource1', 'datasource2'],
	promptTemplate: 'You are a coding assistant',
});

List Minds

const minds = await client.minds.list();
console.log(minds);

Get a Mind by Name

const mind = await client.minds.get('my_mind');

Delete a Mind

await client.minds.drop('my_mind');

Managing Datasources

Create a Datasource


const datasourceConfig = {
	name: 'my_datasource',
	engine: 'postgres',
	description: 'Sample Postgres datasource',
	connectionData: {
	user: 'demo_user',
	password: 'demo_password',
	host: 'samples.mindsdb.com',
	port: 5432,
	database: 'demo',
	schema: 'demo_data',
},

	tables: ['table1', 'table2'],

};
const datasource = await client.datasources.create(datasourceConfig);

List Datasources

const datasources = await client.datasources.list();
console.log(datasources);

Get a Datasource by Name

const datasource = await client.datasources.get('my_datasource');

Delete a Datasource

await client.datasources.drop('my_datasource');

Error Handling

The SDK includes built-in error handling. Common error types are:

  • ObjectNotFound: Thrown when a resource (mind or datasource) cannot be found.

  • Forbidden: Thrown for a 403 Forbidden response.

  • Unauthorized: Thrown for a 401 Unauthorized response.

  • UnknownError: Thrown for any other unhandled errors.

try {

	const mind = await client.minds.get('non_existent_mind');

} catch (error) {

if (error instanceof ObjectNotFound) {

	console.error('Mind not found');

	}
}

API Reference

Client

  • Client(apiKey, baseUrl): Initializes the SDK client.

  • apiKey: Your MindsDB API key.

  • baseUrl: Optional base URL for custom MindsDB instances.

Minds

  • client.minds.create(name, options): Creates a new mind.

  • client.minds.list(): Lists all minds.

  • client.minds.get(name): Retrieves a mind by name.

  • client.minds.drop(name): Deletes a mind.

Datasources

  • client.datasources.create(config, replace = false): Creates a new datasource.

  • client.datasources.list(): Lists all datasources.

  • client.datasources.get(name): Retrieves a datasource by name.

  • client.datasources.drop(name): Deletes a datasource.