Sentinel Core is a high-performance, event-driven fraud detection engine built with Spring Boot, Kafka Streams, and H2. It processes financial transactions in real-time using a weighted scoring model to identify and block suspicious activity.
- Modern Java Stack: Optimized for Java 25, leveraging the latest JVM performance enhancements.
- Stream Processing: Sub-second fraud evaluation via Kafka Streams.
- Global State Store: Real-time user blacklisting using
GlobalKTablesynchronized across all nodes. - Asynchronous Audit: Decisions are saved to H2 and broadcast to a
fraud-decisionstopic without blocking the transaction flow.
- Producer: Transactions enter via REST -> Kafka
inbound-transactions. - Processor:
ScoringEngineruns rules (Blacklist, High Amount, etc.). - Sink: Results are persisted to H2 and sent to a decision topic.
This project is configured for SSL-secured Kafka (e.g., Aiven, Confluent). For security, sensitive credentials must be externalized using environment variables.
| Variable | Description |
|---|---|
KAFKA_BOOTSTRAP_SERVERS |
Your Kafka Broker URL |
SSL_TRUSTSTORE_LOCATION |
Absolute path to your .jks or .p12 truststore |
SSL_KEYSTORE_LOCATION |
Absolute path to your keystore |
SSL_PASSWORD |
Password for your SSL certificates |
Ensure your Kafka cluster is running and your environment variables are set, then run:
mvn spring-boot:runcurl -X POST http://localhost:8081/test/inject \
-H "Content-Type: application/json" \
-d '{
"transactionId": "tx-101",
"userId": "user_demo",
"amount": 250.00,
"currency": "USD",
"ipAddress": "1.1.1.1",
"timestamp": 1713772800
}'Expected Result: APPROVE (Score: 0)
curl -X POST "http://localhost:8081/test/blacklist/add?userId=MALICIOUS_USER"- Trigger the Fraud Rule
curl -X POST http://localhost:8081/test/inject \
-H "Content-Type: application/json" \
-d '{
"transactionId": "tx-102",
"userId": "MALICIOUS_USER",
"amount": 10.00,
"ipAddress": "1.1.1.1",
"timestamp": 1713772800
}'Expected Result: REJECT (Score: 100, Reason: Global User Blacklist)
You can inspect the decision history via the built-in H2 Console:
URL: http://localhost:8081/h2-console/
JDBC URL: jdbc:h2:mem:fraud_db
Query: SELECT * FROM RISK_RESULT ORDER BY processed_at DESC;
This project is licensed under the MIT License.