As part of the Gen AI Academy APAC, I set out to solve a major pain point for educators: manually sifting through textbooks to create grade-appropriate question papers.

I built an automated Question Paper Generator using a Serverless Next.js stack, a Retrieval-Augmented Generation (RAG) architecture, and the complete Google Cloud AI suite. Teachers simply upload a textbook chapter (PDF), specify the grade and subject, and let the AI generate a fully formatted assessment quiz.

While the architecture sounds straightforward, orchestrating these enterprise-grade APIs in a serverless environment presented several intense technical hurdles. Here is a deep dive into the architecture, the specific roadblocks I hit, and how I ultimately solved them.

The application is built on Next.js 15 and deployed to Google Cloud Run. The pipeline flows as follows:

Document Extraction: The PDF is uploaded and sent to Google Cloud Document AI (Document OCR Processor) to extract the raw text.