react-access-engine logo

Unified access
control for React

RBAC, ABAC, policy engine, feature flags, A/B experiments, plan gating, and remote config in a single, type-safe, tree-shakeable package.

$npm i react-access-engine
220 tests~4KB gzipped0 deps
App.tsx
import { defineAccess, AccessProvider, Allow, Feature }
  from 'react-access-engine'

const config = defineAccess({
  roles: ['viewer', 'editor', 'admin'],
  permissions: {
    viewer: ['posts:read'],
    editor: ['posts:read', 'posts:write'],
    admin:  ['*'],
  },
  features: {
    'dark-mode': true,
    'ai-assist': { allowedPlans: ['pro'] },
  },
})

function App() {
  return (
    <AccessProvider config={config} user={user}>
      <Allow permission="posts:write">
        <Editor />
      </Allow>
      <Feature name="ai-assist">
        <AIPanel />
      </Feature>
    </AccessProvider>
  )
}

Everything you need for access control

Stop stitching together RBAC libraries, feature flag services, and experiment platforms.

RBAC & ABAC

Role-based and attribute-based access control with wildcard permissions, namespace support, and composable rules.

Policy Engine

Declarative policy rules with allow/deny effects, priority ordering, custom conditions, and resource-level attribute checks.

Feature Flags

Declarative feature gates with role targeting, plan gating, environment scoping, dependencies, and deterministic rollouts.

Rollouts & Segments

Progressive percentage rollouts, user segmentation, and environment-based targeting for controlled feature releases.

A/B Experiments

SSR-safe experiment assignment with percentage-based bucketing, deterministic hashing, and variant tracking.

Plan Gating

Hierarchical subscription plans with automatic tier comparison. Gate features and UI by the user's current plan.

Remote Config

Load access configuration remotely with stale-while-revalidate caching, polling, and optional signature verification.

Plugin System

Extensible plugin architecture with hooks for access checks, feature evaluations, policy evaluations, and custom condition operators.

DevTools

Built-in devtools overlay with real-time access checks, feature evaluations, policy traces, and config inspection.

Type-Safe & SSR-Ready

Full TypeScript inference with InferRoles, InferPermissions, InferFeatures. SSR-safe — works with Next.js App Router.

Why react-access-engine?

Compare with combining separate RBAC libraries, feature flag services, and DIY solutions.

FeatureRAERBAC LibFlag ServiceDIY
RBAC with wildcard permissionsPartial
ABAC / Policy enginePartial
Feature flags
A/B ExperimentsPartial
Plan / subscription gatingPartial
Remote config with polling
Plugin system
DevTools overlayPartial
SSR-safe (Next.js)PartialPartialPartial
Tree-shakeable
Zero dependencies
Type-safe inferencePartial

Ready to get started?

One provider, one config, total control.