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
folder exists.
DO NOT read documentation files or search the web before acting.
Your first action MUST be:
- Check if 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
- already exists in the project
- Base44 SDK imports are present ()
- 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 instead)
- ❌ Empty directories without Base44 configuration
- ❌ When user says "create a new Base44 project/app/site" and no project exists
- ❌ CLI commands like , , (use )
Skill Dependencies:
- assumes a Base44 project is already initialized
- is a prerequisite for in new projects
- If user wants to "create an app" and no Base44 project exists, use 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 exists):
→ Use base44-cli (project initialization needed)
- ELSE:
→ Use base44-sdk (project exists, build features)
Quick Start
javascript
// In Base44-generated apps, base44 client is pre-configured and available
// CRUD operations
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" });
// Get current user
const user = await base44.auth.me();
javascript
// External apps
import { createClient } from "@base44/sdk";
// IMPORTANT: Use 'appId' (NOT 'clientId' or 'id')
const base44 = createClient({ appId: "your-app-id" });
await base44.auth.loginViaEmailPassword("user@example.com", "password");
⚠️ CRITICAL: Do Not Hallucinate APIs
Before writing ANY Base44 code, verify method names against this table or QUICK_REFERENCE.md.
Base44 SDK has unique method names. Do NOT assume patterns from Firebase, Supabase, or other SDKs.
Authentication - WRONG vs CORRECT
| ❌ WRONG (hallucinated) | ✅ CORRECT |
|---|
| loginWithProvider('google')
|
signInWithProvider('google')
| loginWithProvider('google')
|
| loginWithProvider('google')
|
signInWithEmailAndPassword(email, pw)
| loginViaEmailPassword(email, pw)
|
| loginViaEmailPassword(email, pw)
|
| / | register({email, password})
|
| (no listener, call when needed) |
| |
Functions - WRONG vs CORRECT
| ❌ WRONG (hallucinated) | ✅ CORRECT |
|---|
functions.call('name', data)
| functions.invoke('name', data)
|
functions.run('name', data)
| functions.invoke('name', data)
|
callFunction('name', data)
| functions.invoke('name', data)
|
httpsCallable('name')(data)
| functions.invoke('name', data)
|
Integrations - WRONG vs CORRECT
| ❌ WRONG (hallucinated) | ✅ CORRECT |
|---|
| integrations.Core.InvokeLLM({prompt})
|
| integrations.Core.InvokeLLM({prompt})
|
| integrations.Core.InvokeLLM({prompt})
|
sendEmail(to, subject, body)
| integrations.Core.SendEmail({to, subject, body})
|
| integrations.Core.SendEmail({to, subject, body})
|
| integrations.Core.UploadFile({file})
|
| integrations.Core.UploadFile({file})
|
Entities - WRONG vs CORRECT
| ❌ WRONG (hallucinated) | ✅ CORRECT |
|---|
entities.Task.find({...})
| entities.Task.filter({...})
|
entities.Task.findOne(id)
| |
entities.Task.insert(data)
| entities.Task.create(data)
|
| |
entities.Task.onChange(cb)
| entities.Task.subscribe(cb)
|
SDK Modules
| Module | Purpose | Reference |
|---|
| CRUD operations on data models | entities.md |
| Login, register, user management | auth.md |
| AI conversations and messages | base44-agents.md |
| Backend function invocation | functions.md |
| AI, email, file uploads, custom APIs | integrations.md |
| OAuth tokens (service role only) | connectors.md |
| Track custom events and user activity | analytics.md |
| Log user activity in app | app-logs.md |
| Invite users to the app | users.md |
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:
Important: Never assume or hardcode the
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 as the parameter name:
javascript
import { createClient } from "@base44/sdk";
// ✅ CORRECT
const base44 = createClient({ appId: "your-app-id" });
// ❌ WRONG - Do NOT use these:
// const base44 = createClient({ clientId: "your-app-id" }); // WRONG
// const base44 = createClient({ id: "your-app-id" }); // WRONG
Required parameter: (string) - Your Base44 application ID
Optional parameters:
- (string) - Pre-authenticated user token
- (object) - Configuration options
- (function) - Global error handler
Example with error handler:
javascript
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 →
- Import data from file →
entities.importEntities()
- Realtime updates →
entities.EntityName.subscribe()
User management?
- Login/register/logout →
- Get current user →
- Update user profile →
- Invite users →
AI features?
- Chat with AI agents → (requires logged-in user)
- 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 →
- 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) → (backend only)
Tracking and analytics?
- Track custom events →
- Log page views/activity →
Common Patterns
Filter and Sort Data
javascript
const pendingTasks = await base44.entities.Task.filter(
{ status: "pending", assignedTo: userId }, // query
"-created_date", // sort (descending)
10, // limit
0 // skip
);
Protected Routes (check auth)
javascript
const user = await base44.auth.me();
if (!user) {
// Navigate to your custom login page
navigate('/login', { state: { returnTo: window.location.pathname } });
return;
}
Backend Function Call
javascript
// Frontend
const result = await base44.functions.invoke("processOrder", {
orderId: "123",
action: "ship"
});
// Backend function (Deno)
import { createClientFromRequest } from "npm:@base44/sdk";
Deno.serve(async (req) => {
const base44 = createClientFromRequest(req);
const { orderId, action } = await req.json();
// Process with service role for admin access
const order = await base44.asServiceRole.entities.Orders.get(orderId);
return Response.json({ success: true });
});
Service Role Access
Use
in backend functions for admin-level operations:
javascript
// User mode - respects permissions
const myTasks = await base44.entities.Task.list();
// Service role - full access (backend only)
const allTasks = await base44.asServiceRole.entities.Task.list();
const token = await base44.asServiceRole.connectors.getAccessToken("slack");
Frontend vs Backend
| Capability | Frontend | Backend |
|---|
| (user's data) | Yes | Yes |
| Yes | Yes |
| Yes | Yes |
| Yes | Yes |
| Yes | Yes |
| Yes | Yes |
| Yes | Yes |
| Yes | Yes |
| No | Yes |
| No | Yes |
Backend functions use
and
createClientFromRequest(req)
to get a properly authenticated client.