AWS Builder Center

Building JalMarg on AWS: Flood-Aware Routes and Municipal Response

How I built a serverless application that connects citizen waterlogging reports, vehicle-aware route planning, and municipal work tracking using AWS.

During heavy rain, knowing that a road has traffic is not enough. Commuters also need to know whether the road has reported waterlogging.
This matters especially for delivery riders and people travelling on two-wheelers. Different vehicles face different risks on the same flooded road.
I built JalMarg as a solo participant in the Build Bharat Hackathon to connect two needs: helping commuters plan around reported flooding and helping municipal workers track the response.

What the application does

JalMarg brings citizens, commuters, and municipal workers into one application.
  • Citizens can report waterlogging, select a water level, and upload photo evidence.
  • Commuters can choose their start, destination, and vehicle. The app checks returned street routes against active reports.
  • Municipal workers can review reports, assign work, record progress, and upload completion evidence.
The map shows the selected route in blue and the avoided route in red. Users can open a detour in Google Maps with bypass stops, although Google recalculates the directions between those stops.
English and Hindi voice advisories explain the journey and reasons for a detour using browser speech.
Completion also requires review by another approved worker. Citizens can reopen an issue if flooding remains.

Where AWS fits

The application uses a serverless backend deployed in the Mumbai region,  ap-south-1 .
AWS service
How JalMarg uses it
Amazon CloudFront
Delivers the frontend over HTTPS.
Amazon S3
Stores frontend files and private evidence photos in separate buckets.
Amazon Cognito
Handles signup, email verification, and sign-in.
Amazon API Gateway
Exposes backend endpoints and authorizes protected requests.
AWS Lambda
Runs request validation, permission checks, report processing, and municipal work updates.
Amazon DynamoDB
Stores reports, profiles, membership, and work history.
AWS Step Functions
Runs report preparation with retry handling and execution history.
Amazon CloudWatch
Collects backend logs and monitors API failures.
AWS X-Ray
Provides tracing for supported backend requests.
AWS IAM
Controls backend access to AWS resources.
AWS CloudFormation
Provisions and manages the application infrastructure.
I used AWS SAM to define and deploy the serverless backend and Boto3, the AWS SDK for Python, to access AWS services.

From a citizen report to municipal review

The reporting flow works like this:
  1. A citizen signs in through Cognito.
  1. The application requests an upload URL and uploads photo evidence to private S3 storage.
  1. API Gateway sends the report request to Lambda.
  1. Lambda validates the request and saves the report in DynamoDB.
  1. Step Functions invokes a processing Lambda to prepare the observation for review.
  1. An approved municipal worker reviews the report through the application.
The deployed Step Functions workflow contains one processing task with retry handling. Human review and municipal work updates happen through separate protected API actions.
This distinction matters: successful processing does not automatically mean a report has been verified or that field work is complete.

Keeping access and evidence controlled

Authentication and municipal authority are separate.
Creating a citizen account does not grant municipal permissions. A municipal worker needs approved membership in the application and membership in the  civic-operators  Cognito group.
Evidence photos remain private in S3. The application uses short-lived signed URLs to display them.
The backend also checks ownership, city scope, and the current work version before accepting updates. Conditional writes help prevent two actions from silently overwriting each other.

What depth estimation means in this prototype

The current application does not use a deployed AI model to measure flood depth.
It uses:
  • Citizen-selected water-level observations mapped to approximate depth values.
  • Optional user-marked photo references based on an object with a known height.
For the photo method, the user marks the object’s top, base, and waterline. The application calculates the submerged proportion, and the API recomputes the estimate.
These are approximate observations, not certified measurements. Vehicle avoidance settings are prototype rules, and a route without reports is not a guarantee of safe conditions.
Automated depth estimation with a validated computer vision model on SageMaker is future work.

What I learned

Managed AWS services helped me build the application without maintaining backend servers. CloudWatch logs and Step Functions execution history were useful when investigating failures.
The biggest lesson was to treat deployment configuration as part of the application.
During a frontend update, I accidentally omitted the production Cognito settings. The website loaded, but sign-in showed that the account service was not configured. I restored the settings and added a production build check that rejects missing account configuration before publishing.
I also fixed a routing bug where two routes with equal rounded travel times could cause the detour to be mistaken for the original route. Preserving the original fastest candidate independently of flood-avoidance sorting corrected the route display and Google Maps handoff.

What comes next

My next priorities are:
  • Validate depth estimates against labeled, real-world photos.
  • Evaluate computer vision models before introducing automated estimates.
  • Improve abuse prevention and evidence privacy controls.
  • Test usability with commuters and municipal workers.
  • Measure whether the application improves route decisions and response tracking.
I built JalMarg with AI coding assistance. The current result is a working prototype connecting citizen observations, route planning, and municipal follow-up through a deployed AWS application.
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