Skip to content

Indian lending lifecycle

The full Underwrite underwriting journey, end-to-end, against an in-memory runtime. Twelve stages from onboarding to origination — each one a nano-service, each transition a typed event, each event carrying the runtime guarantees into the next stage.

This page is the primary mental model for the platform. The same flow runs in production against Sqlite + OTLP + Vault; here it runs in a single Python process with no broker, no cluster, no external dependencies.

The flow

01

Onboarding

The mechanism service seeds capital and creates a sponsor → borrower pair. The first durable identity. seed.added · user.added

02

Identity

PAN and Aadhaar identifiers attach to the borrower. The identity service emits an attestable identity-registered event. identity.registered

03

DPDPA consent is recorded with a specific purpose (KYC verification). Withdrawable at any time. The consent service enforces re-consent on purpose change. consent.recorded

04

KYC

PAN format validation, Aadhaar Verhoeff checksum, AML risk score, CKYC registry trigger. Wire-protocol clients against NSDL / UIDAI / Karza. kyc.verified

05

AML

Sanctions screening, transaction pattern checks, risk scoring. AML clears or freezes; the runtime routes to the next stage or to the DLQ with a recorded error. aml.cleared · aml.flagged

06

Credit bureau

CIBIL / Experian / Equifax pull. The credit_bureau service emits a normalized credit_bureau.checked event regardless of which bureau responded. credit_bureau.checked

07

Underwriting

Rule engine + ML risk model evaluate the application against business rules. Approved, rejected, conditional, or escalated. underwriter.approved · underwriter.rejected

08

Pricing

RBI rate caps applied. All-in-cost APR (interest + fees + GST + insurance) computed. EMI, total interest, processing fee emitted. pricing.computed

09

Compliance

Cooling-off period enforced. Breach checks run. Compliance emits kfs.generated and gates the next stage. kfs.generated

10

KFS

Key Fact Statement issued to the borrower — a complete, versioned disclosure of every pricing and consent fact. kfs.generated

11

Mandate

e-NACH / UPI Autopay mandate collection. Roadmap item — not yet wired to a partner. When enabled, the razorpay service emits mandate events. razorpay.mandate.active (planned)

12

Origination

The mechanism service books the loan. The audit service persists a redacted copy. The NPA classifier starts watching. The lifecycle is complete. loan.originated

What the runtime adds at every transition

Concern Where it attaches What it adds
Signing Core.emit Ed25519 over canonical bytes; deterministic across processes
Verification Core.dispatch Signature checked before handler runs
Idempotency Core.dispatch Duplicates dropped silently; cache bounded
Tracing Core.handle_event Span lifecycle, parent / child propagation
Metrics Core.handle_event Counters, timers, gauges per service and event type
Authz Core.dispatch + Core.emit Default-deny policy evaluation
DLQ LocalBus.dispatch Failed events captured with original error
Circuit breaking LocalBus.dispatch Per-subscriber breaker; OPEN after threshold
Saga coordination Orchestrator Multi-step workflows with compensating rollback

These guarantees are not optional. Every Core-derived service inherits them through the dispatch pipeline; there is no way for a service to opt out, and no way for a service to write the dispatch logic itself.

Compliance responsibility by stage

Stage Responsibility
Onboarding KYC for the sponsor; sponsor authorization
Identity Identity verification; re-attestation on key rotation
Consent DPDPA consent validity; purpose binding; withdrawal
KYC PAN format, Aadhaar Verhoeff, AML risk score
AML Sanctions screening; PEP screening; transaction patterns
Credit bureau Bureau response normalization; consent re-check
Underwriting Business rules; model versioning; explainability
Pricing RBI rate caps; all-in-cost APR disclosure
Compliance Cooling-off; KFS issuance before disbursement
KFS Complete disclosure; version pinning
Mandate e-NACH / UPI Autopay consent; revocation handling
Origination Audit ledger; NPA classifier activation

Visualizing the flow

sequenceDiagram
    participant B as Borrower
    participant M as mechanism
    participant ID as identity
    participant CO as consent
    participant KY as compliance
    participant CR as credit_bureau
    participant U as underwriter
    participant PR as pricing
    participant K as kfs
    participant AU as audit

    B->>M: add_user
    M->>AU: user.added
    B->>CO: record_consent
    CO->>AU: consent.recorded
    B->>KY: kyc_check
    KY->>AU: kyc.verified
    B->>CR: credit_check
    CR->>AU: credit_bureau.checked
    B->>U: evaluate
    U->>AU: underwriter.approved
    B->>PR: compute
    PR->>AU: pricing.computed
    B->>K: generate
    K->>AU: kfs.generated
    B->>M: originate
    M->>AU: loan.originated

Every event flows through audit — the persistent, PII-redacted record of the run.

See also