RegoLab is a modern, interactive playground for developing, testing, and evaluating Open Policy Agent (OPA) Rego policies. It provides a seamless environment to write policies, define input/data JSON, and see evaluation results in real-time.
- Unified Prototyping Environment: Develop policies with a cohesive view of your Rego code, Input JSON, and Data context side-by-side.
- Rich Template Library: Jumpstart development with pre-built templates for common scenarios like Kubernetes Admission, Terraform, and API Authorization.
- Real-time Feedback Loop: Instant evaluation and testing against a live OPA instance, with integrated linting via Regal to catch issues early.
- Data & Input Simulation: Rapidly mock external data sources and input payloads using a curated collection of templates to simulate real-world conditions.
- Policy Management: Organize, save, and export your policy experiments with ease.
The easiest way to run RegoLab is using Docker.
docker-compose up -dOpen your browser and navigate to http://localhost:3000.
To run the project locally for development:
- Node.js (v18+)
- Open Policy Agent (OPA) installed and available in your PATH.
- Regal (optional) for linting support.
The backend is a Fastify server that manages policy files and executes OPA commands.
cd backend
npm install
npm run devThe backend will start on port 4000.
The frontend is a Next.js application.
cd frontend
npm install
npm run devThe frontend will start on port 3000.
- Frontend: Next.js (React) with Tailwind CSS and Shadcn UI.
- Backend: Fastify (Node.js) API that manages policy files.
- OPA: Official Open Policy Agent binary for policy evaluation.
- Regal: Official Open Policy Agent Language Server and Linter.
- CodeMirror 6: An extensible code editor component used for the policy and JSON editors, providing syntax highlighting and editing features.
