Open-source High-performance authorization engine for RBAC, ReBAC, and ACL. Multi-tenant policy engine
Project description
KeyNetra
Policy-driven authorization control plane for applications that need deterministic, explainable access decisions across RBAC, ACL, and ReBAC.
What KeyNetra Provides
- Authorization engine with deterministic evaluation and explain traces
- FastAPI API server and operational CLI
- Multi-tenant policy evaluation with strict tenancy controls
- Policy lifecycle operations (validation, compile, simulation, impact analysis)
- Caching and access indexing for low-latency checks
- Structured logging, metrics, and dashboard-ready monitoring
- Deployment assets for Docker, Kubernetes, and Helm
Architecture
Layering is enforced through import contracts:
keynetra.api-> transport onlykeynetra.services-> orchestration and runtime flowkeynetra.engine-> pure policy decision logickeynetra.domain-> shared models/schemaskeynetra.infrastructure-> repositories, storage, cache adapterskeynetra.config-> configuration loading and guardrails
Detailed architecture notes: ARCHITECTURE.md
Quick Start (Local)
1) Setup
python3.11 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt -r requirements-dev.txt
pip install -e .
cp .env.example .env
2) Run API
keynetra serve --host 0.0.0.0 --port 8080
3) Health and Docs
curl -i http://localhost:8080/health/ready
open http://localhost:8080/docs
4) First Authorization Check
curl -s -X POST http://localhost:8080/check-access \
-H "Content-Type: application/json" \
-H "X-API-Key: devkey" \
-H "X-Tenant-Id: acme" \
-d '{
"user": {"id": "u1", "role": "admin"},
"action": "read",
"resource": {"resource_type": "document", "resource_id": "doc-1"},
"context": {}
}'
CLI Usage
Entrypoint is standardized to keynetra:
keynetra --help
keynetra check-openapi
keynetra migrate --confirm-destructive
keynetra doctor --service core
API Surface (Core)
POST /check-accessPOST /check-access-batchPOST /simulatePOST /simulate-policyPOST /impact-analysisGET /health,GET /health/ready,GET /metrics
OpenAPI contracts:
Multi-Tenant and Security
- Tenant-aware request flow and storage isolation
- Strict tenancy mode available via
KEYNETRA_STRICT_TENANCY=true - API key and JWT auth support
- Admin auth flow for privileged operations
- Rate limiting and request correlation IDs
See SECURITY.md for security policy and reporting.
Observability and Monitoring
KeyNetra exposes Prometheus metrics at GET /metrics including:
- HTTP request count/latency/error metrics
- Authorization decision and stage latency metrics
- Cache hit/miss metrics
- DB query latency metrics
- Tenant activity dimensions
Monitoring assets:
- Prometheus config:
monitoring/prometheus/prometheus.yml - Grafana dashboard:
monitoring/grafana/dashboards/keynetra-overview.json - Grafana provisioning:
monitoring/grafana/provisioning
Deployment
Docker
docker build -t keynetra:test .
docker run --rm -p 8080:8080 --env-file .env keynetra:test
Docker Compose (Full Dev/Obs Stack)
docker compose up --build
Includes:
- KeyNetra API
- PostgreSQL
- Redis
- Prometheus
- Grafana
- node-exporter
- Loki
Kubernetes
kubectl apply -f deploy/kubernetes/
Helm
helm install keynetra ./deploy/helm/keynetra
More deployment detail: DEPLOYMENT.md
SDKs
SDKs are maintained separately from this engine repository.
- Python SDK package:
keynetra-client - SDK guide:
SDK_GUIDE.md
Example (Python SDK):
from keynetra_client import KeyNetraClient
client = KeyNetraClient("http://localhost:8080")
decision = client.check_access(
user={"id": "alice"},
action="read",
resource={"type": "document", "id": "doc-1"},
)
print(decision.allowed)
Developer Workflow
ruff check .
black --check .
pytest
lint-imports --config .importlinter
Convenience commands are available in Makefile.
Documentation Index
ARCHITECTURE.mdDEPLOYMENT.mdSDK_GUIDE.mdCONTRIBUTING.mdCODE_OF_CONDUCT.mdSECURITY.mdCHANGELOG.mddocs/README.md
Contributing
Contributions are welcome. Start with CONTRIBUTING.md and CODE_OF_CONDUCT.md.
License
Apache-2.0. See LICENSE.
Citation
@software{keynetra_2026,
title = {KeyNetra},
author = {KeyNetra Community},
year = {2026},
version = {0.1.1-beta},
url = {https://github.com/keynetra/keynetra}
}
Made with love ❤️ for KeyNetra Community.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file keynetra-0.1.1.tar.gz.
File metadata
- Download URL: keynetra-0.1.1.tar.gz
- Upload date:
- Size: 128.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b87a45c936a0fa7ed7bd5a2ecf92d5a49ffce9b791db6ef642d0870d76c0dd36
|
|
| MD5 |
24f0453a667586177db5153df6f3b1b1
|
|
| BLAKE2b-256 |
42f4de960f6ef43b2a74660fd41042a883f6a5d6c84cdeed67025f8b072ca639
|
Provenance
The following attestation bundles were made for keynetra-0.1.1.tar.gz:
Publisher:
release.yml on KeyNetra/keynetra
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
keynetra-0.1.1.tar.gz -
Subject digest:
b87a45c936a0fa7ed7bd5a2ecf92d5a49ffce9b791db6ef642d0870d76c0dd36 - Sigstore transparency entry: 1254924286
- Sigstore integration time:
-
Permalink:
KeyNetra/keynetra@2abb271b6f94b8cd0476edc4455f0e04b9a9ec4e -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/KeyNetra
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2abb271b6f94b8cd0476edc4455f0e04b9a9ec4e -
Trigger Event:
push
-
Statement type:
File details
Details for the file keynetra-0.1.1-py3-none-any.whl.
File metadata
- Download URL: keynetra-0.1.1-py3-none-any.whl
- Upload date:
- Size: 142.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01efeb4328969c0ab12a070bcb6e685c502e1c1bb3ce675604dd30f856cf78b8
|
|
| MD5 |
c79fa7297995c9e03a7048e2e4cfda41
|
|
| BLAKE2b-256 |
a1a0b53b2fef6c52f8f976c3826b94f8542f4ed414e2135e267ef45b5578b375
|
Provenance
The following attestation bundles were made for keynetra-0.1.1-py3-none-any.whl:
Publisher:
release.yml on KeyNetra/keynetra
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
keynetra-0.1.1-py3-none-any.whl -
Subject digest:
01efeb4328969c0ab12a070bcb6e685c502e1c1bb3ce675604dd30f856cf78b8 - Sigstore transparency entry: 1254924375
- Sigstore integration time:
-
Permalink:
KeyNetra/keynetra@2abb271b6f94b8cd0476edc4455f0e04b9a9ec4e -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/KeyNetra
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2abb271b6f94b8cd0476edc4455f0e04b9a9ec4e -
Trigger Event:
push
-
Statement type: