[Open Source] Lightweight Real-Time Risk Control Engine for Anti-Fraud Scenarios, with Minimal Configuration and Out-of-the-Box Usability
![[Open Source] Lightweight Real-Time Risk Control Engine for Anti-Fraud Scenarios, with Minimal Configuration and Out-of-the-Box Usability](https://yy123.ink/api/img/1782593404456-9fg20e.jpg)
1. Project Overview
Risk Control Engine (Radar)
A lightweight real-time risk control engine built with the Java language and frameworks such as Springboot, Mongodb, Groovy, and Es. It is suitable for anti-fraud application scenarios, features extremely simple configuration, and truly delivers out-of-the-box usability.
By learning this project, you can quickly understand the definition of risk, quantify risks , and ultimately achieve centralized risk management.
A real-time risk analysis engine,which can update risk rule in real-time and make it effective immediately.
It applies to the anti-fraud application perfectly. The project code called Radar, like the code, monitor the transaction at the back.
2. Open Source License
Using MulanPSL-2.0 open source protocol
3. Screenshots
Model Configuration
Create a New Model
When first getting familiar with the system, it is recommended to select the template option to create a model.
Field Management
View the fields of the model you just created, and modify or add fields to adjust the model.
Preprocessing Fields
The system comes with several plugins for transforming and processing raw fields.
Feature Processing
Define the metrics we need to monitor.

Activation Strategy Set Management
The entire risk quantification process takes place here. This is the model's output stage, where several features are combined for comprehensive scoring. Typically, two score thresholds are defined: an approval threshold (a low score indicates that manual review is required,
and a rejection threshold, indicating that the transaction can be rejected directly).

Build Model
Click Build Model, and Mongodb and ES will create index information for the model.
Activate Model
Finally, be sure to click the Activate button. You're all set!
The model has been created. Let's test it right away!
4. Feature Overview
Project characteristics
-
Real-time risk control, with response times within 100ms in specific scenarios.
-
Visual rule editor with a rich set of operators and flexible calculation rules.
-
Supports Chinese, making it easier to use.
-
Customizable rule engine for greater flexibility and support for complex, changing scenarios.
-
Plugin-based design for quickly integrating with other data capability platforms.
-
NoSQL, easy to scale, and high performance.
-
Simple configuration, ready to use out of the box!
Background
With the rapid development of the mobile internet, coupon hunters and promotional abusers have quickly emerged, moving from one platform to another and leaving chaos in their wake. However, this is not the worst part. The underground black market that follows has become a major threat to most internet applications. Newly launched apps typically offer generous promotional benefits, have incomplete risk control systems, and are more likely to contain discoverable bugs. Criminal groups exploit these bugs to cause enormous losses to platforms in a short period. One example is a certain group-buying platform that reportedly lost millions overnight due to a test promotion coupon worth 100 yuan. In response to this phenomenon, having a real-time risk control engine has become an urgent priority for all apps with financial characteristics. Radar was created to address this need. Radar originated as an internal research project at the author's former company. Due to various reasons, the project failed to achieve commercial success. Considering its inherent value, abandoning it would have been a waste. It has now been refactored using Springboot, with many localized features removed and only the core risk control engine retained. The result is more generic, lightweight, and less costly to extend through secondary development. It is now open source, and we hope it will help those of you who need risk control capabilities.
Project Background
As we know, when an enterprise grows, it usually develops many product lines, and almost every product requires risk control. Typically, we embed risk control logic directly into the corresponding business code. A large amount of duplicated risk control logic becomes tightly coupled with our business logic. Over time, the code becomes extremely complex, resulting in substantial labor costs and risks during subsequent maintenance.
Therefore, centralized risk management is essential. A better approach is to use a unified management platform and a rule engine, adopt visual configuration, and manage risk control strategies for different products through a centralized platform. This is precisely the original intention behind Radar.
5. Tech Stack
Project Architecture
Frontend-Backend Separated Architecture
Backend Technology Stack:
SpringBoot + Mybatis + tkMapper + Mysql + MongoDB + Redis + Groovy + ES + Swagger
Frontend Technology Stack:
React(SPA)
Architecture Diagram

Technical Selection
-
Springboot: The author comes from a Java background, so choosing Springboot is a natural decision. It is convenient for personal development and makes extension easier for other Java developers.
-
Mybatis + tkMapper: Persistence layer framework. tkMapper provides generic mapper templates to reduce repetitive code generation.
-
Mysql: The relational database used in this project, primarily for storing metadata about risk models.
-
MongoDB: Used to store event JSON data and provide basic statistical calculations (such as max, min, sum, and avg). More complex statistical concepts (sd, variance, etc.) are calculated in memory.
-
ES: Provides data query and rule-hit reporting services.
-
Redis: Provides caching support. Engine uses the publish-subscribe feature to listen for configuration updates from the management console.
-
Groovy: The rule engine. All risk control rules are ultimately converted into Groovy scripts, supporting real-time editing, dynamic generation, and immediate activation.
-
Swagger: REST API management
User Manual
See the README.md documentation for details