
RoofGrid: Turning a Rooftop into a Solar Plan with AWS
A few days ago, rooftop solar planning sounded simple to me: find the roof area, see how many panels fit, estimate the energy output.
Then I actually tried building it.
Real rooftops have water tanks, AC units, staircases, access points, irregular boundaries and maintenance requirements. A layout that fills every available square metre with panels may look impressive on paper but be completely impractical when someone actually needs to walk across the roof.
That is what led me to build RoofGrid.
What I built
RoofGrid is a rooftop solar planning platform that lets someone start with an actual building instead of a spreadsheet.
You search for a location and open the building using satellite imagery. RoofGrid can find available building outlines using OpenStreetMap data, or you can manually draw the usable rooftop when the mapped footprint is not accurate enough.
From there, the user can mark the rooftop entrance, add obstacles such as tanks, vents or AC units, and reserve paths for maintenance access.
Only then are the solar panels placed.
That was an important design choice for me: the constraints come before the panel count.
Once the layout is generated, RoofGrid estimates system capacity and energy production using solar-resource data from NASA POWER. It also calculates installation cost, electricity savings, payback period, ROI, NPV, IRR, LCOE and environmental impact.
The goal is not to replace an engineer or installer. It is to make the first stage of rooftop solar planning much more useful.
Shipping it on AWS
For the hackathon, I chose the Ship It path, so I wanted RoofGrid to be a genuinely deployed application rather than something that only worked on my laptop.
The frontend is hosted using AWS Amplify Hosting.
The browser uses simple routes such as:
/api/ai
/api/contact
/api/nasa
/api/overpass Behind those routes, Amazon API Gateway forwards requests to AWS Lambda, where the backend logic runs.
The AI assistant is powered by Amazon Bedrock. Instead of keeping a third-party model API key in production, the Lambda function gets permission to invoke Bedrock through AWS IAM.
I also use:
- Amazon DynamoDB to maintain a deployment-wide daily AI usage counter.
- AWS Secrets Manager for private server configuration.
- Amazon CloudWatch for Lambda logs and debugging.
- AWS SAM and AWS CloudFormation to define and deploy the backend infrastructure.
The resulting request flow looks roughly like this:
User → Amplify Hosting → API Gateway → Lambda → Bedrock / DynamoDB / external solar and mapping APIs
Then Bedrock fought back
The part that taught me the most was also the part that consumed the most debugging time: Amazon Bedrock.
Getting a model to return text was only the first step.
I had to understand the model ID, AWS Region availability, IAM permissions and how Lambda should invoke the model. At one point the Bedrock call itself was working, but the output reaching the frontend was not something I wanted users to see.
The model response contained reasoning-related content that leaked into the RoofGrid AI interface.
My first instinct was to clean it up in code.
So I added sanitization.
Then I found another escaped form.
I fixed that.
Then another edge case appeared.
Looking back at the Git history is slightly painful because you can literally see the progression:
hide reasoning → fix escaped reasoning → fix the regex → finally stop doing this the fragile way.
The better solution was to change the integration itself.
I moved the Lambda implementation to Amazon Bedrock's Converse API and converted the response into the simple chat-completion structure the frontend already expected. Instead of continuously trying to remove unwanted blocks after generation, I only passed the user-facing text blocks to the interface.
That was one of those hackathon moments where the final code became simpler only after several versions of the complicated solution.
Protecting myself from my own demo
Once Bedrock worked, I immediately ran into another question:
What happens if everyone starts pressing the AI button?
A public hackathon URL plus a paid model is not a combination I wanted to leave completely unrestricted.
I added a small DynamoDB table that atomically counts AI requests for the current UTC day. Lambda checks that counter before calling Bedrock.
I also configured API Gateway throttling to limit sudden bursts of requests.
It is a small feature from the user's perspective—they never see it—but it made the application feel much more like something I could actually ship.
IAM also became more important here. Instead of giving Lambda broad AWS access, I restricted it to the Bedrock model, DynamoDB table and Secrets Manager configuration it actually needed.
The other thing that fought back: the real world
Not every difficult part was AWS.
The building-outline feature depends on public OpenStreetMap/Overpass data, and public services are not guaranteed to respond instantly every time.
During testing, roof detection occasionally timed out or failed completely.
Instead of pretending automatic detection would always work, I changed the product.
The backend now tries multiple Overpass endpoints, and the planner always keeps manual roof drawing as a fallback.
That ended up reinforcing one of the main ideas behind RoofGrid: real-world planning tools need graceful fallbacks because real-world data is messy.
What I learned
Before this project, “deploying on AWS” could easily have meant uploading a frontend somewhere and calling it cloud-native.
RoofGrid forced me to think about the whole request path.
Where does the frontend live?
Where does an API request go?
Who is allowed to invoke the model?
Where should private configuration live?
What happens if an external API fails?
How do I see what went wrong?
What stops an AI endpoint from accidentally burning through my credits?
By the end, Amplify, API Gateway, Lambda, Bedrock, DynamoDB, Secrets Manager, IAM and CloudWatch were not services I added to make an architecture diagram bigger. Each one existed because I hit a specific problem that needed solving.
And that is probably my favourite part of building RoofGrid.
I started by asking:
“How many solar panels fit on this roof?”
I ended up asking a much better question:
“What can this roof realistically do?”
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article