This repository contains a simple decision engine system that allows non-technical users to design algorithmic decision policies through a visual interface and put them into production without programming knowledge.
The decision engine consists of four main components:
- ConfigFrontend: A React-based web application that provides a visual block-based interface for policy creation
- ConfigBackend: A FastAPI service that stores and manages policy configurations
- PolicyDB: A storage system for persisting policy data (implemented as file-based storage for simplicity)
- ExecutionEngine: A REST API that evaluates input data against the stored policy and returns decisions
- A policy creator designs a decision policy using the ConfigFrontend's visual editor
- The policy is saved via the ConfigBackend and stored in the PolicyDB
- Customer systems can then send data to the ExecutionEngine
- The ExecutionEngine evaluates the data against the stored policy and returns the decision result
Policies are represented as directed graphs in the frontend and as nested tree structures in the backend:
- Each node represents a decision point or outcome
- Conditional nodes have "yes" and "no" branches
- End nodes contain the final decision value
- The structure supports arbitrary nested conditions
Follow these steps to run the entire decision engine system.
- Node.js v18.18+ (for frontend)
- pnpm v9.12+ (for frontend)
- Python 3.9+ (for backend)
- Git
-
Clone the repository
-
Install and run the backend (in one terminal):
cd backend pip install -r requirements.txt uvicorn app.main:app --reload
The backend will run at http://localhost:8000
-
Install and run the frontend (in another terminal):
cd frontend pnpm install pnpm run dev
The frontend will run at http://localhost:5173
For more detailed instructions and documentation:
- Frontend: See frontend/README.md
- Backend: See backend/README.md
- Open the frontend application in your browser
- Use the interface to design your policy:
- Add Conditional blocks to check input variables
- Edit the End blocks to specify decision values
- Save your policy by clicking the "Save Policy" button
Once a policy is created, you can test it using:
curl -X 'POST' \
'http://localhost:8000/execution/execute' \
-H 'Content-Type: application/json' \
-d '{
"age": 20,
"income": 2000
}'
For more example requests, refer to the backend/README.md.