Skip to main content
The entities module lets you work with your app’s data. Each entity type in your app has methods for creating, reading, updating, and deleting records. You access entity methods through your entity name: base44.entities.YourEntityName.methodName(). For example, if you have a Task entity, you use base44.entities.Task.list() to get a list of tasks.
Generate TypeScript types from your entities to get autocomplete and type safety. Run base44 types generate in your project, and all entity fields, methods, and return types will be fully typed. Learn more about dynamic types.

Permissions

Data access is controlled by the client’s authentication mode and your app’s permission rules. You can configure the permissions for each entity in your app’s security settings. Learn more about changing data permissions.
  • Anonymous users: Can only access entities marked as public.
  • Authenticated users: Can access entities and records they have permission to view or modify based on your app’s configured access rules.
  • Service role: Bypasses entity access rules and field-level security entirely. Has full read and write access to every entity and record in the app.
In backend code, you can use the service role to access data without access-rule restrictions.

Create records

Use create() to add new records to an entity:
const newTask = await base44.entities.Task.create({
  title: "Complete documentation",
  status: "pending",
  dueDate: "2024-12-31",
});
// After running: base44 types generate
const newTask = await base44.entities.Task.create({
  title: "Complete documentation",
  status: "pending",
  // TypeScript knows which fields exist
  // and validates their types
});

// Autocomplete works for fields
console.log(newTask.id);
console.log(newTask.created_date);

Read records

Retrieve data using get() for a single record, list() for all records, or filter() for records matching specific criteria. Use get() with a record ID to retrieve a specific record:
const task = await base44.entities.Task.get(taskId);
Use list() to retrieve all records. The method supports sorting, pagination, and field selection:
const tasks = await base44.entities.Task.list();
const tasks = await base44.entities.Task.list("-created_date");
const tasks = await base44.entities.Task.list(
  "-created_date",
  10, // limit
  20, // skip
);
const tasks = await base44.entities.Task.list(
  "-created_date",
  10,
  0,
  ["title", "status"], // only return these fields
);
Use filter() to find records that match specific criteria:
const pendingTasks = await base44.entities.Task.filter({
  status: "pending",
});
const urgentTasks = await base44.entities.Task.filter({
  status: "pending",
  priority: "high",
});
const recentTasks = await base44.entities.Task.filter(
  { status: "pending" },
  "-created_date", // Sort by created date, descending
);
const tasks = await base44.entities.Task.filter(
  { status: "pending" },
  "-created_date",
  10, // limit
  20, // skip
);

Update records

Use update() to modify an existing record:
await base44.entities.Task.update(taskId, {
  status: "completed",
});

Delete records

Use delete() to remove a single record:
await base44.entities.Task.delete(taskId);
Use deleteMany() to remove multiple records matching specific criteria:
const result = await base44.entities.Task.deleteMany({
  status: "completed",
  priority: "low",
});

Bulk operations

Use bulkCreate() to create multiple records in a single request:
const tasks = await base44.entities.Task.bulkCreate([
  { title: "Task 1", status: "pending" },
  { title: "Task 2", status: "pending" },
  { title: "Task 3", status: "in-progress" },
]);
Use importEntities() to import records from a CSV file. This is useful for migrating data or bulk uploads from user interfaces:
const handleFileUpload = async (event) => {
  const file = event.target.files?.[0];
  if (file) {
    const result = await base44.entities.Task.importEntities(file);
    console.log(`Imported ${result.output.length} records`);
  }
};
importEntities() requires a browser environment and cannot be used in backend code.

Realtime subscriptions

Use subscribe() to receive realtime updates when records are created, updated, or deleted:
const unsubscribe = base44.entities.Task.subscribe((event) => {
  console.log(`Task ${event.id} was ${event.type}d`);
  console.log("Updated data:", event.data);
});

// Later, clean up the subscription
unsubscribe();

Service role data access

By default, data access is scoped to the current user’s permissions. With service role authentication, you can read and write any data in your app. Entity access rules and field-level security are bypassed entirely, regardless of how the entity is configured. Use base44.asServiceRole.entities to access data without access-rule restrictions:
// User-level access (limited to current user's permissions)
const myTasks = await base44.entities.Task.list();

// Service role access (bypasses entity access rules)
const allTasks = await base44.asServiceRole.entities.Task.list();
Service role access skips every access rule on the entity. Use it only for trusted backend logic. If your function needs access checks, you’re responsible for enforcing them yourself.

User entity

Every Base44 app includes a built-in User entity that stores user account information. This entity has special security rules:
  • Regular users can only read and update their own user record
  • With service role authentication, you can read, update, and delete any user
  • You cannot create users through the entities module - use the auth module instead
You can add fields to the User entity to store additional user data, then use those fields in security rules to control data access or in your app to personalize the experience. See User Schema for details.
const allUsers = await base44.asServiceRole.entities.User.list();

See more

entities module

Complete API reference

Base44 client

Learn about the client and service role