Wednesday, July 30, 2025

๐Ÿ›ก️๐Ÿ›๐Ÿ’ก Lessons from the Battlefield: What I learnt from Shivaji Maharaj About Debugging, Docker, and Design


“When you are caught in a problem, think like Shivaji Maharaj — not just with strength, but with strategy.”

This is the philosophy I’ve have been trying to follow while building Fraud-Free Swarajya — my open source journey blending AI, microservices, and monitoring with the spirit of the great Maratha warrior king.

๐Ÿน A Warrior’s Lesson: The Escape from Agra

In 1666, Shivaji Maharaj was invited to Aurangzeb’s court in Agra — only to be insulted and imprisoned. But instead of surrendering to fate, he devised a plan. Disguised as a servant, hiding inside baskets of sweets meant for the poor, he escaped the Red Fort with calm precision.

This wasn’t brute force. It was intelligence. Patience. And execution.

Software is no different. During this journey, I ran into countless moments where the project felt stuck. But each issue, like that Agra captivity, had a way out.


๐Ÿณ Lesson #1: Docker Will Misbehave — Until It Doesn’t

  • Volume path errors, network misconfigurations, and silent container crashes
  • Prometheus wouldn't talk to Grafana until I used service_name:port correctly
  • Postgres was running fine but org.postgresql.Driver wasn't found until we added the dependency

๐Ÿง  Learning: Know your container’s perspective. Don’t assume localhost. Think like the container. Plan like Shivaji.


๐Ÿ“ˆ Lesson #2: Metrics Are Like Soldiers — Name and Organize Them Right

  • I renamed fraud_db to transaction_db to reflect its true role
  • Service names were standardized — tanaji-api, sindhudurg-app, etc.
  • This helped with intuitive dashboards, Prometheus scrapes, and readability

๐Ÿง  Learning: In battle, clarity of ranks and roles saves lives. In code, it saves hours.


๐Ÿค– Lesson #3: AI and Rules Must Co-Exist

  • Tanaji (AI) gives a fraud score
  • Dadoji (Rules Engine) interprets and explains the score
  • I avoided duplicate checks by planning the evaluation flow early

๐Ÿง  Learning: Like Shivaji’s council of advisors — combine instinct with reason, and let each do what it does best.


๐Ÿ”ฅ Lesson #4: Logs Are Your Sentries

  • Tanaji logs were not showing in Docker — fixed by properly structuring logging format
  • Clear message formats like [SCORING COMPLETE] helped during debugging

๐Ÿง  Learning: If the fort is under attack and no one rings the bell, it’s already too late. Let your logs speak clearly.


๐Ÿ“‹ Lesson #5: Testing Can Wait — But Shouldn’t Be Ignored

  • I paused unit testing to focus on the MVP
  • Learned that @SpringBootTest vs @WebMvcTest can massively affect load time and scope
  • Will return to write focused, lightweight unit tests with mocking

๐Ÿง  Learning: Even the strongest wall crumbles without mortar. Tests are the invisible glue.


๐Ÿ”” Lesson #6: Notification System — Coming Soon

I realized mid-way that fraud detection is not enough. The right system must be alerted asynchronously. I’ve added an event-driven notification module to the roadmap for SMS, Email, and Push alerts.

๐Ÿง  Learning: Don’t just fight. Communicate.


๐Ÿ“ฆ Lesson #7: Think Modular. Think Reusable.

  • Each module should be self-contained
  • Even Tanaji (AI) can be reused by others if its API is clean
  • Same for Dadoji (Rules Engine) and Kanhoji (Monitoring)

๐Ÿง  Learning: Shivaji Maharaj didn’t build one fort. He built a network of independent, resilient ones. So should we.


๐Ÿ›ค️ What’s Next?

  • Finish Dadoji core logic
  • Begin building Santaji (Feedback Loop)
  • Finalize event-based architecture
  • Write tests, documentation, and contributor guide

And yes — keep posting, keep learning, and keep the spirit alive. ๐Ÿ‡ฎ๐Ÿ‡ณ

Monday, July 21, 2025

๐Ÿ› ️ Tools I Rely On as a Java Solution Architect (And Why Less Is Often More)

In a world bursting with shiny dev tools, automation platforms, AI sidekicks, and ten-step CI/CD pipelines, here's my take:

The best engineers don’t use every tool — they master a few that truly matter.

As a Java Solution Architect (and lifelong software engineer), I’ve learned to lean on a curated toolbox that keeps me focused, productive, and sane. 

Let’s dive in.


๐Ÿง  The Whiteboard: Old School. Always Cool.

Before we even touch a keyboard, there’s this timeless tool — a simple whiteboard. There’s just something magical about uncapping that marker (bonus points if it’s got that nostalgic alcohol-ink smell), stepping up to the board, and thinking out loud.

  • Designing a system from scratch? Whiteboard.

  • Untangling a messy legacy flow? Whiteboard.

  • Prepping for a tough interview or explaining to a junior dev? Whiteboard.

This is where ideas are born without syntax errors.

And if you’re remote or hybrid, digital boards like Miro or Excalidraw get pretty close — but they’ll never beat a good old dry-erase rectangle and a marker that squeaks.

And who said you have to only draw system design diagrams on the whiteboard, you can sketch a portrait if you like... :)

Imagine doing that on draw.io ๐Ÿคฃ


๐Ÿงฉ Draw.io: Sketch It Clean

Once that messy-but-beautiful whiteboard session settles, Draw.io (a.k.a. diagrams.net) becomes the next step. It helps convert ideas into shareable, professional architecture diagrams.

It helps me not over-engineer the diagram. I can Keep it minimal, legible, and to the point. Your diagram should answer more questions than it creates.

๐Ÿ”น Mini Sidebar: UML — Still Around?

While formal UML usage has faded, I still borrow from it when drawing class or sequence diagrams.
Think of it as a useful sketch language, not a rulebook. Curious — are you still using UML in your daily work? I’d love to know how it fits into your design process today.


๐Ÿ’ฌ Brainstorming: The Underrated Superpower

Let’s get this straight: thinking alone is powerful, but sharing ideas multiplies them.

Sometimes the most valuable tool isn't a tool — it's your team. The junior dev who asks the obvious question. The product owner who brings a user perspective. The fellow architect who points out a blind spot.

I treat brainstorming like code reviews for thoughts. Structured, respectful, and open-ended. Great ideas don’t always appear in solitude — sometimes they arrive in Slack threads, coffee machine chats, or Zoom whiteboard sessions (Do I have to always mention a virtual alternative? ๐Ÿ‘ฟ.


๐Ÿงช Postman: API Gym

Postman is where your backend breathes and stretches. I use it to:

  • Hit endpoints while building REST APIs.

  • Create repeatable test suites for regression.

  • Share API collections with QA and frontend.

  • Mock services during parallel development.

Environments, variables, pre-scripts — it’s all there.

But again: keep it tight. Too many folders and half-documented requests are just noise. I know this but still find it hard to maintain. I keep falling back to the mess. Any ideas to help me better organized?


๐Ÿงน SonarQube: My Code’s Conscience

SonarQube doesn’t just tell me if the code works — it tells me if it’s healthy.

I use it to catch:

  • Code smells.

  • Security vulnerabilities.

  • Bad practices before they hit production.

Best part? It’s a silent enforcer of consistency across teams. Customize your quality gates and treat failed ones like red lights. Don’t override. Fix.


๐Ÿ› ️ Swagger/OpenAPI: API Clarity, Not Clutter

OpenAPI specs bring contract-first development to life. And with Swagger UI, your APIs are no longer these mysterious things hidden behind code — they’re self-explanatory portals.

Here’s how I use it:

  • Let frontend teams explore and test APIs without docs flying around.

  • Auto-generate API clients and keep them synced.

  • Define contracts early so multiple teams can work in parallel.


๐Ÿ“˜ README Files: The Unsung Hero

A good README is your project’s front porch. I use it to:

  • Outline setup steps clearly.

  • Explain the “why” behind tech choices.

  • Leave breadcrumbs for future devs (including future me).

  • Document API endpoints or design decisions quickly.

Minimalism applies here too. Don’t treat README like a dump yard. Treat it like an onboarding guide written by someone who respects your time.


๐Ÿง˜‍♂️ The Minimalist Stack Philosophy

There are 10,000+ tools out there, but I’d rather master 10 that matter.

Why?

  • Fewer tools = less cognitive switching.

  • Familiar tools = faster delivery.

  • Minimal stack = fewer moving parts, fewer things to break.

This isn’t anti-automation. It’s intentional automation.

If a tool solves a recurring pain, bring it in. If it adds more setup than value, toss it. 

๐Ÿค– ChatGPT: My Thought Partner, Not My Brain

This very post? Drafted with help from ChatGPT.

I use it daily to:

  • Review my own code and logic.

  • Explore trade-offs quickly.

  • Generate unit tests or boilerplate.

  • Simulate a second brain during solo design sessions.

It’s not perfect. It won’t replace deep thinking or architectural rigor. But it makes me faster, especially when I need a second pair of eyes or an explainer at 2 AM.


๐ŸŽฏ Wrapping It All Up: Tools, Flow & Focus

In software engineering, your tools shape your flow.
But it’s not about collecting the most — it’s about choosing wisely, going deep, and staying grounded.

So, what’s in my essential kit?

๐Ÿง  Whiteboard
๐Ÿงช Postman
๐Ÿ“ˆ SonarQube
๐Ÿ“˜ README files
๐Ÿงฐ Draw.io
๐Ÿ’ฌ Brainstorming
๐Ÿ› ️ Swagger/OpenAPI
๐Ÿค– ChatGPT
๐Ÿง˜‍♂️ A mindset of less, but better

If you're building systems, teams, or just yourself — hope it helps.

Now over to you:
What tool can’t you live without, and what’s one you’re glad you ditched?

Friday, July 18, 2025

๐Ÿฐ Why Enterprises Pick OpenShift on Cloud — While Startups Go All-In Native

Everyone’s moving to the cloud — but not everyone is doing it the same way.

Some teams dive head-first into a cloud provider’s native services, from CI/CD to databases to Kubernetes. Others take a more controlled path — choosing to run OpenShift on top of that cloud instead.

Why the difference? Let’s break it down.


☁️ Option 1: Going All-In with Managed Cloud-Native Services

Imagine you build your app directly on AWS, Azure, or GCP using:

  • Native Kubernetes (EKS / AKS / GKE)
  • Cloud-native CI/CD pipelines
  • Identity management (IAM / Azure AD / Google IAM)
  • Logging & Monitoring (CloudWatch, Azure Monitor, Cloud Logging)
  • Fully integrated services and PaaS components

✅ What You Gain:

  • Minimal Ops Overhead: Managed control plane, patching, scaling, etc.
  • Rapid Feature Delivery: Cloud-native services evolve quickly
  • Lower Cost of Ownership: Pay-as-you-go, no platform licenses
  • Built-in Ecosystem: Seamless integrations with cloud services
  • Tooling and Dev Experience: Great IDE and DevOps support

❌ What You Lose:

  • Vendor Lock-in: Deep ties to provider-specific APIs and IAM
  • Less Portability: Hard to move workloads across clouds or on-prem
  • Limited Governance: Shallow RBAC, multi-tenancy, and policy controls
  • Compliance Challenges: Some audit trails and enforcement may fall short

 ⛅️ Option 2: OpenShift on the Cloud (Any Provider)

This model means the cloud still provides the infrastructure (VMs, storage, networking), but the platform is OpenShift — bringing governance, CI/CD, policies, and developer experience.

It could be Red Hat-managed (like ARO, ROSA), or self-managed within your cloud subscription.

✅ What You Gain:

  • Enterprise Governance: Fine-grained RBAC, SCCs, quotas, etc.
  • Auditability & Compliance: More control over logs, TLS, security policies
  • Hybrid Cloud Ready: Same platform experience on any cloud or on-prem
  • Lifecycle Control: Full control over upgrades and platform policies
  • Multi-Tenancy: Projects isolate dev teams securely
  • Internal Tooling Integration: Easy to connect with internal systems

❌ What You Trade-Off:

  • Ops Overhead: You need a platform team or Red Hat support
  • Slower Start: Initial setup is more complex
  • Higher Cost: Platform + infra + support
  • Cloud Integration Effort: Need to wire up storage, IAM, etc.

๐Ÿค” Why Do Enterprises Still Choose OpenShift?

Because their top priorities aren’t just speed and cost. Their priorities are:

  • Governance
  • Compliance
  • Hybrid Flexibility
  • Standardization
  • Risk Management

For banks, insurers, and government bodies, having full control over the platform layer is worth the additional complexity.


๐Ÿ” Summary Table

Feature All-In Native Cloud OpenShift on Cloud
Ops Overhead ✅ Low ❌ Medium-High
Developer Velocity ✅ High ✅ High (with policies)
Platform Control ❌ Limited ✅ Full
Vendor Lock-in ❌ High ✅ Low
Compliance & Audit ⚠️ Limited ✅ Enterprise-grade
Multi-Tenancy ⚠️ Basic ✅ Strong, project-based
Hybrid Cloud Readiness ❌ Difficult ✅ Built-in
Cloud-native Integrations ✅ Seamless ⚠️ Requires effort

๐ŸŽฏ Final Thought

If you want speed, go native. If you want control, go OpenShift.

Startups thrive on agility and cost-efficiency. Enterprises invest in consistency, security, and governance.

Two paths. Both valid. Just shaped by different realities.

Wednesday, July 16, 2025

๐Ÿ”„ A Curious case of Redis vs Caffeine and ever existing Trade-offs

๐Ÿง  The Assumption

For years, I treated Redis as the default solution for caching.... after all

  • It's fast.
  • It supports persistence.
  • It’s distributed.
  • Everyone uses it.

It was one of those tools that seemed like an automatic “yes” whenever caching came up in any design discussion.

So naturally, when I started analyzing a high-performance OAuth server, I was fully expecting Redis to be at the heart of its caching layer.

But what I found instead was... Caffeine.

And that changed how I look at caching decisions entirely. I always knew its always a trade-off but we inherently bias towards our favorite solutions and we need to learn to stop and think.


๐Ÿงญ Lessons from Existing Code: Don’t Just Learn by Building

As engineers, we often think the best way to learn is to build from scratch. But this experience reminded me how much there is to learn from studying well-designed production systems — especially when built by expert teams operating in high-stakes environments like banking/fintech. Afterall why reinvent a wheel each time.

I didn't write the OAuth server. But reviewing its code, dissecting the reasoning, and understanding the performance considerations taught me as much as (if not more than) writing one myself.


๐Ÿ” Redis vs. Caffeine: Revisiting the Comparison

Feature Redis Caffeine
Location Remote (over network) In-JVM
Latency ~1-3 ms <1 ฮผs (nanoseconds)
Setup Needs deployment, scaling, monitoring Zero setup, embedded
Persistence Yes No
Cross-instance sharing Yes No (per instance)
Eviction policies LRU, TTL Advanced: size, frequency, TTL
Serialization overhead Yes None
Startup state Warm (centralized) Cold start
Failure handling Needs retry, backoff logic JVM-safe, no external calls

๐Ÿ” Why Redis Wasn’t Chosen — and Why That Makes Sense

1. The cache wasn’t critical to correctness

The cached data was:

  • Mostly static client configuration
  • Derivable from a database or config service
  • Frequently read, rarely updated

A cache miss wasn’t a system failure — just a slightly slower response.

2. Latency mattered more than persistence

In an OAuth server that processes thousands of token validations per second, even 1ms per lookup has measurable impact.

Redis: ~1-3ms
Caffeine: sub-millisecond (nanoseconds)

3. Simplicity wins in high-availability setups

Using Redis in a high performance/critical environment means:

  • Setting up secure connections (TLS)
  • Managing replication/failover
  • Ensuring Redis HA is as resilient as the app itself

Caffeine required none of that — it was a zero-dependency, drop-in cache with advanced eviction and tuning capabilities.

4. Each instance could function independently

The OAuth server didn’t require session sharing or cross-instance consistency. Local in-memory cache was not just acceptable — it was ideal.


๐Ÿง  Key Realization: The Best Tool is Use-Case Driven

Before this, I might have pitched Redis on auto-pilot. But this real-world implementation forced me to slow down and ask:

“What does this specific use case actually need?”

And the answer wasn’t persistence, or distributed state, or warm startup.

It was:

  • Speed
  • Simplicity
  • Per-instance safety
  • GC-aware eviction
  • Minimal moving parts

Caffeine was the better fit — not because Redis is bad, but because Caffeine aligned better with the real goals of the system.


๐Ÿšง Learning From Existing Systems

This wasn’t something I learned by building a new service from scratch.

It was something I learned by observing what had already been done well, and then understanding why those decisions were made.

We often glorify greenfield projects. But there is incredible value in studying the systems already running reliably in production.

Existing codebases, especially in complex environments are full of real, hard-earned lessons.


๐Ÿงญ Final Thought: It’s Always About Trade-offs

This experience brought me back to a fundamental truth of software engineering:

There is no best tool — only the best fit for the problem.

Redis is great — even amazing — when the problem demands:

  • Shared state
  • Central cache
  • Persistence
  • Warm start

But in a high-performance OAuth server, built to run fast, scale horizontally, and tolerate cold starts — Caffeine was the elegant and practical choice.


๐Ÿ”š Takeaways worth summarizing

  • Don’t default to Redis just because it’s popular.
  • Understand the performance vs. persistence trade-off.
  • Learn from production code — not just personal projects.
  • Choose the caching strategy that fits your use case, not your toolbox.

Tuesday, July 15, 2025

⚓ Kanhoji: Real-Time Monitoring – The Guardian of Fraud-Free Swarajya


“The sea is no one’s property. But its protector, I shall be.”
— Kanhoji Angre, Admiral of the Maratha Navy


๐ŸŒŠ Why I Named Our Monitoring Module kanhoji

Every great kingdom needs a vigilant guardian — someone who spots threats before they reach the shore. In the Swarajya movement, that role was embodied by Kanhoji Angre, the legendary admiral of the Maratha Navy.

  • Kanhoji wasn’t just a warrior — he was a master strategist.
  • He intercepted enemy ships, anticipated surprise attacks, and built naval intelligence networks.
  • He knew that if you wait until a breach happens, it’s already too late.

In our modern-day microservices architecture, that role belongs to real-time monitoring. Thus, I named our observability module kanhoji — a tribute to the admiral who kept the empire safe with foresight and maritime mastery.

๐Ÿ“ˆ What kanhoji (Monitoring) Does in Our System

In the context of our AI-powered fraud detection platform, kanhoji is responsible for:

  • Keeping an eye on service health
  • Monitoring response times, error rates, and traffic patterns
  • Exposing custom metrics (e.g. fraud score thresholds)
  • Powering a Grafana dashboard for real-time visibility

Just like Kanhoji Angre kept Aurangzeb’s navy in check, our monitoring module makes sure fraud doesn’t creep in through hidden blind spots.

๐Ÿ”ง The Tech Behind It

ComponentRole
PrometheusPull-based metrics scraping and time series storage
GrafanaBeautiful dashboards for real-time data
MicrometerJava metrics facade for Spring Boot
Spring ActuatorAuto-exposes HTTP metrics (count, latency, status)

I integrated kanhoji into our existing services (sindhudurg, tanaji) with minimal overhead and maximum insight.

๐Ÿ“Š Our Dashboard in Action

I track metrics like:

  • ๐Ÿ“‰ http_server_requests_seconds_count – endpoint latency
  • ๐Ÿงช status="500" – internal server errors
  • ๐Ÿ” jvm_memory_used_bytes – memory health
  • ๐Ÿง  Coming soon – fraud-related custom metrics

I even tried to write a Python traffic simulator to test the dashboard in action! :) a little fun. 

๐Ÿง  Why Monitoring Matters in Fraud Detection

Fraud isn’t always loud. Sometimes it comes as:

  • A slow buildup of failed transactions
  • An AI model that’s taking too long to respond
  • Unusual traffic patterns on specific endpoints

Without observability, we’d be flying blind. Kanhoji gives us:

  • ⏱️ Early warnings
  • ๐Ÿงฏ Quick troubleshooting
  • ๐Ÿ” Root cause clarity

⚓ Kanhoji Angre: The Real Legend

Before we end, let’s celebrate the namesake:

  • ๐ŸŒŠ Known as the “Shivaji of the Sea”
  • ๐Ÿ‡ฎ๐Ÿ‡ณ Never defeated by British, Portuguese, or Dutch fleets
  • ⚔️ Ran a full naval intelligence network from Kolaba Fort
  • ๐Ÿšข Used small, agile ships to outsmart colonial navies — like microservices!

๐Ÿ›ก️ What’s Next?

  • Expose Redis and Rule Engine metrics
  • Enable alerts for fraud score spikes
  • Track rule overrides and fraud trends in real time

If Tanaji is the warrior, and Dadoji the wise council, then Kanhoji is the watchtower.
Every system needs one.

๐Ÿ“– Explore the Code

๐Ÿ”— GitHub: github.com/pcm1984/fraud-free-swarajya

๐Ÿ“Š For dashboard JSON and usage instructions: Kanhoji Monitoring README

Friday, July 11, 2025

๐Ÿ“š The Lost Art of Reading — And Why We Must Bring It Back


A few days ago, I wrote about how writing is slowly fading from our lives—and why it desperately needs a revival. But writing isn’t the only silent casualty. Reading, too, is on life support. And if we don’t act soon, we may lose one of the most timeless habits that shaped who we are.

“A reader lives a thousand lives before he dies. The man who never reads lives only one.”
— George R.R. Martin

 

Do you remember the last time you got lost in a book?

Not just skimmed headlines, not doomscrolled your social feed, but really fell into a story—where minutes became hours, and a chapter became an entire evening?

If that feels like a distant memory, you’re not alone.

We live in a world of blazing reels, 2x speed podcasts, and "tl;dr" summaries. The rhythm of life is so fast, reading sometimes feels like a forgotten luxury. But perhaps, it’s time to dust off those paperbacks (or power up the e-reader), because reading isn’t just nostalgic—it’s necessary.


1. A Short, Beautiful History of Reading

Reading was once a quiet revolution. When Gutenberg printed the first books, knowledge leaped beyond monasteries and reached every curious mind. Libraries became temples, and readers, seekers of truth.

In ancient times, people read aloud—then silently, then voraciously. For centuries, to be well-read meant to be well-versed in life. Books traveled across time, generations, and cultures—carrying wisdom in ink and paper.

But then... came autoplay.

2. The Underrated Magic: Benefits of Reading

  • ๐Ÿ“– Expands vocabulary and deepens comprehension
  • ๐Ÿง  Boosts memory and focus
  • ๐Ÿง˜ Reduces stress—sometimes more than meditation!
  • ๐Ÿ’ญ Enhances empathy by letting us live others’ lives

It’s a workout, but for your imagination. With every page, your brain builds new connections, makes predictions, fills gaps, imagines tone, pictures faces.

TikTok doesn’t do that.

3. But Videos Are More Fun, Right? Not Really.

Sure, videos are flashy. They’re fast, loud, addictive. But they’re often passive. You sit back and watch. The story unfolds for you.

With reading, you co-create the world.

  • A haunted castle isn’t just seen—it’s felt.
  • A hero’s decision isn’t just told—it’s wrestled with.
  • That twist ending? You didn’t see it. You earned it.

4. Reading vs. Videos: Cognitive Advantage

Studies show readers retain information longer and understand nuance better than video watchers. Why?

Because reading activates multiple areas of the brain: language, memory, critical thinking, and imagination. It slows you down just enough to process and reflect.

Videos? They often rush past details like a news ticker on steroids. They entertain, sure—but rarely enlighten.

5. Why Blogs Beat Vlogs (Sorry, YouTube)

  • ๐Ÿ“ Blogs allow pause and ponder.
  • You can skim, scroll, highlight, reread—your way, your pace.
  • They respect your time. No waiting for a “like and subscribe” moment.
  • They don’t yell at you with flashing thumbnails.

And guess what? Good writing feels like a quiet conversation, not a sales pitch wrapped in a skit.

6. Your Eyes Will Thank You

Let’s be real—hours of screen glare is brutal. Eye strain, dry eyes, headaches—the digital fatigue is real.

Reading, especially on paper or e-ink, is soothing. It feels like sipping tea on a rainy day compared to chugging espresso shots while staring at your inbox.

7. The Gift of Slowness

When you read, you slow down.

You wonder, What will happen after 10 pages?

You pause, reflect, guess. You live in the in-between.

There’s peace in that space. The slowness becomes your sanctuary.

Unlike binge-watching, where one episode demands the next, reading lets you close the book and still feel full.

8. Still More Benefits? Of Course.

  • Improves writing and articulation
  • Encourages lifelong curiosity
  • Offers deep dives, not shallow swipes
  • Builds quiet confidence and concentration
  • Cultivates patience in a dopamine-flooded world

Reading is a rebellion against the algorithm.

9. Small Homes, Big Stories: The Rise of eBooks

Let’s talk practical. Don’t have space for a library? EBooks to the rescue.

Modern eReaders like Kindle or Kobo can hold thousands of books in your palm. You can highlight, bookmark, take notes, and carry your entire collection on a plane—or a train to Wakad.

Less clutter, more chapters.


Final Word: Let’s Revive the Reader in Us

We don’t have to choose between reels and reading. But if we want deeper thinking, richer ideas, and quieter minds—we have to make room for reading again.

Start small. One page before bed. One blog with your morning chai. One weekend with a good novel.

“Books are a uniquely portable magic.”
— Stephen King

Let’s bring back the magic.

Thursday, July 10, 2025

๐Ÿง  The Wisdom of Rules: Building Dadoji for Explainable Fraud Detection

A tribute to Dadoji Konddev — the strategic mind behind structure, just like our rule engine.

๐Ÿ›• Inspired by Dadoji Konddev

Dadoji Konddev, the mentor and guardian of young Shivaji Maharaj, wasn't just a caretaker — he was a visionary. He laid the foundations of discipline, systems, and early strategies that made the idea of Swarajya possible.

In the Fraud-Free Swarajya project, our rule engine is named dadoji in his honor — a system that brings stability, structure, and wisdom to our fraud detection stack.


❓ Why Rules When We Have AI?

This question is at the heart of explainable AI systems.

AI (like our tanaji module) is great at detecting patterns — even ones you can't explicitly define. But there are scenarios where hard rules are:

  • Easier to explain
  • Legally required (compliance)
  • Faster to execute
  • Safer to override AI mistakes

Rules bring clarity and confidence, especially for edge cases.


๐Ÿงฉ When Do We Use Rules?

Here are some real-world fraud detection scenarios where rules are powerful:

Rule Name Condition Action
HighAmountRule Amount > 10,000 Mark as HIGH risk
RiskyLocationRule Location in [“risky”, “banned_country”] Raise risk level
FrequentTxnRule Too many txns from same user in 1 min Flag as suspicious
BlacklistedCardRule Card ends with known fraud pattern Auto-reject
VIPBypassRule User is admin/VIP Adjust recommendation

๐Ÿง  AI + Rules Together = Smarter Detection

Capability AI (Tanaji) Rules Engine (Dadoji)
Learns over time ✅ Yes ❌ No
Deterministic ❌ Not always ✅ Always
Transparent ⚠️ Depends ✅ Fully explainable
Override AI ❌ No ✅ Yes
Business control ⚠️ Harder ✅ Business-friendly
“Let AI detect the unknown. Let rules defend the known.”

⚙️ How It Works in Code

Every rule implements a common interface:

public interface FraudRule {
    boolean apply(TransactionRequest txn);
    String getExplanation();
    RiskIndicator getRiskIndicator();
}

A sample rule:

public class HighAmountRule implements FraudRule {
    public boolean apply(TransactionRequest txn) {
        return txn.getAmount().compareTo(BigDecimal.valueOf(10000)) > 0;
    }

    public String getExplanation() {
        return "High amount transaction";
    }

    public RiskIndicator getRiskIndicator() {
        return RiskIndicator.HIGH_AMOUNT;
    }
}

๐Ÿ”„ How Tanaji + Dadoji Work Together

  1. sindhudurg receives the transaction
  2. Forwards to tanaji (AI engine)
  3. tanaji returns fraud score and risk factors
  4. Response goes to dadoji
  5. dadoji runs applicable rules
  6. If a rule applies:
    • Explanation is added
    • Risk level may be escalated
    • Recommendation may be overridden
  7. Final response sent back to user

๐Ÿน Real-World Analogy

Tanaji Malusare was the courageous warrior who scaled walls.
Dadoji Konddev was the quiet tactician who taught how forts are built.

We need both — just like fraud detection needs AI for intelligence and rules for discipline.


๐Ÿ“œ A Word on Explainability

In banking and fintech, decisions that affect customers (like rejecting a transaction) must be explainable. Dadoji’s rules let us say:

  • “This transaction was rejected because the amount exceeded ₹10,000.”
  • “Risk increased due to login from a risky location.”

These aren’t guesses — they’re policies.


๐Ÿ”ฎ What’s Next?

  • ๐ŸŒ€ Feedback loop (santaji) — to learn from flagged frauds
  • ๐Ÿ”” Real-time notification service (SMS, push, email)
  • ๐Ÿงญ Admin dashboard (ashtapradhan) for rule management
  • ๐Ÿ” API Security and compliance

๐Ÿง  Takeaway

A rule engine isn’t about replacing AI.
It’s about building trust, consistency, and strategic governance into a system designed to defend.

Our tribute to Dadoji is more than a name — it’s a mindset.


๐Ÿ”— GitHub

See the code for all rules and architecture:
๐Ÿ‘‰ github.com/pcm1984/fraud-free-swarajya


๐Ÿ‡ฎ๐Ÿ‡ณ Closing Words

“Shivaji Maharaj won battles not only through might, but through systems.
We too must build software that’s both brave and wise.”

“Marathi Paaul Padte Pudhe…”