Skip to content

TypeScript SDK ​

The Lovrabet TypeScript SDK (@lovrabet/sdk) is the core client library connecting frontend apps to the Lovrabet data platform — complete data operations through a minimal API.


Positioning ​

Lovrabet is an AI-Native business system generation platform. Its pioneering DBAgent database reverse-engineering technology analyzes your business model and generates server-side APIs automatically. The TypeScript SDK is the platform's BaaS data access layer: it shields developers from the underlying API complexity and lets you work with platform data in native TypeScript.

The value in one sentence: read and write data in any frontend project from scratch with 5 lines of code — no API details required.


Technical highlights ​

Three authentication modes covering every scenario ​

MethodRuntimeHow it worksBest for
OpenAPI (server)Node.jsaccessKey + HMAC-SHA256 signature; token generated on the serverBackend services, SSR, data scripts
OpenAPI (browser)BrowserPre-generated token + timestamp; no key exposure riskPure frontend apps, browser side after SSR
WebAPI (Cookie)Browser / Node.jsCookie string carrying the user's authenticated identityClient-side operations by users already logged in to the platform

Key security designs: accessKey never reaches the browser; OpenAPI tokens expire after 10 minutes; tokens are generated server-side, so no keys leak in the browser.

Unified CRUD + advanced queries — one API for everything ​

TypeScript
// 列表查询 — filter 支持丰富条件与排序
const users = await client.models.users.filter({
  where: { status: "active", age: { $gte: 18 } },
  orderBy: [{ createdAt: "desc" }],
  pageSize: 20
});

// 增删改查 — 单条或批量(最多 1000 条)
await client.models.users.update([1, 2, 3], { status: "inactive" });
await client.models.users.delete([4, 5, 6]);

// 聚合查询 — count/sum/avg,无需手写 SQL
const stats = await client.models.orders.aggregate({
  groupBy: ["status"],
  aggregations: [{ field: "amount", type: "sum", alias: "total" }]
});

Native TypeScript experience, AI-friendly ​

  • Complete type definitions: 40+ exported types; WhereCondition, FilterParams, and AggregateParams are all independently importable
  • Generics: client.models.users.filter<User>() returns User with full IDE completion
  • AI error descriptions: LovrabetError carries code, message, and description, with fix suggestions built in

Truly cross-platform, one codebase ​

  • Built on native fetch — no extra HTTP dependencies
  • HMAC-SHA256 signing works with both the Web Crypto API (browser) and Node.js crypto
  • One codebase runs on: React / Vue / Angular / Svelte, Node.js / Express / Koa / Nest.js, WeChat Mini Programs / Electron

Developer experience ​

  • Zero-config start: register once with registerModels(), reference everywhere
  • Seamless environment switching: production / daily / development in one line
  • Bulk operations: update / delete up to 1000 records in one round trip
  • SQL / BFF endpoints: call the platform's pre-registered custom SQL and Backend Functions through the SDK

Releases ​

VersionHighlights
v1.3.7Bulk operations (1000 records), aggregate() queries
v1.2.0Model aliases, BFF endpoint calls
v1.1.19SQL API
v1.1.14Node.js cookie authentication
v1.1.0Initial release

Documentation ​

Getting started ​

Data operations ​

Going further ​

Reference ​


This document is maintained by Claude Code and generated automatically from the Feishu wiki source.

基于飞书知识库同步生成,内容以飞书源文档为准