Server functions

Use functions.define or defineFunction from @backifydev/sdk to declare server-side work. A function can require named permissions or allow anonymous calls when appropriate. Put privileged operations, including secret access, in server functions rather than browser code.

import { defineFunction } from "@backifydev/sdk";

export const getProfile = defineFunction({
  permissions: ["profile:read"],
  handler: async ({ user }) => ({ id: user?.id }),
});

Backify discovers function declarations during application analysis and makes them available to the app runtime.