@aminzoubaa/permix
v4.0.3
Published
Maintained fork of Permix, the type-safe permissions library originally created by Valerii Strilets, extended for production Next.js usage.
Maintainers
Readme
Permix
Permix is a lightweight, framework-agnostic, type-safe permissions management library for JavaScript applications on the client and server sides.
Fork Notice
@aminzoubaa/permix is a maintained public fork of the original permix package, which was created by Valerii Strilets.
This fork exists so the improved Next.js integration, multi-role composition, hydration fixes, examples, and test coverage can be used immediately in production projects without waiting for the upstream release cycle.
If you are looking for the original project, see:
- npm:
permix - GitHub: letstri/permix
Documentation
You can find the documentation here.
If you are using Next.js App Router, start with the dedicated Next.js guide and the official reference apps:
Example
To quick start you only need to write the following code:
import { createPermix } from '@aminzoubaa/permix'
const permix = createPermix<{
post: {
action: 'read'
}
}>()
permix.setup({
post: {
read: true,
}
})
permix.check('post', 'read') // truePermix has other powerful features, so check out the docs and the guided examples.
Migration
Permix 4.x is a major release line that improves SSR hydration and request-scoped Next.js usage. If you are upgrading from 3.x, read the migration guide before updating.
License
MIT License - see the LICENSE file for details
