TypeScript SDK Introduction
The Lovrabet TypeScript SDK is a lightweight JavaScript/TypeScript SDK that gives web and Node.js applications convenient access to Lovrabet platform data.
Current version: v1.4.3 | npm: @lovrabet/sdk
💡 Technology Highlights
Written in TypeScript and compiled to JavaScript, it runs in both the browser and Node.js:
🌐 Web
Works with all mainstream frontend frameworks:
- React - Create React App, Vite, Remix, and more
- Vue - Vue 3, Vite, Vue CLI, and more
- Angular - Angular 14+ and more
- Others - Svelte, Solid.js, vanilla JavaScript, and more
🖥️ Node.js
Works with all mainstream Node.js frameworks and runtimes:
- SSR frameworks - Next.js, Nuxt.js, Astro, and more
- Backend frameworks - Express, Koa, Fastify, Nest.js, Hono, and more
- Runtimes - Node.js 18+, Bun, Deno, and more
📱 Cross-Platform Support
- Mini programs - WeChat Mini Program, Alipay Mini Program, uni-app, and more
- Desktop apps - Electron, Tauri, and more
🎯 Key Features
- 🚀 Effortless to use - Get started in 5 minutes with a clean, intuitive API
- 🔧 Flexible configuration - Multiple configuration styles to fit your project
- 🔐 Multiple authentication methods - User token, OpenAPI key, Client AK, and Cookie
- 📊 Full CRUD - Complete data operations: create, read, update, delete
- 🎯 Native TypeScript support - Full type definitions for type-safe development
- ⚡ High performance - Built-in caching, request deduplication, batching, and more
- 🏷️ Model aliases v1.2.0+ - Friendly alias-based access to models
🛠️ Core Capabilities
Data Operations
- List queries (pagination, filtering, sorting)
- Fetch a single record
- Create new records
- Update existing records
- Delete records
Advanced Queries
- Filter queries - Complex condition filtering, field selection, multi-field sorting
- Custom SQL queries v1.1.19+ - Execute registered custom SQL
- BFF endpoint calls v1.2.0+ - Invoke Backend Functions
Advanced Features
- Multi-project support
- Request caching and optimization
- Error handling and retries
- Performance monitoring
📖 Documentation Map
🚀 Quick Start
A 5-minute guide covering installation, configuration, and basic usage
🔧 Configuration In Depth
Details on every configuration style plus multi-project support
🔐 Authentication
Configuring user tokens, OpenAPI AccessKeys, Client AKs, Cookies, and other auth methods
📊 API Guide
Core API usage: CRUD operations, query parameters, batch processing, and more
🎯 TypeScript Support
Type definitions, type-safe API calls, and best practices
🚀 Advanced Features
Multi-project management, performance optimization, error handling, and more
🛠️ Real-World Examples
Complete integration examples for React, Vue, Node.js, and other environments
🔧 Troubleshooting
Diagnosing common issues, debugging tips, and solutions
🚀 Quick Preview
Installation
npm install @lovrabet/sdkBasic Usage
💡 Recommended Lovrabet CLI generates your configuration in one step — no manual setup required.
import { registerModels, createClient } from "@lovrabet/sdk";
// 注册配置
registerModels({
appCode: "your-app-code",
models: [
{
datasetCode: "8d2dcbae08b54bdd84c00be558ed48df",
tableName: "users",
alias: "users",
},
],
});
// 创建客户端
const client = createClient();
// 标准方式访问(推荐)
const users = await client.models.dataset_8d2dcbae08b54bdd84c00be558ed48df.filter();
const user = await client.models.dataset_8d2dcbae08b54bdd84c00be558ed48df.create({
name: "John",
email: "john@example.com",
});Model Access Styles v1.2.0+
The SDK supports two access styles with identical functionality:
// 标准方式(推荐)- 使用 dataset_ 前缀 + datasetCode,全局唯一,AI 友好
const users = await client.models.dataset_8d2dcbae08b54bdd84c00be558ed48df.filter();
// 别名方式(语法糖)- 使用配置的 alias,方便人类阅读
const users = await client.models.users.filter();💡 Aliases are pure syntax sugar — the SDK still uses the datasetCode internally. The standard style is recommended: it lets AI tools generate code that resolves datasets precisely.
💡 Design Philosophy
The Lovrabet TypeScript SDK is built on these principles:
- Simplicity first - A clean API that minimizes the learning curve
- Type safety - Full TypeScript support with compile-time error detection
- Performance - Multiple built-in optimization strategies
- Flexible configuration - Adapts to different project needs
- Developer friendly - Detailed error messages and debugging tools
🔗 Ecosystem
The Lovrabet TypeScript SDK is an important part of the Rabetbase ecosystem:
- Lovrabet CLI - Scaffolding tool that generates SDK configuration automatically
- Lovrabet Templates - Ready-to-use project templates
- OpenAPI - Rich backend data services
📞 Getting Help
- 📖 Documentation - Browse detailed guides and examples
- 💬 Community - Join the developer community
- 🐛 Bug reports - Report issues as you find them
- 📧 Technical support - Dedicated support for enterprise customers
Start your Lovrabet TypeScript SDK journey! 🎉