TypeScript SDK

A beautiful, type-safe client for interacting with your Baasix backend. Works everywhere — browsers, Node.js, React Native — with full IDE autocompletion and compile-time error checking.

100%
TypeScript
3
Platforms
<10KB
Bundle Size
Full
API Coverage

Developer Experience First

The Baasix SDK is designed for developers who value productivity and type safety.

Stop guessing API parameters and response shapes. The Baasix SDK gives you full TypeScript support with autocompletion for collections, fields, filters, and relationships. Generate types from your schema, and the SDK knows exactly what data you're working with. Catch bugs at compile time, not runtime.

  • Full TypeScript support with generated types from your schema
  • IDE autocompletion for collections, fields, and filters
  • Works in browsers, Node.js, and React Native
  • Built-in authentication with token management
  • Real-time subscriptions with the same simple API
  • File upload support with progress tracking
  • Tree-shakeable and minimal bundle size impact

Clean, Intuitive API

The SDK API is designed to be self-documenting. Method names match what they do, parameters are obvious, and TypeScript guides you every step.

// Initialize the client
const baasix = new Baasix({ url: 'https://api.example.com' })

// Fetch users with filtering and relations
const users = await baasix.items('users')
  .filter({ role: { eq: 'admin' } })
  .fields(['id', 'name', 'email'])
  .include('posts')
  .get()

// Create a new record
const newPost = await baasix.items('posts').create({
  title: 'Hello World',
  published: true
})

Why Use the Official SDK?

You could use fetch, but why would you?

✓ With Baasix

  • Type-safe queries with IDE autocompletion
  • Automatic token refresh and auth handling
  • Real-time subscriptions built in
  • File uploads with progress callbacks
  • Consistent error handling across platforms

✗ Traditional Approach

  • Manual fetch calls with no type safety
  • Build your own auth token management
  • Set up WebSocket connection manually
  • Implement multipart form uploads yourself
  • Handle errors differently per platform

SDK Features

Generated Types

Use the CLI to generate TypeScript types from your schema. The SDK then knows your exact data structure.

Universal Runtime

Same API across browser, Node.js, and React Native. Write once, run anywhere.

Auth Built In

Login, logout, token refresh, and OAuth flows all handled. Just call the methods.

Real-time Ready

Subscribe to collections and get live updates. The SDK handles WebSocket connections automatically.

React Native Support

First-class mobile support with async storage adapters and offline-friendly patterns.

Modular Imports

Only import what you use. Tree-shaking keeps your bundle small.

Build Anything, Anywhere

The SDK powers every kind of Baasix-backed application.

React & Next.js Apps

Build modern web apps with type-safe data fetching. Perfect integration with React Query, SWR, or plain hooks.

ReactNext.jsWeb

Mobile Applications

React Native apps with secure token storage, offline support, and push notification handling.

React NativeiOSAndroid

Backend Services

Node.js microservices that need to talk to Baasix. Service-to-service auth and admin operations.

Node.jsMicroservicesAdmin

CLI & Automation

Build CLI tools, data migration scripts, or automation workflows. Full API access from any Node.js environment.

AutomationScriptsCLI

SDK FAQ

How do I generate types for my schema?

Run `npx baasix types` in your project. The CLI connects to your Baasix instance and generates TypeScript definitions for all your collections, which the SDK uses for autocompletion.

Does the SDK work without TypeScript?

Yes! The SDK works perfectly with plain JavaScript. You'll just miss out on the type safety and autocompletion benefits.

How does authentication work?

Call `baasix.auth.login(email, password)` or use OAuth methods. The SDK stores tokens securely and automatically attaches them to requests. Token refresh happens transparently.

Can I use the SDK in serverless functions?

Absolutely. The SDK is stateless by default, making it perfect for serverless environments like Vercel, Netlify Functions, or AWS Lambda.

Ready to build faster?

Join developers who are shipping production-ready backends in hours, not weeks.