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. When Base44 generates your app, it automatically creates and configures the SDK client for you. The client is available in both frontend and backend environments, with different usage patterns for each. In backend code, the client can also use the service role to operate with the same access as your app’s admin.

Frontend client

When Base44 generates your app, the SDK client is pre-configured and already imported in your frontend code. You’ll find it 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 client

In backend functions, Base44 creates a client from the incoming request.
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,
  });
});

Service role

By default, the client operates with user-level permissions, limiting access to what the current user can see and do. In backend code, you can use the service role to perform operations with the same access as your app’s admin. Service role access is only available in backend environments. 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 and sso modules.
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 the same access as your app’s admin, while base44.entities.Task.list() uses the current user’s permissions.
import { createClientFromRequest } from "npm:@base44/sdk";

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

  // Access all tasks the admin can see
  const allTasks = await base44.asServiceRole.entities.Task.list();

  return Response.json({
    tasks: allTasks,
  });
});

See more