- Overview
- Features
- File Structure
- Installation
- Usage
- API Endpoints
- Technologies Used
- Contributing
- License
The Rule Engine Application is a React-based web application designed to allow users to build, manage, and evaluate complex business rules. It provides a visual interface for creating rule conditions and evaluating them against data inputs. This project leverages a backend powered by Node.js, Express, and MongoDB to manage rules and their evaluation.
- Rule Building: Create new business rules with a visual interface.
- Rule Management: Edit, update, and combine existing rules.
- Rule Evaluation: Test rules against input data.
- Docker Support: The application supports containerization using Docker for easy deployment.
├── client/
│ ├── components/
│ │ ├── RuleBuilder.jsx # Component for building rules
│ │ ├── RuleEvaluator.jsx # Component for evaluating rules
│ │ └── RuleManager.jsx # Component for managing rules
│ └── RuleEngineApp.jsx # Main application component
├── server/
│ ├── api.js # API client for frontend
│ ├── server.js # Server setup and initialization
│ ├── seedAttributes.js # Seed file for database attributes
│ ├── evaluator.js # Logic for evaluating rules
│ ├── parser.js # Logic for parsing rules
│ └── ruleController.js # Controller for handling rule-related requests
├── Dockerfile # Dockerfile for building the application
└── README.md # This README file
-
Clone the repository:
git clone https://github.com/your-username/rule-engine-app.git cd rule-engine-app -
Install dependencies:
npm install
-
Setup MongoDB:
- Ensure MongoDB is running locally on
mongodb://localhost:27017/rule-engine.
- Ensure MongoDB is running locally on
** If there is a Need to chnage the Attributes Seed the database**:
```bash
node server/seedAttributes.js
```
-
Start the server:
npm start
-
Run the client (if using a separate React frontend):
cd client npm start
To build and run the application using Docker:
-
Pull Docker Image:
docker pull hit4man47/rule-engine-image:latest
-
Run the Docker Container:
docker run -d -p 27017:27017 --name rule-engine-db hit4man47/rule-engine-image:latest
-
Additional Docker Commands:
-
Pull Weather Mongo Image:
docker pull hit4man47/weather-mongo-image:latest
-
Run Weather Mongo Container:
docker run -d -p 27017:27017 --name weather-mongo-db hit4man47/weather-mongo-image:latest
-
Stop Weather Mongo Container:
docker stop weather-mongo-db
-
Remove Weather Mongo Container:
docker rm weather-mongo-db
-
- GET /api/rules - Fetch all rules.
- POST /api/rules - Create a new rule.
- PUT /api/rules/:id - Update an existing rule.
- GET /api/rules/:id/ast - Fetch AST of a rule.
- POST /api/evaluate - Evaluate a rule against data.
- GET /api/attributes - Fetch available attributes.
- POST /api/attributes - Create a new attribute.
- Frontend: React, TailwindCSS
- Backend: Node.js, Express, MongoDB
- API Client: Axios
- Data Modeling: Mongoose
- Containerization: Docker
Contributions are welcome! Please fork the repository and submit a pull request.
This project is licensed under the MIT License.