Skip to main content
This is a detailed reference for the StackApp object. For setup instructions, see Setup.

Overview


HexclaveClientApp

A StackApp with client-level permissions. It contains most of the useful methods and hooks for your client-side code. Most commonly you get an instance of HexclaveClientApp by calling useHexclaveApp() in a Client Component.

Table of Contents

type HexclaveClientApp = {
  new(options): HexclaveClientApp;

  getUser([options]): Promise<User>;
  useUser([options]): User;
  getProject(): Promise<Project>;
  useProject(): Project;

  signInWithOAuth(provider): void;
  signInWithCredential([options]): Promise<...>;
  signUpWithCredential([options]): Promise<...>;
  sendForgotPasswordEmail(email): Promise<...>;
  sendMagicLinkEmail(email): Promise<...>;
};

Constructor

Creates a new HexclaveClientApp instance. Because each app creates a new connection to Hexclave’s backend, you should re-use existing instances wherever possible.
This object is not usually constructed directly. More commonly, you would construct a HexclaveServerApp instead, pass it into your app setup (see the setup guide), and then use the useHexclaveApp() hook to obtain a HexclaveClientApp.The setup wizard does these steps for you, so you don’t need to worry about it unless you are manually setting up Hexclave.If you’re building a client-only app and don’t have a SECRET_SERVER_KEY, you can construct a HexclaveClientApp directly.

User Management

hexclaveClientApp.getUser([options])

hexclaveClientApp.useUser([options])

hexclaveClientApp.getProject()

hexclaveClientApp.useProject()

Authentication

hexclaveClientApp.signInWithOAuth(provider)

hexclaveClientApp.signInWithCredential([options])

hexclaveClientApp.signUpWithCredential([options])

hexclaveClientApp.sendForgotPasswordEmail(email)

hexclaveClientApp.sendMagicLinkEmail(email)


HexclaveServerApp

Like HexclaveClientApp, but with server permissions. Has full read and write access to all users.
Since this functionality should only be available in environments you trust (ie. your own server), it requires a SECRET_SERVER_KEY. In some cases, you may want to use a HexclaveServerApp on the client; an example for this is an internal dashboard that only your own employees have access to. We generally recommend against doing this unless you are aware of and protected against the (potentially severe) security implications of exposing SECRET_SERVER_KEY on the client.

Table of Contents

type HexclaveServerApp =
  // Inherits all functionality from HexclaveClientApp
  & HexclaveClientApp
  & {
    new(options): HexclaveServerApp;

    getUser([id][, options]): Promise<ServerUser | null>;
    useUser([id][, options]): ServerUser;
    listUsers([options]): Promise<ServerUser[]>;
    useUsers([options]): ServerUser[];
    createUser([options]): Promise<ServerUser>;
    sendEmail(options): Promise<Result<void, KnownErrors>>;

    getTeam(id): Promise<ServerTeam | null>;
    useTeam(id): ServerTeam;
    listTeams([options]): Promise<ServerTeam[]>;
    useTeams([options]): ServerTeam[];
    listTeamsPaginated([options]): Promise<{ items: ServerTeam[]; nextCursor: string | null }>;
    useTeamsPaginated([options]): { items: ServerTeam[]; nextCursor: string | null };
    createTeam([options]): Promise<ServerTeam>;
  }

Constructor

Creates a new HexclaveServerApp instance.

User Operations

hexclaveServerApp.getUser([id], [options])

hexclaveServerApp.useUser([id], [options])

hexclaveServerApp.listUsers([options])

hexclaveServerApp.useUsers([options])

hexclaveServerApp.createUser([options])

hexclaveServerApp.sendEmail(options)

Team Management

hexclaveServerApp.getTeam(id)

hexclaveServerApp.useTeam(id)

hexclaveServerApp.listTeams([options])

hexclaveServerApp.useTeams([options])

hexclaveServerApp.listTeamsPaginated([options])

hexclaveServerApp.useTeamsPaginated([options])

hexclaveServerApp.createTeam([options])