Skip to main content
The Base44 client is your interface to the Base44 SDK. It provides access to all SDK modules and automatically manages authentication tokens. You can use the client in two ways:
  • Inside Base44 apps: The client is automatically created and configured for you.
  • External apps: Create the client yourself to use Base44 as a backend for your own application.

Inside Base44 apps

When Base44 generates your app, the SDK client is pre-configured and ready to use.

Frontend client

In your frontend code, the client is already imported and available as base44.
import { base44 } from "@/api/base44Client";

// The client is pre-configured and ready to use
const user = await base44.auth.me();
const userTasks = await base44.entities.Task.filter({
  assignedTo: user.id,
  status: "pending",
});

console.log(`${user.name} has ${userTasks.length} pending tasks`);

Backend functions

In Base44-hosted backend functions, create the client from the incoming request. Base44 injects the necessary authentication headers automatically.
import { createClientFromRequest } from "npm:@base44/sdk";

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

  // Get the current user and their data
  const user = await base44.auth.me();
  const userTasks = await base44.entities.Task.filter({
    assignedTo: user.id,
    status: "pending",
  });

  return Response.json({
    user: user.name,
    pendingTasks: userTasks.length,
  });
});

External apps

When building your own application that uses Base44 as a backend, create and configure the client yourself using createClient().

Installation

Install the SDK via npm:
npm install @base44/sdk

Create the client

Create a client by providing your app ID, which you can find in the Base44 editor URL:
https://app.base44.com/apps/<your-app-id>/editor/...
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 (anonymous access)
const products = await base44.entities.Products.list();

User authentication

Authenticate users with email/password or other auth methods. The client automatically applies the token to subsequent requests.
import { createClient } from "@base44/sdk";

const base44 = createClient({
  appId: "your-app-id",
});

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

// Now operations use the authenticated user's permissions
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.
Service role authentication is only available in Base44-hosted backend functions. External backends can’t use service role permissions.
A client with service role authentication allows backend code to:
  • Access data and operations with the same permissions as your app’s admin.
  • Use admin modules like the connectors module.
To use service role authentication, access modules through base44.asServiceRole instead of directly on the client. For example, base44.asServiceRole.entities.Task.list() operates with admin permissions, while base44.entities.Task.list() uses the current user’s permissions. When using createClientFromRequest() in a backend function, the service role is automatically available:
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 });
});

See more