AWS Builder Center

building vidya-os: turning youtube into a serverless lms with aws sam

how i used aws sam and mangum to build a local serverless backend for a chrome extension that gives engineering students instant ai context on youtube lectures

the problem

millions of engineering students in india rely on youtube to study for exams but the platform is built for entertainment not education. when a professor shows a dense slide or complex diagram students get stuck and have no one to ask
to fix this i built vidya-os for the bharat builds hackathon. it is a chrome extension that tracks your syllabus and lets you capture the exact video frame you are watching to get an instant ai explanation without leaving the browser

the serverless stack

for the backend i wanted a serverless architecture so i would not have to manage infrastructure if the user base grows. i wrote the core api in python using fastapi
to bridge the gap between a standard web framework and aws lambda i used mangum. it is an adapter that translates aws api gateway events into something my fastapi app can process natively

building locally with aws sam

since i was competing in the build it track i needed to build and test the architecture locally. i used the aws sam (serverless application model) cli to handle this
writing the  template.yaml  made it incredibly easy to define the serverless function. running  sam local start-api  spun up a local docker container that mimicked api gateway and lambda perfectly

what fought back

the biggest hurdle was configuring cors. making a local chrome extension post base64 image payloads to a local sam api gateway endpoint required some annoying trial and error with wildcard headers in the template configuration
testing with sam local also felt a bit heavy since it spins up a container on every request but the accuracy of the local environment is worth the tradeoff

the takeaway

the best part of this stack is the deployment confidence. wrapping fastapi with mangum is totally seamless. it feels great knowing the exact same codebase i tested locally using the sam cli is ready to deploy to aws lambda in production with zero rewrites
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