Skip to main content

TypeScript SDK Introduction

Lovrabet TypeScript SDK is a lightweight JavaScript/TypeScript SDK that provides convenient Lovrabet platform data access capabilities for both Web and Node.js environments.

💡 Technical Features​

Written in TypeScript and compiled to JavaScript, it can run in both browser and Node.js environments:

🌐 Web Side​

Supports all mainstream frontend frameworks:

  • React - Create React App, Vite, Remix, etc.
  • Vue - Vue 3, Vite, Vue CLI, etc.
  • Angular - Angular 14+, etc.
  • Others - Svelte, Solid.js, vanilla JavaScript, etc.

đŸ–Ĩī¸ Node.js Side​

Supports all mainstream Node.js frameworks and runtimes:

  • SSR Frameworks - Next.js, Nuxt.js, Astro, etc.
  • Backend Frameworks - Express, Koa, Fastify, Nest.js, Hono, etc.
  • Runtimes - Node.js 18+, Bun, Deno, etc.

📱 Cross-Platform Support​

  • Mini Programs - WeChat Mini Program, Alipay Mini Program, uni-app, etc.
  • Desktop Applications - Electron, Tauri, etc.

đŸŽ¯ Core Features​

  • 🚀 Extremely Simple - Get started in 5 minutes with intuitive API design
  • 🔧 Flexible Configuration - Supports multiple configuration methods to meet different project needs
  • 🔐 Multiple Authentication - Supports user Token, OpenAPI AccessKey, Cookie, and other authentication methods
  • 📊 Complete CRUD - Provides complete data operations including create, read, update, and delete
  • đŸŽ¯ Native TypeScript Support - Complete type definitions for type-safe development
  • ⚡ High Performance - Built-in caching, request deduplication, batch processing, and other optimizations
  • đŸˇī¸ Model Aliases v1.2.0+ - Supports friendly model alias access methods

đŸ› ī¸ Main Features​

Data Operations​

  • List queries (supports pagination, filtering, sorting)
  • Single record retrieval
  • Create new records
  • Update existing records
  • Delete records

Advanced Features​

  • Multi-project support
  • Request caching and optimization
  • Error handling and retry
  • Performance monitoring

📖 Documentation Navigation​

🚀 Quick Start​

5-minute getting started guide, including installation, configuration, and basic usage

🔧 Configuration Details​

Detailed introduction to various configuration methods and multi-project support

🔐 Authentication Configuration​

Configuration for user Token, OpenAPI AccessKey, Cookies, and other authentication methods

📊 API Usage Guide​

Core API usage for CRUD operations, query parameters, batch processing, etc.

đŸŽ¯ TypeScript Support​

Type definitions, type-safe API calls, and best practices

🚀 Advanced Features​

Advanced features including multi-project management, performance optimization, and error handling

đŸ› ī¸ Practical Examples​

Complete integration examples for React, Vue, Node.js, and other environments

🔧 Troubleshooting​

Common issue diagnosis, debugging tips, and solutions

🚀 Quick Preview​

Installation​

npm install @lovrabet/sdk

Basic Usage​

Recommended Approach

Using Lovrabet CLI can generate configuration with one click, saving you from manual configuration.

import { registerModels, createClient } from "@lovrabet/sdk";

// Register configuration
registerModels({
appCode: "your-app-code",
models: [
{
datasetCode: "8d2dcbae08b54bdd84c00be558ed48df",
tableName: "users",
alias: "users",
},
],
});

// Create client
const client = createClient();

// Standard access method (recommended)
const users = await client.models.dataset_8d2dcbae08b54bdd84c00be558ed48df.filter();
const user = await client.models.dataset_8d2dcbae08b54bdd84c00be558ed48df.create({
name: "John",
email: "john@example.com",
});

Model Access Methods v1.2.0+​

The SDK supports two access methods with identical functionality:

// Standard method (recommended) - Uses dataset_ prefix + datasetCode, globally unique, AI-friendly
const users = await client.models.dataset_8d2dcbae08b54bdd84c00be558ed48df.filter();

// Alias method (syntactic sugar) - Uses configured alias, convenient for human reading
const users = await client.models.users.filter();

💡 Alias is just syntactic sugar, internally still uses datasetCode for access. The standard method is recommended as AI tools can precisely locate when generating code.

💡 Design Philosophy​

Lovrabet TypeScript SDK adheres to the following design principles:

  • Simplicity First - Clean API design reduces learning curve
  • Type Safety - Complete TypeScript support with compile-time error detection
  • Performance Optimization - Built-in multiple performance optimization strategies
  • Flexible Configuration - Supports multiple configuration methods to adapt to different project needs
  • Developer Friendly - Detailed error messages and debugging tools

🔗 Ecosystem​

Lovrabet TypeScript SDK is an important part of the Rabetbase ecosystem:

  • Lovrabet CLI - Scaffolding tool that automatically generates SDK configuration
  • Lovrabet Templates - Ready-to-use project templates
  • OpenAPI - Rich backend data services

📞 Get Help​

  • 📖 Documentation - View detailed usage documentation and examples
  • đŸ’Ŧ Community Support - Join the developer community for discussions
  • 🐛 Issue Reporting - Report bugs promptly
  • 📧 Technical Support - Enterprise users can receive professional technical support

Start your Lovrabet TypeScript SDK journey! 🎉