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 via Agents
Using Claude Code, Cursor, or another agent that supports skills? Add Permix skills, then hand it this prompt to set up permissions for you:
npx skills add letstri/permixInstall and set up a base Permix architecture for this project.
1. Detect my stack (framework(s), server/client split, e.g. React, Vue, Solid,
Svelte, Next.js, TanStack Start, Node, Hono, Express, tRPC, oRPC, Fastify,
Elysia, Drizzle) and install `permix` plus the matching integration
package(s) from https://permix.letstri.dev/docs.
2. Scan the codebase for my real resources/entities (DB models, API routes,
UI sections) and design a `createPermix<...>` schema from them instead of
placeholder data.
3. Wire `permix.setup()` with actual rules for those resources, driven by my
auth/session/role data wherever it already exists.
4. Add server-side checks (middleware) on the matching integration and
client-side checks/guards in the relevant components or routes.
5. Follow the getting-started, setup, template, and framework integration
guides in the Permix skill for conventions and API shape.Or continue with the manual installation below.
Installation
Install a package
Typically you'll need to install Permix using your package manager:
npm install 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 'permix'
export const permix = createPermix<{
post: ['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.
Vue
Integration with Vue via plugin and composable.
Node.js
Integration with Node.js via middleware.
Server
Integration with native Request and Response handlers.
Hono
Integration with Hono via middleware.
Express
Integration with Express via middleware.
tRPC
Integration with tRPC via middleware.
Next.js
Integration with Next.js App Router.
TanStack Start
Integration with TanStack Start.
Solid
Integration with Solid via provider and hook.
Svelte
Integration with Svelte via provider and hook.
oRPC
Integration with oRPC via middleware.
Fastify
Integration with Fastify via plugin.
Elysia
Integration with Elysia via middleware.
Drizzle
Schema-driven permissions from Drizzle tables.
Effect
Integration with Effect services and layers.