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
| Method | Runtime | How it works | Best for |
|---|---|---|---|
| OpenAPI (server) | Node.js | accessKey + HMAC-SHA256 signature; token generated on the server | Backend services, SSR, data scripts |
| OpenAPI (browser) | Browser | Pre-generated token + timestamp; no key exposure risk | Pure frontend apps, browser side after SSR |
| WebAPI (Cookie) | Browser / Node.js | Cookie string carrying the user's authenticated identity | Client-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
// 列表查询 — 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, andAggregateParamsare all independently importable - Generics:
client.models.users.filter<User>()returnsUserwith full IDE completion - AI error descriptions:
LovrabetErrorcarriescode,message, anddescription, 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/developmentin 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
| Version | Highlights |
|---|---|
| v1.3.7 | Bulk operations (1000 records), aggregate() queries |
| v1.2.0 | Model aliases, BFF endpoint calls |
| v1.1.19 | SQL API |
| v1.1.14 | Node.js cookie authentication |
| v1.1.0 | Initial release |
Documentation
Getting started
- SDK overview — SDK overview, technical highlights, core features
- Quick start — up and running in 5 minutes
- Configuration — configuration methods and multi-project support
- Authentication — configuring the three auth methods, with security notes
Data operations
- API guide — CRUD operations, query parameters, bulk processing
- Filter API — complex conditions, field selection, multi-field sorting
- Aggregate API — grouped statistics, sums, averages
- SQL API — run the platform's pre-registered custom SQL
- BFF API — call Backend Functions
- User list queries — user list query examples
- Multi-table queries — join queries across tables
Going further
- Model aliases — friendlier alias-based access
- Advanced features — multi-project management, performance tuning, error handling
- Error handling — LovrabetError in depth, plus debugging tips
- Syntactic sugar — convenient shortcuts in the SDK
- TypeScript support — type definitions and type-safe development
- SQL tutorial — SQL basics
Reference
- API reference — complete API documentation
- MCP SDK usage — MCP SDK integration guide
- Practical examples — full integration examples for React, Vue, Node.js, and more
- Troubleshooting — diagnosing and resolving common issues
- Frontend platform — frontend platform features
This document is maintained by Claude Code and generated automatically from the Feishu wiki source.