@base44/sdk

中文文档
0.8.59发布于 2026/11/04MITTypeScriptES Module构建来源已验证近 30 天下载 3280.1万

JavaScript SDK for Base44 API

原始使用文档
文档目录11 节
  1. Installation
  2. Modules
  3. Quickstarts
  4. Inside Base44 apps
  5. External apps
  6. Service role
  7. Learn more
  8. Development
  9. Build the SDK
  10. Run tests
  11. Generate documentation

Base44 JavaScript SDK

The Base44 SDK provides a JavaScript interface for building apps on the Base44 platform.

You can use it in two ways:

  • Inside Base44 apps: When Base44 generates your app, the SDK is already set up and ready to use.
  • External apps: Use the SDK to build your own frontend or backend that uses Base44 as a backend service.

Installation

Inside Base44 apps: The SDK is already available. No installation needed.

External apps: Install the SDK via npm:

npm install @base44/sdk

Modules

The SDK provides access to Base44's functionality through the following modules:

  • agents: Interact with AI agents and manage conversations.
  • analytics: Track custom events in your app.
  • app-logs: Access and query app logs.
  • auth: Manage user authentication, registration, and session handling.
  • connectors: Manage OAuth connections and access tokens for third-party services.
  • entities: Work with your app's data entities using CRUD operations.
  • functions: Execute backend functions.
  • integrations: Access pre-built and third-party integrations.
  • payments: Embed checkouts, look up purchases, and handle refunds and subscriptions with the service role.

Quickstarts

How you get started depends on whether you're working inside a Base44-generated app or building your own.

Inside Base44 apps

In Base44-generated apps, the client is pre-configured. Just import and use it:

import { base44 } from "@/api/base44Client";

// Create a new task
const newTask = await base44.entities.Task.create({
  title: "Complete project documentation",
  status: "pending",
  dueDate: "2024-12-31",
});

// Update the task
await base44.entities.Task.update(newTask.id, {
  status: "in-progress",
});

// List all tasks
const tasks = await base44.entities.Task.list();

External apps

When using Base44 as a backend for your own app, install the SDK and create the client yourself:

import { createClient } from "@base44/sdk";

// Create a client for your Base44 app
const base44 = createClient({
  appId: "your-app-id", // Find this in the Base44 editor URL
});

// Read public data
const products = await base44.entities.Products.list();

// Authenticate a user (token is automatically set)
await base44.auth.loginViaEmailPassword("[email protected]", "password");

// Access user's data
const userOrders = await base44.entities.Orders.list();

Service role

By default, the client operates with user-level permissions, limiting access to what the current user can see and do. The service role provides elevated permissions for backend operations and is only available in Base44-hosted backend functions. External backends can't use service role permissions.

import { createClientFromRequest } from "npm:@base44/sdk";

Deno.serve(async (req) => {
  const base44 = createClientFromRequest(req);

  // Access all data with admin-level permissions
  const allOrders = await base44.asServiceRole.entities.Orders.list();

  return Response.json({ orders: allOrders });
});

Learn more

The best way to get started with the JavaScript SDK is to have Base44 build an app for you. Once you have an app, you can explore the generated code and experiment with the SDK to see how it works in practice. You can also ask Base44 to demonstrate specific features of the SDK.

For a deeper understanding, check out these guides:

  1. Base44 client - Work with the client in frontend, backend, and external app contexts.
  2. Work with data - Create, read, update, and delete data.
  3. Common SDK patterns - Authentication, integrations, functions, and error handling.

For the complete documentation and API reference, visit the Base44 Developer Docs.

Development

Build the SDK

Build the SDK from source:

npm install
npm run build

Run tests

Run the test suite:

# Run all tests
npm test

# Run unit tests only
npm run test:unit

# Run with coverage
npm run test:coverage

For E2E tests, create a tests/.env file with:

BASE44_APP_ID=your_app_id
BASE44_AUTH_TOKEN=your_auth_token

Generate documentation

Generate API documentation locally:

# Process and preview locally
npm run create-docs
cd docs
mintlify dev

版本与发布记录

@base44/sdk 共发布 82 个版本,首次发布于 2025/02/26;过去 12 个月发布了 58 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.8.59latest2026/11/043 天前
0.8.582026/11/043 天前
0.8.58-beta.1beta2026/11/043 天前
0.8.58-beta.02026/11/034 天前
0.8.572026/10/2216 天前
0.8.562026/10/2117 天前

关于 @base44/sdk 的常见问题

@base44/sdk 是什么?

JavaScript SDK for Base44 API

如何安装 @base44/sdk?

在项目目录运行 npm install @base44/sdk,或使用 pnpm add / yarn add / bun add。

@base44/sdk 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@base44/sdk 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@base44/sdk 可以商用吗?

@base44/sdk 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@base44/sdk 的下载量有多少?

根据 npm 官方下载统计,@base44/sdk 在 2026/10/08 – 2026/11/06 这 30 天内被下载 32,801,463 次,日均约 1,093,382 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@base44/sdk 还在维护吗?

最新版本 0.8.59 发布于 2026/11/04(3 天前);至今共发布 82 个版本,其中过去 12 个月发布了 58 个;首次发布于 2025/02/26。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。