SDKs

TypeScript / JavaScript SDK

Official Node.js and browser client for the MUDBASE API with full TypeScript support.

Installation

bash
npm install mudbase-sdk
npm install mudbase-sdk

Quick Start

Construct a Configuration plus the API classes you need - there is no unified client wrapper:

typescript
import { Configuration, AuthenticationApi, DataApi } from 'mudbase-sdk';

// Your project API key goes out as X-API-Key on every request via the
// Configuration's headers option.
const configuration = new Configuration({
  basePath: 'https://cloud.mudbase.dev',
  headers: { 'X-API-Key': process.env.MUDBASE_API_KEY },
});

const auth = new AuthenticationApi(configuration);
const dataApi = new DataApi(configuration);

const projectId = process.env.MUDBASE_PROJECT_ID!;
const collectionId = process.env.MUDBASE_COLLECTION_ID!;

// Log in an end-user of your project
const { data: session } = await auth.loginUser({
  loginRequest: { email: 'morgan.chen@northwind.dev', password: 'hunter2' },
});

// List documents in a collection - methods take a single request object
const { data: items } = await dataApi.listData({ projectId, collectionId });
import { Configuration, AuthenticationApi, DataApi } from 'mudbase-sdk';

// Your project API key goes out as X-API-Key on every request via the
// Configuration's headers option.
const configuration = new Configuration({
  basePath: 'https://cloud.mudbase.dev',
  headers: { 'X-API-Key': process.env.MUDBASE_API_KEY },
});

const auth = new AuthenticationApi(configuration);
const dataApi = new DataApi(configuration);

const projectId = process.env.MUDBASE_PROJECT_ID!;
const collectionId = process.env.MUDBASE_COLLECTION_ID!;

// Log in an end-user of your project
const { data: session } = await auth.loginUser({
  loginRequest: { email: 'morgan.chen@northwind.dev', password: 'hunter2' },
});

// List documents in a collection - methods take a single request object
const { data: items } = await dataApi.listData({ projectId, collectionId });

More

For installation in other languages, error handling, and pagination, see the SDKs Overview.

Chat with us