
Building AfterLoss: Enforcing India's 15-Day Deceased Claim Laws with AWS Serverless, Step Functions & Cedar
How we built a privacy-first serverless architecture on AWS using Step Functions callback tokens, Amazon Verified Permissions (Cedar), and Bedrock to recover forgotten assets for grieving families under $5.
When an earning member or parent passes away in India, the family is hit with grief—and immediately followed by bureaucratic confusion. Over ₹1.82 lakh crore ($21B+) in financial assets lies unclaimed across Indian banks, mutual funds, insurance, and demat accounts.
Families usually hit three walls:
- Asset Blindness: They have no idea what the deceased owned (a hidden life policy, dormant shares, or mutual funds).
- Repetitive Paperwork: Filling the same names, addresses, and death certificate details across dozens of disparate forms.
- Endless Bank Delays: While the Reserve Bank of India (RBI) mandated in May 2025 that banks must settle deceased claims within 15 calendar days (and pay penal interest at Bank Rate + 4% if delayed), almost no family knows this right or has the means to enforce it.
We built AfterLoss to solve this. In this post, we’ll share how we architected a 100% serverless, privacy-first legal engine on AWS that runs end-to-end for under $5.
The System Architecture
Before this hackathon, our instinct was to deploy a persistent EC2 server or Docker container. But running a persistent instance 24/7 burns AWS credits rapidly, even when sitting idle.
Instead, we built AfterLoss entirely serverless using a single AWS SAM (
template.yaml ) deployment:- Frontend: React 19 + TypeScript + Tailwind CSS (Bilingual EN/HI) hosted on S3 and delivered globally via Amazon CloudFront with Origin Access Control (OAC).
- Authentication: Amazon Cognito User Pools with passwordless email OTP challenges.
- Compute: 5 decoupled AWS Lambda microservices (
api,scan,pack,assistant,clock) behind an API Gateway HTTP API.
- Database: Amazon DynamoDB using an on-demand Single-Table Design (
MainTable).
- Storage: Amazon S3 for encrypted documents accessed strictly via short-lived (5-minute) presigned URLs.
- Security & Authorization: Amazon Verified Permissions (AVP) powered by the open-source Cedar policy language.
- Long-running Orchestration: AWS Step Functions for tracking statutory 15-day settlement timelines.
- AI & Document Intelligence: Amazon Bedrock (
gpt-oss-120bandNova 2 Litewith Web Grounding), Amazon Textract, and Amazon Comprehend.
3 Core Architectural Deep Dives
1. The 15-Day Claim Clock: Step Functions with .waitForTaskToken
The biggest technical challenge was handling non-deterministic human delays. Under RBI Para 31, a bank has exactly 15 days from the date complete documents are submitted to disburse funds.
If you use cron jobs or polling workers, you pay for compute to constantly check timestamps, and edge cases easily corrupt state.
We solved this with AWS Step Functions:
- When the family uploads their bank submission acknowledgement, the API starts a state machine execution.
- Step Functions enters an ASL
Waitstate until Day 10 and invokes a Lambda task to send an SES reminder email.
- It waits again until Day 14 for an urgent reminder.
- On Day 15, the state machine generates a task token (
.waitForTaskToken) and stores it in DynamoDB. Execution pauses completely at zero compute cost.
- The frontend prompts the family: "Has the money arrived?"
- If Yes, the API calls
SendTaskSuccess, resolving the claim.
- If No, the state machine branches to the late-compensation engine: it calculates statutory
Interest = Amount × (Bank Rate + 4%) × (Days / 365)drafts a formal demand letter to the Bank Nodal Officer, and prepares an escalation to the RBI Integrated Banking Ombudsman (cms.rbi.org.in).
Demo Tip: To test this on camera without waiting 15 days, we added a configurable
secondsPerDay parameter to our cases, compressing a 15-day regulatory timeline into 60 seconds!
2. Guardrails with Cedar: Why "Forbid" Beats "Permit"
Cases in AfterLoss are shared between family members (
Lead , Heir ) and external advisors ( Helper , like a CA or lawyer).Helpers need to see case progress and assist with paperwork, but must never access unmasked identity proofs (Aadhaar/PAN). In traditional applications, developers scatter
if (user.role !== 'helper') checks across route handlers—a single missed check leads to catastrophic data leaks.With Amazon Verified Permissions (AVP), authorization is decoupled from application code. We wrote strict Cedar policies where
forbid unconditionally supersedes permit :// Helpers can view masked copies of documents
permit (
principal in Role::"Helper",
action in [Action::"view_case", Action::"view_masked_document"],
resource
);
// Mathematical guarantee: Helpers can NEVER download or view unmasked originals
forbid (
principal in Role::"Helper",
action in [Action::"view_document", Action::"delete_case", Action::"manage_members"],
resource
);Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article