
I built a rooftop solar planner that tells you when not to buy solar (serverless, on AWS)
Built solo for the Bharat Builds Tour: Environmental Hacks (WeMakeDevs × AWS), Track 03: Waste & Energy. Try it: https://d3s69kasxcslyo.cloudfront.net Code: https://github.com/SwastikKaushal1/SuryaCheck
The problem
India's PM Surya Ghar scheme pays up to ₹78,000 to put solar panels on your roof. Millions of families are now being asked: how many panels, where do they go, and is it worth it?
The person answering is usually the installer, who is also the person selling the panels. The online calculators don't help much. They ask for your city and your bill, multiply, and show a big savings number. They don't look at your roof: the water tank in the middle, the stair room, or the five-storey building next door that blocks the winter sun until 11 am.
So I built SuryaCheck: a free planner that works from your actual roof and gives you an honest answer, including "don't do it".
What it does, in about three minutes
- Find your house. Type an address (with open-source suggestions from Photon) and confirm the roof outline on satellite imagery. The outline comes from OpenStreetMap. If it's off, you can drag the whole outline into place or redraw it corner by corner.
- Mark what's on the roof. Water tanks, stair rooms, trees and taller neighbours, with their real heights. Each one casts a shadow that is worked out from the real position of the sun.
- Scan your surroundings with your phone. Stand where the panels will go, hold a button, and sweep the camera from east to west along the tops of the buildings and trees. The phone's compass and tilt sensor turn that into a skyline. If you're planning on a laptop, scan a QR code and the phone becomes a scanner: its readings appear on the laptop within about a second.
- Get an honest plan. Panels are placed around the obstacles, sized to your bill (not to how many fit), at the best tilt, with real sunshine data for your exact spot from PVGIS (the EU Joint Research Centre). It includes cost, subsidy, yearly savings, payback and EMI.
- Take it to an installer. A PDF report you can share on WhatsApp, with the questions to ask.
The part I'm proudest of: if solar is a bad deal for your roof, SuryaCheck says so first. If the payback is over about 9 years, if shade drops output below 1,000 units per kW a year (an open roof makes about 1,400 to 1,500), or if the roof only fits a tiny system, you see "We don't recommend solar for this roof" and the reasons. The plan is hidden unless you tap "Show me the plan anyway". A sales tool would never do that.
The architecture on AWS
Plain text
Browser / phone│├── CloudFront ── S3 (private, Origin Access Control) ← the Next.js site, exported as static files│└── API Gateway (HTTP API) ── Lambda (Python 3.12, FastAPI + Mangum)├── PVGIS (sunshine & yearly energy)├── OpenStreetMap (building outlines via Overpass, geocoding)└── Photon (address suggestions)CloudWatch Logs + X-Ray tracing · AWS Budgets email alerts
- Frontend: Next.js 16 + React 19 + Tailwind, exported as a fully static site. All the geometry (panel packing, shadow casting, sun position, finance) runs in the browser, so the site stays fast and cheap. It goes to a private S3 bucket, served only through CloudFront with Origin Access Control.
- Backend: a small FastAPI app wrapped with Mangum, so the same code runs locally with
uvicornand on AWS Lambda behind an API Gateway HTTP API. It proxies and caches the slow public data sources, and works out the money with the same formulas as the browser. A test checks the two give identical numbers.
- Infrastructure as code: one AWS SAM template. A single
deploy.ps1builds the Lambda in a Linux container (so compiled Python packages match Lambda, not Windows), deploys the stack, builds the site, uploads it to S3 and refreshes CloudFront.
- Observability: X-Ray tracing is switched on so the slow calls out to PVGIS and OpenStreetMap show up per request, and logs go to CloudWatch (kept 14 days).
- Cost control: a monthly AWS Budgets limit with email alerts at 50% and 80%, so a mistake can't turn into a surprise bill. Pay-per-request Lambda and a static site cost almost nothing at hackathon traffic.
Three things I learned building it
1. Deploying on AWS fixed a bug I couldn't fix at home. PVGIS, the sunshine data source, simply didn't answer from my home network. On my laptop the app had to fall back to rough averages. Once the API ran on Lambda, PVGIS answered every time, and the plans got real, location-specific numbers. Sometimes "works on my machine" is the bug.
2. New AWS accounts can have a Region restriction. My fresh account could only deploy to ap-southeast-2 (Sydney); other Regions were blocked. Fighting the deploy, I learned to read the error properly instead of guessing. I kept the API in Sydney and let CloudFront serve the site from edge locations close to Indian users.
3. Turning a phone into a measuring tool is mostly maths, plus good instructions. The browser's DeviceOrientation API gives three raw angles. Turning them into "which compass direction is the camera facing, and how far up is it pointing" means rotating the camera's axis through all three angles. iPhone and Android also report compass headings differently. My first version asked users to mark five directions, and it was confusing. A narrow mobile tower ended up as wide as a building. The continuous sweep (one reading every 5°, keeping the tallest in each 10° slice) fixed both. An animated how-to and a "stand here" map, showing where the panels will likely go, made the difference for real users.
What's next
- Move the phone-pairing session store from memory into DynamoDB, so pairing stays reliable when Lambda runs several copies at once.
- A Hindi version of the whole flow (the summary already has one).
- An installer mode, so installers can show customers an honest plan on site.
Try it and tell me what breaks
If you have a rooftop in India, plan it, and tell me whether the "don't recommend" verdict agrees with what your installer said. 🌞
#AWS #Lambda #Serverless #CloudFront #Solar #ClimateTech #WeMakeDevs #BharatBuildsTour
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article