AWS Builder Center
Lapse: A Deadline Calculator for Section 138 Cheque-Bounce Cases, Built on AWS Amplify Gen 2

Lapse: A Deadline Calculator for Section 138 Cheque-Bounce Cases, Built on AWS Amplify Gen 2

When a cheque bounces in India, four strict legal deadlines start ticking — miss one and the case can be dismissed. Lapse computes them deterministically on AWS Amplify Gen 2, and this post covers the architecture, the Bedrock→Gemini pivot, and what we'd do differently.

student

When the clock is already running out

In India, when a cheque bounces, Section 138 of the Negotiable Instruments Act hands the payee a strict, unforgiving sequence of deadlines:
  1. The cheque must still be within its 3-month validity when presented.
  1. From the day the bank reports dishonour, the payee has 30 days to send a legal notice.
  1. Once served, the drawer gets 15 days to pay.
  1. If they don't, the complaint must be filed within 1 month of that window closing.
Miss any one of these and a criminal complaint can be thrown out as time-barred or premature. What makes it worse is that the actual rules are more forgiving than they look — re-presenting the cheque restarts part of the clock if it's still valid, and late filing can sometimes be condoned — but almost nobody doing this by hand knows that. And as of a Supreme Court ruling that took effect 1 November 2025 (Sanjabij Tari v. Kishore S. Borcar, 2025 INSC 1158), every complaint now has to carry a structured synopsis of these same dates.
We built Lapse to compute this chain deterministically, show exactly where a case stands and why, and — if a deadline has already passed — tell you the real remaining option instead of just reporting failure.

What we built

Lapse takes the facts of a cheque-bounce case and turns them into a live, explainable timeline:
  • A clock board that shows all four deadlines at once, with a plain-language reasoning chain underneath every status — so a case never just says "time-barred," it shows the exact dates and rule that produced that conclusion.
  • Document upload → extraction → confirm/edit. Upload a dishonour memo or notice, and the app pulls out structured facts with a confidence score and a verbatim source quote per field — nothing gets trusted blind, and a human confirms every field before it feeds the clocks.
  • Draft legal notice + structured synopsis generation, assembled around dates that are recomputed server-side, never trusted from the client.
  • A dashboard sorted by urgency, so the case closest to a lapsed deadline always surfaces first.
  • "Date travel" — drag a slider and watch every clock recompute live, which turned out to be the single best way to feel how forgiving or unforgiving a given case actually is.
Underneath all of it is one dependency-free TypeScript rules engine, tested against the bare statute text and five Supreme Court judgments across a 27-case table, so the same logic runs instantly in the browser and authoritatively on the server.

Architecture

The frontend is a React 19 + Vite SPA deployed as static hosting. The backend is a single AWS Amplify Gen 2  defineBackend  wiring auth, data, storage, and two functions together in one deploy. The one architectural decision we'd point to first: the rules engine never touches the network or the clock — it's a pure function of facts and "today," imported by both sides, so the client's instant feedback and the server's authoritative recompute can never silently disagree.

How we used AWS

  • AWS Amplify Gen 2 was the backbone — one  defineBackend  in  amplify/backend.ts  tying together auth, data, storage, and two Lambda functions as ordinary TypeScript, with typed GraphQL generated straight from the schema in  amplify/data/resource.ts . For a solo hackathon build, this was the single biggest velocity unlock.
  • AppSync + DynamoDB hold the Case model — facts, computed result snapshot, and computedAt — plus two custom queries (extractFacts, draftNoticeForCase/synopsisForCase) that route straight to Lambda.
  • S3 stores uploaded dishonour memos, read directly by the extractFacts function.
  • AWS Lambda runs two functions: extractFacts (sends an uploaded document out for structured extraction, with per-field confidence and a verbatim source quote — nine fields, six human-only and three affidavit-boundary, are hard-blocked from ever coming from a model at all) and draftNotice (recomputes the clock board server-side before drafting anything, so the narrative is always built around already-fixed, verified dates).
  • Amplify Hosting serves the deployed SPA, and we deployed it entirely via the CLI —  aws amplify create-app --repository ... --access-token $(gh auth token) --platform WEB  — authorizing straight off the existing gh CLI session with no manual console click-through.
  • Amazon Cognito is provisioned as a user pool in the backend ( amplify/auth/resource.ts ) but isn't wired into the frontend yet — we're flagging that openly rather than papering over it: there's no sign-in screen yet, and the app currently runs on  allow.publicApiKey() .
We originally planned this around Amazon Bedrock (Claude models) for both Lambdas, and pivoted to the Gemini API mid-hackathon — more on that below.

What went sideways

The biggest obstacle wasn't our code — it was a Bedrock account-verification hold on a new AWS account. AWS's own message estimated under 2 hours to clear; it was still open roughly 30 hours later, even after we filed a support case, while every other Bedrock CLI command ( bedrock list-foundation-models ,  describe-budgets ) worked fine the whole time. With no ETA and no actionable next step besides waiting, and with the hackathon rules only requiring deployment on AWS rather than use of Bedrock specifically, we made the call to pivot both Lambdas to the Gemini API instead — a same-shape swap (document/image blocks in, structured JSON out) that cost real build hours we'd budgeted for AWS-native AI.
Amplify Gen 2 deployment also had two gotchas worth naming for anyone hitting them next:
  1. A brand-new Amplify app has no IAM service role by default, so  ampx pipeline-deploy  fails inside CodeBuild with permission errors until you create a role trusting  amplify.amazonaws.com  and attach  AdministratorAccess-Amplify  yourself.
  1. Amplify Hosting's default S3+CloudFront rewrite rules don't handle SPA client-side routing out of the box — refreshing on any non-root route 404s until you add a custom rewrite rule by hand.
Neither is documented clearly in the Gen 2 + Vite quickstart, and both costnned for.

What we'd take forward

The clearest lesson was architectural: keeping the rules engine as a pure, both the browser and the Lambda import directly meant the Bedrock→Gemini pivot only touched the two functions calling out to a model — the actual legal logic, and its 111 tests, never had to change. Isolating the part of the system that can't be wrong from the part that talks to an external model is a pattern we'd reach for as deterministic logic with an LLM call.
We also learned to treat an AI extraction step as adversarial by default extracted field carries a confidence score and a verbatim source quote, and afixed set of fields can never be model-sourced at all. That boundary did more for the project's credibility with legal-adjacent reviewers than any UI polish did.

Try it

The app ships with sample cases covering every status, including a hero casock board and reasoning chain without uploading anything.
I dropped a placeholder line in Architecture for your diagram — swap it in
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article