Skip to main content

TypeScript SDK

Lovrabet TypeScript SDK (@lovrabet/sdk) is the core client library that connects frontend applications to the Lovrabet data platform, providing complete data operation capabilities through a minimalist API.


Product Positioning​

Lovrabet is an AI-Native business system generation platform. It uses the pioneering DBAgent database reverse-engineering technology to automatically analyze business models and generate server-side APIs. The TypeScript SDK serves as the platform's BaaS data access layer: shielding developers from underlying API complexity and enabling platform data operations with a native TypeScript experience.

One-line value proposition: With 5 lines of code, go from zero to full data read/write in any frontend project, without needing to understand any API details.


Core Technical Highlights​

Four Authentication Modes Covering All Business Scenarios​

Authentication MethodRuntime EnvironmentMechanismUse Cases
OpenAPI (Server-side)Node.jsaccessKey + HMAC-SHA256 signing, server-side token generationBackend services, SSR, data scripts
OpenAPI (Browser)BrowserPre-generated token + timestamp, no key exposure riskPure frontend apps, post-SSR browser side
Client AK (Server-side)Node.jsaccessKey + X-User-AK, calls /client/* endpoints directlyServer-side scripts, OCR / file platform services (v1.4.1+)
WebAPI (Cookie)Browser / Node.jsCookie string carrying user-session authenticationClient-side operations for logged-in platform users

Key Security Design: accessKey never reaches the browser; OpenAPI tokens have a 10-minute validity period; tokens are generated server-side, ensuring no key exposure on the browser side.

Unified CRUD + Advanced Queries, One API for Everything​

// List query — filter supports rich conditions and sorting
const users = await client.models.users.filter({
where: { status: "active", age: { $gte: 18 } },
orderBy: [{ createdAt: "desc" }],
pageSize: 20
});

// Create, update, delete — single or batch (up to 1000 records)
await client.models.users.update([1, 2, 3], { status: "inactive" });
await client.models.users.delete([4, 5, 6]);

// Aggregate queries — count/sum/avg, no need to write 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, AggregateParams all independently referenceable
  • Generic Support: client.models.users.filter<User>() returns User type with IDE auto-completion
  • AI Error Descriptions: LovrabetError carries code, message, description with fix suggestions in error messages

True Cross-Platform Compatibility, One Codebase​

  • Built on native fetch, no extra HTTP dependencies
  • HMAC-SHA256 signing supports both 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 entry: registerModels() once, reference everywhere
  • Seamless multi-environment switching: production / daily / development in one line
  • Batch operations: Update/delete up to 1000 records, reducing network round trips
  • SQL / BFF endpoints: Call platform pre-registered custom SQL and backend functions via SDK

Version History​

VersionDescription
v1.4.3Platform services client.services (OCR / file), Client AK auth, batchCreate()
v1.4.2Aggregate param column alignment (field kept as alias)
v1.4.1Client AK auth, explicit authMode (Breaking), batchCreate(), $notNull
v1.3.7Batch operations (1000 records), aggregate queries aggregate()
v1.2.0Model aliases, BFF endpoint calls
v1.1.19SQL API
v1.1.14Node.js Cookie authentication support
v1.1.0Initial release

Documentation Directory​

Getting Started​

Data Operations​

Advanced Features​

Reference​


This documentation is maintained by Claude Code and auto-generated from Feishu Wiki sources.