Isomorphic Authorization JavaScript library
import { createMongoAbility, AbilityBuilder } from '@casl/ability';
// define abilities
const { can, cannot, build } = new AbilityBuilder(createMongoAbility);
can('read', ['Post', 'Comment']);
can('manage', 'Post', { author: 'me' });
can('create', 'Comment');
// check abilities
const ability = build();
ability.can('read', 'Post') // true
Isomorphic
Complementary packages make integration with major Frontend Frameworks and Backend ORMs effortless
Versatile
Easily scales between a claim based and subject/attribute based authorization.
Serializable
Allows to share permissions between UI, API and microservices
TypeSafe
Written in TypeScript, that makes your apps safer and developer experience more enjoyable
Tree shakable
The core is only 6KB mingzipped and can be even smaller!