Dibya Sarothi
Dibya Sarothi
Technical Publication & Engineering Notes

Engineering Journal

Deep-dive technical documentation on backend architecture, multi-tenant isolation, database indexing, resilient API integrations, and deterministic AI validation patterns from production systems.

Topics Covered:Django & Backend ArchitectureAI Reliability & ValidationAPI Integrations & PaymentsDatabases & PerformanceGame Systems & Architecture
Django & Backend Architecture•October 18, 2026
9 min read

Architecting Multi-Tenant Isolation with Custom Django ModelManagers & Thread-Local Context

How we achieved zero cross-tenant IDOR vulnerabilities and sub-2ms tenant resolution in ClientForge.

Multi-tenant B2B systems must guarantee that tenant data remains entirely segregated under concurrent request loads. This article dissects how we built a thread-safe context provider and custom ModelManager in Django REST Framework to scope every ORM query at the database layer.

AI Reliability & Validation•October 26, 2026
10 min read

Evidence First, AI Second: Deterministic Pydantic Validation Guards for Healthcare LLMs

Eliminating medical hallucinations by forcing LLM reasoning through structured JSON schemas and relational database ground-truth.

Large Language Models are probabilistic generators, not deterministic authorities. In MediGuard AI, we engineered an evidence-first validation pipeline that verifies medicine entities against relational pharmaceutical registries and validates LLM payloads via Pydantic schemas before user presentation.

API Integrations & Payments•November 2, 2026
8 min read

Resilient Webhook Idempotency: Handling Stripe Financial Events with Redis Locks & PostgreSQL Audit Trails

Guaranteeing exactly-once billing state mutations under network retries and distributed concurrency.

External payment gateways like Stripe guarantee at-least-once webhook delivery. Without strict idempotency handling, network hiccups and retries can trigger duplicate invoices, multiple charges, and corrupt billing records. Here is how we engineered atomic webhook processing in ClientForge.

Databases & Performance•November 5, 2026
8 min read

Scaling Transit Queries: PostgreSQL Trigram Fuzzy Search and Sub-50ms Redis Caching in Bhara Koto

Handling phonetic Bengali/English bus stop queries and route matrix distance algorithms on low-spec hardware.

Public transport apps in developing nations must operate fast on spotty cellular connections. In Bhara Koto, we implemented PostgreSQL pg_trgm fuzzy indexing to handle phonetic stop spelling and paired it with pre-calculated Redis route cache keys to achieve sub-50ms response times.

Game Systems & Architecture•November 9, 2026
9 min read

Deterministic Hierarchical State Machines in 2D Real-Time Combat Loops

Zero-allocation physics queries, input buffering, and multi-phase boss behaviors in Unity 6 and C#.

Building a responsive 2D action game like Ashenfall demands strict architectural discipline: non-allocating physics routines to eliminate garbage collector stutter, robust input buffering for frame-perfect responsiveness, and hierarchical state machines governing multi-phase boss encounters.