Rolebook

How it works

How Rolebook decides who can do what

Rolebook answers one question across your entire product: may this person perform this action on this item? Here is how decisions work, what stays in your app, and every package that ships with it.

Decision receipt: Sam Lee, edit, project "Q3 report": Allowed
Request
Sam Lee → edit
project "Q3 report"
Editor of Acme
yes
Verdict
Allowed
Reason
Sam is an Editor of Acme.

One decision, three steps

Every check follows the same path across routes, background jobs, APIs, and share dialogs.

  1. Your app identifies the caller

    Pass the signed-in user and the scoped roles they hold on workspaces, projects, or folders, loaded from your database or sign-in provider.

  2. Your app loads the target item

    Load the project or document through your own tenant-scoped query, along with its parent workspace and organization.

  3. Rolebook decides and explains

    The engine evaluates your policy in-process with zero network calls, returning allow or a coded denial with the deciding rule.

Four ways to ask. One engine that answers.

Every deployment pattern evaluates the same policy with the same rules. Start in-process and combine others as your architecture grows.

  • rolebook

    In-process library

    Import the engine and run checks directly inside your TypeScript or JavaScript server with no database or network dependency.

    How it works: In-process library

  • @rolebook/server

    Sharing HTTP API

    Serve sharing operations to React components, browser clients, and Python, Go, or Rust SDKs using your own session for authentication.

    How it works: Sharing HTTP API

  • @rolebook/decision-service

    Decision service

    Answer single or batch checks over HTTP for services in other languages. Your authority provider loads the facts, and failures return a typed no-decision.

    How it works: Decision service

  • @rolebook/offline

    Signed offline checks

    Sign everything one check needs on your server. A device verifies the signature, expiry, and rollback state, then runs the same engine offline.

    How it works: Signed offline checks

Clear separation of responsibilities

Rolebook owns the permission decision. Your app stays the source of truth for identity, tenancy, and data.

Your application

  • Authenticates users and tracks which organizations they belong to.
  • Loads each user's scoped role assignments for the request.
  • Queries items through tenant-scoped paths along with their parent chain.
  • Decides what UI or HTTP response to return when access is denied.

Rolebook

  • Validates, compiles, and freezes your policy once at startup.
  • Evaluates every request consistently and fails closed on malformed input.
  • Explains each decision with a stable code, a plain reason, and the deciding rule.
  • With @rolebook/sharing: stores memberships, invitations, folder inheritance, and audit history in your own database, and streams signed webhooks.
  • With PostgreSQL, SQLite, and React: filters your tables to authorized items, checks access inside write transactions, and provides accessible sharing UI.
  • With the decision service and offline bundles: delivers the same answers to other services and disconnected devices.

Everything Rolebook ships

Four areas, each explained in plain words, with code where it helps and a link to the docs.

Ship enterprise-ready access control from day one.

Allow wisely.