Back to Keystone

Keystone-6 Roles-based Access Example

examples/usecase-roles/README.md

2026-03-191016 B
Original Source

Keystone-6 Roles-based Access Example

šŸ‘‹ This example demonstrates how you can set up a powerful, custom roles-based access control system with Keystone for an otherwise very simple to-do app.

Roles are stored in a list, and each user is related to a role. Each role has a granular set of permissions selected from the available checkboxes.

Role permissions are loaded at the start of the request for the current user, and cached in the session object for use in the access control methods and hooks.

The permissions affect both the Admin UI and GraphQL API.

NOTE this example is WIP. See schema.ts for the spec and current status.

Running the example

To run the project locally:

  • Clone this repo
  • Run pnpm install in the root (this repo is a monorepo and uses pnpm workspaces, so that will install everything you'll need)
  • Open this folder in your terminal and run pnpm dev

If everything works šŸ¤ž the GraphQL Server and Admin UI will start on localhost:3000