Skip to content

juspay/decision-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

390 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust License Docker Release Slack



⚡ Decision Engine

Routing control plane for payment decisions

Open-Source • Rust • Rule-Based • Success-Rate Based

Configure routing rules, run gateway decisions, and inspect routing outcomes from APIs or the dashboard.


🚀 Quick Start📚 Documentation🏗 Architecture🤝 Contributing


🎯 What is Decision Engine?

Decision Engine is a payment gateway routing service built in Rust. It selects a gateway for each request using merchant-configured routing strategy, success-rate scores, rule-based policies, volume splits, and debit-routing gates.

┌─────────────┐     ┌──────────────────┐     ┌─────────────┐
│  Payment    │────▶│  Decision Engine │────▶│  Best       │
│  Request    │     │  (Fast routing)  │     │  Gateway    │
└─────────────┘     └──────────────────┘     └─────────────┘

Core Use Cases

Use case Supported surface
Route by connector score Auth-rate based routing
Route by explicit business condition Rule-based routing
Roll out traffic by percentage Volume split
Gate debit-network routing per merchant Debit routing toggle
Inspect routing outcomes Analytics and Decision Audit dashboard

✨ Features

🧠 Intelligent Routing

Feature What It Does
Eligibility Check Filters out ineligible gateways before routing
Rule-Based Ordering Apply merchant-specific priority rules
Dynamic Ordering Success rate based gateway optimization
Downtime Detection Auto-pause failing gateways

🛠 Operational Surfaces

Capability Details
Dashboard Configure routing and inspect analytics/audit views
API reference OpenAPI-backed route documentation and curl examples
Analytics storage ClickHouse-backed analytics tables for local and deployed environments
Multi-DB app storage MySQL and PostgreSQL support
Deployment artifacts Docker Compose and Helm configuration are included

🏃 Quick Start

🐳 Docker (Recommended)

# Clone and run
git clone https://github.com/juspay/decision-engine.git
cd decision-engine
docker compose --profile postgres-ghcr up -d

# That's it! API ready at http://localhost:8080

For API + dashboard + docs:

docker compose --profile dashboard-postgres-ghcr up -d

Open:

  • API: http://localhost:8080
  • Dashboard: http://localhost:8081/dashboard/
  • Docs: http://localhost:8081/introduction
  • API documentation map: http://localhost:8081/api-overview

For deployed docs or dashboard environments, use the same docs paths under the deployed host, for example https://<docs-host>/api-overview. That page links to the API examples and OpenAPI reference sections.

🦀 From Source

# Prerequisites: Rust 1.85+, MySQL/PostgreSQL, Redis

git clone https://github.com/juspay/decision-engine.git
cd decision-engine
cargo build --release

# Configure
cp config.example.toml config/development.toml
# Edit config with your settings

# Run migrations & start
diesel migration run
./target/release/open_router

✅ Verify

curl http://localhost:8080/health
# → {"message":"Health is good"}

📖 Documentation

📘 Resource Description
Local Setup Guide Canonical guide for CLI, Docker, Compose profiles, and Helm
MySQL Setup Guide MySQL-specific walkthrough
PostgreSQL Setup Guide PostgreSQL-specific walkthrough
API Documentation Map Main API entrypoint with embedded links to API examples, OpenAPI schema pages, route access rules, local URLs, and deployed docs paths
Configuration Guide All config options explained
Deep Dive Blog How routing logic works

🏗 Architecture

High-Level Flow

Decision Engine Architecture

Integration Pattern

Decision Engine integrates seamlessly into your existing payment stack:

Integration Pattern

Integration Steps:

Step Direction Component Action
1 Your App Initiates payment request
2 Orchestrator Forwards to Decision Engine
3 Decision Engine Selects optimal gateway
4 Vault Returns card token (PCI-safe)
5 Gateway Processes payment
6 Gateway Returns result
7 Orchestrator Routes response back
8 Your App Receives final result

Key Benefits:

  • Zero PCI scope — Vault handles all card data
  • Drop-in integration — Works with any orchestrator
  • Intelligent fallback — Auto-switches on gateway failure

🗺 Roadmap

Status Feature Description
Rule-based routing Merchant-defined priority rules
Dynamic ordering SR-based gateway selection
Downtime detection Automatic health monitoring
Multi-database MySQL & PostgreSQL support
🔄 Enhanced routing models Better success rate prediction
🔄 Admin dashboard Visual rule management UI
📋 Multi-tenant analytics Per-tenant routing insights
📋 GraphQL API Alternative query interface

🤝 Contributing

We ❤️ contributions!

# 1. Fork & clone
git clone https://github.com/YOUR_USERNAME/decision-engine.git

# 2. Create branch
git checkout -b feature/your-feature

# 3. Make changes & test
cargo test

# 4. Submit PR!

👉 See CONTRIBUTING.md for guidelines.

🌱 New to open source? Check out good first issues!


💬 Community

Platform What It's For
Slack Real-time help, discussions
GitHub Discussions Ideas, feature requests
GitHub Issues Bug reports

📜 License

Licensed under GNU AGPL v3.0.


Built with ❤️ by Juspay

Reliable, open-source payments infrastructure for the world.

⬆ Back to Top

About

open-source routing system designed for payment processing

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors