
JalRakshak: Building a Water Crisis Simulator with AWS SAM
Water shortages often become visible only when a tank is nearly empty. This article explores a transparent water-crisis simulator that forecasts shortages, flags possible leaks, compares conservation actions, and uses AWS SAM to define a path toward a serverless backend.
From Water Shortage to Early Warning: Building a Practical Simulator
Water is essential to every hostel, residential society, and campus, but managing its availability can be difficult. When a tank runs low, people need to know not only how much water remains, but also how quickly it may run out and what actions could help.
That was the problem I wanted to address with JalRakshak, my project for Environmental Hacks 2026 in the Heat and Water track.
The problem
Water shortages involve several interacting factors: the current tank level, the number of people using water, incoming supply, temperature, and possible leakage. Responding to only one factor may not be enough.
JalRakshak is designed to make these factors easier to understand. Instead of presenting only a tank-level number, it estimates when the tank could run empty and lets users compare different interventions before a crisis occurs.
Building the simulator
The core of JalRakshak is a transparent water-balance model. At each time step, the water level changes according to incoming supply, consumption, and leakage.
The simulator accepts inputs such as:
- Current tank level and tank capacity
- Population and estimated per-person consumption
- Temperature and incoming supply changes
- Estimated leakage
- Tanker delivery and water-conservation actions
It compares a baseline scenario with a scenario that includes selected actions. The interface shows estimated hours until the tank runs empty, a 96-hour shortage-risk score, and how much additional time the actions might provide.
The model uses clearly labelled illustrative assumptions, including a baseline consumption of 135 litres per person per day, reductions in non-essential consumption, greywater reuse, and increased demand at higher temperatures. These values are configurable assumptions rather than universal facts, and real site readings are needed to calibrate the model.
Flagging possible leaks
A useful feature is the leak-checking tool.
Users enter two tank readings and the time between them. JalRakshak estimates the observed drain rate and compares it with the model's expected drain rate. A significant unexplained difference is flagged as a possible leak.
This is a screening mechanism, not proof of a physical leak. Changes in incoming supply, human consumption, timing, and measurement accuracy can also explain discrepancies. The next step in a real installation would be to validate the estimate against reliable readings and inspect the site.
Comparing interventions
The simulator lets users explore actions such as:
- Fixing a detected leak
- Reducing non-essential water use
- Reusing suitable greywater
- Scheduling a water tanker
Each action's estimated contribution is displayed so users can compare alternatives. JalRakshak also provides a 24-hour supply-and-demand estimate, while explaining an important limitation: a daily supply surplus does not guarantee that water will be available at every hour. A tank can still run empty if hourly demand exceeds the available supply.
The goal is to help users understand possible trade-offs, not to promise a particular real-world outcome.
Where AWS fits
I designed an AWS serverless architecture for extending the simulator beyond a local browser application:
- Amazon S3 and Amazon CloudFront: planned frontend hosting and content delivery
- Amazon API Gateway: planned API entry point
- AWS Lambda: planned processing of readings and shortage-risk assessments
- Amazon DynamoDB: planned storage for site settings and readings
- Amazon EventBridge: planned scheduled risk checks
- Amazon SNS: planned email alerts
I used the AWS Serverless Application Model (AWS SAM) CLI, an AWS open-source tool, to validate and lint the infrastructure template and build the project locally. I also added the Python dependency configuration required by the Lambda source code.
The template passed basic validation and linting, and the local SAM build succeeded. The backend tests also passed: two tests covering model consistency and API/alert logic.
The AWS infrastructure has not yet been deployed. The services above describe the architecture defined in the template, not a live cloud installation.
What I learned
One important lesson was to make assumptions visible. A shortage forecast is only as useful as the quality of its inputs, so users should be able to inspect and replace illustrative values with measurements from their own sites.
I also learned that a clean local build is an important step toward deployment, but it is not the same as testing an application in the cloud. Future work includes deploying the backend, testing email alerts end to end, improving validation against real tank readings, and adding automated data ingestion from sensors.
What's next?
JalRakshak is a starting point for more proactive water management. With calibrated site data and a tested backend, it could help facilities notice potential shortages earlier, investigate unexplained water loss, and compare response options before water runs out.
The broader idea is simple: make water availability easier to understand so that people can take action sooner.
Built for Environmental Hacks 2026 — Heat and Water track.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article