Skip to content

cerbos/cerbos-sdk-javascript

Repository files navigation

Cerbos JavaScript SDK

Cerbos helps you super-charge your authorization implementation by writing context-aware access control policies for your application resources. Author access rules using an intuitive YAML configuration language, use your Git-ops infrastructure to test and deploy them, and make simple API requests to the Cerbos policy decision point (PDP) server to evaluate the policies and make dynamic access decisions.

The Cerbos JavaScript SDK makes it easy to interact with the Cerbos PDP from your Node.js and browser-based applications.

Packages

For server-side Node.js applications, the @cerbos/grpc package provides a client (GRPC) for interacting with the Cerbos PDP service over gRPC.

For browser-based applications, the @cerbos/http package provides a client (HTTP) for interacting with the Cerbos PDP service over HTTP.

You can make also authorization decisions on-device or at the edge without network access to a Cerbos PDP service using embedded PDPs generated by Cerbos Hub. The @cerbos/embedded package provides a client (Embedded) for interacting with embedded PDPs.

All clients extend the base Client class from @cerbos/core, so they can be used interchangeably in isomorphic applications.

In React applications, you can use the @cerbos/react package to use an HTTP or Embedded client in your components via hooks.

To instrument the clients with OpenTelemetry, use the @cerbos/opentelemetry package.

To load Cerbos policies from YAML or JSON files, use the @cerbos/files package.

Further reading

Get help