| name | base44-sdk |
| description | Use for writing JavaScript/TypeScript code with the Base44 SDK in EXISTING projects. Triggers: user wants to implement features, build functionality, or write code using Base44; code uses '@base44/sdk' imports; user mentions SDK methods like base44.entities, base44.auth, base44.agents, base44.functions, base44.integrations; user says 'add a feature', 'implement', 'build component', 'write code for'. NOT for: creating new projects, CLI commands (npx base44 create/deploy/login), or directories without base44/config.jsonc - use base44-cli instead. |
Base44 Coder
Build apps on the Base44 platform using the Base44 JavaScript SDK.
⚡ IMMEDIATE ACTION REQUIRED - Read This First
This skill activates on ANY mention of "base44" or when a base44/ folder exists. DO NOT read documentation files or search the web before acting.
Your first action MUST be:
- Check if
base44/config.jsonc exists in the current directory
- If YES (existing project scenario):
- This skill (base44-sdk) handles the request
- Implement features using Base44 SDK
- Do NOT use base44-cli unless user explicitly requests CLI commands
- If NO (new project scenario):
- Transfer to base44-cli skill for project initialization
- This skill cannot help until project is initialized
When to Use This Skill vs base44-cli
Use base44-sdk when:
- Building features in an EXISTING Base44 project
base44/config.jsonc already exists in the project
- Base44 SDK imports are present (
@base44/sdk)
- Writing JavaScript/TypeScript code using Base44 SDK modules
- Implementing functionality, components, or features
- User mentions: "implement", "build a feature", "add functionality", "write code for"
- User says "create a [type] app" and a Base44 project already exists
DO NOT USE base44-sdk for:
- ❌ Initializing new Base44 projects (use
base44-cli instead)
- ❌ Empty directories without Base44 configuration
- ❌ When user says "create a new Base44 project/app/site" and no project exists
- ❌ CLI commands like
npx base44 create, npx base44 deploy, npx base44 login (use base44-cli)
Skill Dependencies:
base44-sdk assumes a Base44 project is already initialized
base44-cli is a prerequisite for base44-sdk in new projects
- If user wants to "create an app" and no Base44 project exists, use
base44-cli first
State Check Logic:
Before selecting this skill, verify:
- IF (user mentions "create/build app" OR "make a project"):
- IF (directory is empty OR no
base44/config.jsonc exists):
→ Use base44-cli (project initialization needed)
- ELSE:
→ Use base44-sdk (project exists, build features)
Quick Start
const task = await base44.entities.Task.create({ title: "New task", status: "pending" });
const tasks = await base44.entities.Task.list();
await base44.entities.Task.update(task.id, { status: "done" });
const user = await base44.auth.me();
import { createClient } from "@base44/sdk";
const base44 = createClient({ appId: "your-app-id" });
await base44.auth.loginViaEmailPassword("user@example.com", "password");
SDK Modules
For client setup and authentication modes, see client.md.
TypeScript Support: Each reference file includes a "Type Definitions" section with TypeScript interfaces and types for the module's methods, parameters, and return values.
Installation
Install the Base44 SDK:
npm install @base44/sdk
Important: Never assume or hardcode the @base44/sdk package version. Always install without a version specifier to get the latest version.
Creating a Client (External Apps)
When creating a client in external apps, ALWAYS use appId as the parameter name:
import { createClient } from "@base44/sdk";
const base44 = createClient({ appId: "your-app-id" });
Required parameter: appId (string) - Your Base44 application ID
Optional parameters:
token (string) - Pre-authenticated user token
options (object) - Configuration options
options.onError (function) - Global error handler
Example with error handler:
const base44 = createClient({
appId: "your-app-id",
options: {
onError: (error) => {
console.error("Base44 error:", error);
}
}
});
Module Selection
Working with app data?
- Create/read/update/delete records →
entities
- Import data from file →
entities.importEntities()
- Realtime updates →
entities.EntityName.subscribe()
User management?
- Login/register/logout →
auth
- Get current user →
auth.me()
- Update user profile →
auth.updateMe()
- Invite users →
users.inviteUser()
AI features?
- Chat with AI agents →
agents
- Create new conversation →
agents.createConversation()
- Manage conversations →
agents.getConversations()
- Generate text/JSON with AI →
integrations.Core.InvokeLLM()
- Generate images →
integrations.Core.GenerateImage()
Custom backend logic?
- Run server-side code →
functions.invoke()
- Need admin access →
base44.asServiceRole.functions.invoke()
External services?
- Send emails →
integrations.Core.SendEmail()
- Upload files →
integrations.Core.UploadFile()
- Custom APIs →
integrations.custom.call()
- OAuth tokens (Google, Slack) →
connectors (backend only)
Tracking and analytics?
- Track custom events →
analytics.track()
- Log page views/activity →
appLogs.logUserInApp()
Common Patterns
Filter and Sort Data
const pendingTasks = await base44.entities.Task.filter(
{ status: "pending", assignedTo: userId },
"-created_date",
10,
0
);
Protected Routes (check auth)
const user = await base44.auth.me();
if (!user) {
base44.auth.redirectToLogin(window.location.href);
return;
}
Backend Function Call
const result = await base44.functions.invoke("processOrder", {
orderId: "123",
action: "ship"
});
import { createClientFromRequest } from "@base44/sdk";
Deno.serve(async (req) => {
const base44 = createClientFromRequest(req);
const { orderId, action } = await req.json();
const order = await base44.asServiceRole.entities.Orders.get(orderId);
return Response.json({ success: true });
});
Service Role Access
Use asServiceRole in backend functions for admin-level operations:
const myTasks = await base44.entities.Task.list();
const allTasks = await base44.asServiceRole.entities.Task.list();
const token = await base44.asServiceRole.connectors.getAccessToken("slack");
Frontend vs Backend
| Capability | Frontend | Backend |
|---|
entities (user's data) | Yes | Yes |
auth | Yes | Yes |
agents | Yes | Yes |
functions.invoke() | Yes | Yes |
integrations | Yes | Yes |
analytics | Yes | Yes |
appLogs | Yes | Yes |
users | Yes | Yes |
asServiceRole.* | No | Yes |
connectors | No | Yes |
Backend functions use Deno.serve() and createClientFromRequest(req) to get a properly authenticated client.