Quick Start
A quick start guide to start using Permix and validating your permissions
Try Permix
Want to explore Permix before installing? Try our interactive sandbox environment where you can experiment with type-safe permissions management right in your browser.
Installation
Install Permix
Typically you'll need to install Permix using your package manager:
npm install @aminzoubaa/permixCreate an instance
To create a base instance, you need to provide a schema as a generic type to createPermix function that defines your permissions:
import { createPermix } from '@aminzoubaa/permix'
export const permix = createPermix<{
post: {
action: 'create' | 'read' | 'update' | 'delete'
}
}>()
// ...Learn more about features and configuration of instances in the instance guide.
Setup your permissions
You can setup your permissions by calling setup method on your instance in any place you want:
// ...
// Call setupPermissions in your application
export function setupPermissions() {
permix.setup({
post: {
create: true,
read: true,
update: true,
delete: false,
},
})
}Check permissions
After setup, you can use check method to check available permissions:
permix.check('post', 'create') // trueIntegrations
Continuing from the quick start, you can now explore how Permix integrates with other libraries and frameworks.
React
Integration with React via provider and hook.
Next.js
App Router guidance for snapshots, caching, invalidation, Hono, and tRPC.
Vue
Integration with Vue via plugin and composable.
Node.js
Integration with Node.js via middleware.
Hono
Integration with Hono via middleware.
Express
Integration with Express via middleware.
tRPC
Integration with tRPC via middleware.
Reference Apps
If you prefer learning from working projects, these are the official Next.js reference apps shipped in the repository.
Next Minimal
The smallest supported App Router integration with a protected page, API route, and client UI guard.
Next Repros
Focused red-to-green repro cases for caching, hydration, layout guards, Hono, and tRPC.
Next Blog CMS
A larger multi-role demo with SQLite, impersonation, nested routes, and protected APIs.