TIL how Levels.fyi used Google Sheets
POSTED ON:
TAGS: database google quickanddirty image
I love finding creative workarounds to complex problems.
Via How Levels.fyi scaled to millions of users with Google Sheets as a backend
This quote:
Our philosophy to scaling is simple, avoid premature optimization
How does it work?
Write Flow: #
Version 0
V0 had no UI, add salary form was a Google Forms UI 😱
LOL, so literally a embedded Google Form. Hell yeah.
Version 1
Our own UI with necessary validations on the frontend
- Frontend calls publicly visible API Gateway
- API Gateway triggers and spawns a lambda function
- Lambda function processes and appends new salary to the sheet
Form does a post request, which sends it to a serverless function.
Then the serverless function adds that data to that Google Sheet.
I LOVE IT.
Read Flow #
How does data show up on their website?
Remember that their 'database' is Google Sheets. So they had to do something creative to generate that data.
Our recipe for building a read flow was as follows:
- Process data from Google Sheet and create a JSON file
- Use AWS Lambda for processing and creating new JSON files
- Upsert JSON files on S3
- Cache JSON files using a CDN like AWS Cloudfront
Btw, upsert is short for Update
and Insert
. No I never heard of it until today.
So really, it's literally just turning the Google Sheets into a JSON file using serverless functions, upload it to S3, then use a CDN to handle server load.
Related TILs
Tagged: database