# Rolebook vs Casbin: check a migration before you switch (https://rolebook.dev/compare/casbin)

Rolebook fits when you run a Casbin role model and want to compare both systems on real checks before enforcement changes.

Casbin's documentation describes a configurable model and a policy that its enforcer evaluates. [Casbin overview](https://casbin.apache.org/docs/overview/)

## Plan first, enforce later

`@rolebook/migrate` plans a Rolebook policy and assignments from your Casbin model and policy, and never writes or switches enforcement itself. It accepts one exact role-based subset and refuses anything else with a reason. Each generated role is assigned only at the object it came from.

## Alice can read one document and write another

In Casbin, Alice is an `editor` who may read `doc-1` and write `doc-2`. The plan gives her a read role at document 1 and a write role at document 2. So `document:read` on document 1 is `ALLOWED`, and `document:write` stays scoped to document 2, which makes it `NOT_GRANTED` on document 1.

In shadow, Casbin keeps enforcing while you replay checks through Rolebook. The report counts the disagreements it observed on the comparable checks you supplied and keeps a bounded set of redacted examples. When to switch is your call.

## In the Rolebook docs

- [Migrating from Casbin and role tables](https://rolebook.dev/docs/migrate)
- [All comparison guides](https://rolebook.dev/compare)
