Installation
Get started with RBAC Algorithm in less than 5 minutes.
Choose Your Language
- Python
- JavaScript/Node.js
- Go
- Java
- C#/.NET
Requirements
- Python 3.8 or higher (tested on Python 3.13)
- pip
- Git (for cloning repository)
Installation Steps
1. Clone the Repository
git clone https://github.com/yourusername/rbac-algorithm.git
cd rbac-algorithm
2. Create Virtual Environment (Recommended)
# Create virtual environment
python -m venv venv
# Activate it
# On Windows:
venv\Scripts\activate
# On Linux/Mac:
source venv/bin/activate
3. Install Dependencies
# Install in development mode
pip install -e .
# Or install dependencies manually
pip install dataclasses-json typing-extensions
4. Verify Installation
from rbac import RBAC
# Initialize RBAC
rbac = RBAC()
print("RBAC Algorithm successfully installed!")
print(f"Storage: {type(rbac.storage).__name__}")
Run Examples
# Run basic usage example
python examples/basic_usage.py
# Run ABAC example
python examples/abac_example.py
Requirements
- Node.js 16 or higher
- npm or yarn
Install via npm
npm install rbac-algorithm
Install via yarn
yarn add rbac-algorithm
Verify Installation
const { RBAC } = require('rbac-algorithm');
console.log(RBAC.version);
Requirements
- Go 1.19 or higher
Install
go get github.com/your-org/rbac-algorithm
Verify Installation
package main
import (
"fmt"
"github.com/your-org/rbac-algorithm"
)
func main() {
fmt.Println(rbac.Version)
}
Development Installation
If you want to contribute or customize the library:
Clone the Repository
git clone https://github.com/your-org/rbac-algorithm.git
cd rbac-algorithm
Install Dependencies
- Python
- JavaScript
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install in development mode
pip install -e ".[dev]"
# Run tests
pytest
# Install dependencies
npm install
# Run tests
npm test
# Build
npm run build
Storage Backends
By default, RBAC Algorithm uses in-memory storage. For production, you'll want a persistent storage backend:
PostgreSQL
pip install rbac-algorithm[postgres]
MongoDB
pip install rbac-algorithm[mongodb]
Redis
pip install rbac-algorithm[redis]
MySQL
pip install rbac-algorithm[mysql]
See Custom Storage Guide for details.
Docker
Run RBAC Algorithm in a container:
docker pull rbac-algorithm/rbac-algorithm:latest
docker run -p 8080:8080 rbac-algorithm/rbac-algorithm:latest
Troubleshooting
Python: Module Not Found
# Ensure pip is up to date
pip install --upgrade pip
# Install with verbose output
pip install -v rbac-algorithm
Node.js: Permission Errors
# Use npx or install globally with sudo
sudo npm install -g rbac-algorithm
Version Conflicts
# Check installed version
pip show rbac-algorithm # Python
npm list rbac-algorithm # Node.js