<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Palash Mahajan on Medium]]></title>
        <description><![CDATA[Stories by Palash Mahajan on Medium]]></description>
        <link>https://medium.com/@palash.mahajan22?source=rss-a539f9099d0e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*t5cA76cgyijJWq1M</url>
            <title>Stories by Palash Mahajan on Medium</title>
            <link>https://medium.com/@palash.mahajan22?source=rss-a539f9099d0e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 11:52:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@palash.mahajan22/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[No More Lab Coats: Building a Scalable Virtual Lab System with AWS and Supabase.]]></title>
            <link>https://medium.com/@palash.mahajan22/no-more-lab-coats-building-a-scalable-virtual-lab-system-with-aws-and-supabase-04cbc5fd8ef7?source=rss-a539f9099d0e------2</link>
            <guid isPermaLink="false">https://medium.com/p/04cbc5fd8ef7</guid>
            <category><![CDATA[virtual-lab]]></category>
            <category><![CDATA[groqcloud]]></category>
            <category><![CDATA[aws-elastic-beanstalk]]></category>
            <category><![CDATA[supabase]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <dc:creator><![CDATA[Palash Mahajan]]></dc:creator>
            <pubDate>Sun, 23 Nov 2025 06:31:54 GMT</pubDate>
            <atom:updated>2025-11-23T06:31:54.981Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>How we architected a cloud-native solution to bring Engineering Labs to the browser.</strong></h4><p>In traditional engineering education, the physical laboratory is often a bottleneck. Equipment is expensive, fragile, and strictly scheduled. If a student wants to test a CPU scheduling algorithm or configure a network topology at 3 AM, they are usually out of luck.</p><p>We decided to fix this by building a <strong>Cloud-based Virtual Lab System</strong>.</p><p>The goal was simple: Create a platform where students can perform experiments (OS, Data Structures, Networks) online, and Instructors can grade them seamlessly.</p><p>In this article, I’ll break down our architecture, our unique “Hybrid” tech stack, and specifically, <strong>how we deployed this beast using an AWS-Native strategy.</strong></p><h4><strong>The Stack: Best of Both Worlds</strong></h4><p>We didn’t want to spend months managing infrastructure, but we also needed raw power for specific tasks. We settled on a hybrid approach:</p><ul><li><strong>Frontend:</strong> React with TailwindCSS (for interactive simulations).</li><li><strong>Core Backend:</strong> ExpressJS (handling business logic).</li><li><strong>Database &amp; Auth:</strong> Supabase (PostgreSQL + Auth).</li><li><strong>Compute Utility:</strong> AWS Lambda (for generating heavy PDF reports).</li><li><strong>AI Inference:</strong> <strong>Groq API</strong> (High-speed LLM inference).</li></ul><h4><strong>The Architecture</strong></h4><p>Before we talk about <em>how</em> we deployed it, let’s look at <em>what</em> we deployed.</p><ol><li><strong>The Student Portal (React):</strong> Where the simulation happens. The state of the experiment (e.g., a completed network graph) is captured here.</li><li><strong>The API Gateway (Express):</strong> Validates requests and manages traffic.</li><li><strong>The “AI Writer” (Groq + Lambda):</strong> This is the core innovation. Before generating the PDF, AWS Lambda sends the raw experiment data to Groq. Groq analyzes the student’s logic and returns a concise summary (e.g., <em>“Student successfully implemented Round Robin scheduling but failed to handle edge cases for idle CPU time”</em>).</li><li><strong>The Reporter:</strong> The Lambda function injects this AI summary into the final PDF and saves it to storage.</li></ol><h4>The Deployment Strategy: Going AWS Native</h4><p>For production, we chose an <strong>AWS Native</strong> approach. This gives us enterprise-grade scalability and allows us to keep our billing (mostly) consolidated.</p><p>Here is the step-by-step breakdown of how we deployed this system.</p><h4>1. Frontend: AWS Amplify</h4><p>For the React application, we utilized <strong>AWS Amplify</strong>.</p><p>Why Amplify? It offers built-in CI/CD. We simply connected our GitHub repository to Amplify, and every time we push to the main branch, Amplify automatically builds the React app and deploys it to a global Content Delivery Network (CDN).</p><ul><li><strong>Build Settings:</strong> We configured the amplify.yml to handle our npm install and npm run build.</li><li><strong>Environment Variables:</strong> We injected our Supabase URL and API endpoints directly through the Amplify console, keeping our secrets out of the code.</li></ul><h4>2. Backend: AWS Elastic Beanstalk</h4><p>Our ExpressJS backend is the traffic controller. We didn’t want to manage raw EC2 instances (patching OS, setting up Nginx, etc.), so we chose <strong>AWS Elastic Beanstalk</strong>.</p><p>Elastic Beanstalk is a PaaS (Platform as a Service) that provisions the infrastructure for us.</p><p><strong>The Workflow:</strong></p><ol><li>We “Dockerized” our Express app (optional, but recommended) or simply zipped the source code.</li><li>We uploaded the artifact to Beanstalk.</li><li>Beanstalk automatically spun up an <strong>EC2 instance</strong>, set up a <strong>Load Balancer</strong>, and configured <strong>Auto-scaling</strong>.</li></ol><p>If 500 students suddenly log in for an exam, Beanstalk detects the CPU spike and adds more instances automatically.</p><h4>3. The “Heavy Lifter”: AWS Lambda</h4><p>This is where the magic happens. When a student clicks “Submit,” the Express backend sends a payload to an <strong>AWS Lambda</strong> function.</p><p>The Lambda function:</p><ol><li>Receives the simulation state (JSON).</li><li>Uses a library like Puppeteer or PDFKit to render a visual report.</li><li>An AI-generated summary of their approach is embedded in the report.</li><li>Uploads the resulting PDF to <strong>Supabase Storage</strong> (S3 compatible).</li><li>Returns the file URL to the backend.</li></ol><p>We chose <strong>AWS Lambda</strong> for this because PDF generation is CPU-heavy, and we didn’t want to block our main API.</p><p><strong>Why Groq?</strong> In a serverless environment like Lambda, you pay for every millisecond the function runs. Traditional LLMs can take 5–10 seconds to generate a summary. <strong>Groq</strong>, running on LPUs (Language Processing Units), returns the inference in sub-second speeds. This keeps our Lambda costs low and the user experience snappy.</p><p><strong>The Code: Serverless AI Integration</strong></p><p>Here is a sample handler inside AWS Lambda. It receives the data, asks Groq for a summary, creates the PDF, and uploads it to Supabase.</p><pre>const { Groq } = require(&quot;groq-sdk&quot;);<br>const PDFDocument = require(&quot;pdfkit&quot;);<br>const { createClient } = require(&#39;@supabase/supabase-js&#39;);<br><br>// Initialize Clients<br>const groq = new Groq({ apiKey: process.env.GROQ_API_KEY });<br>const supabase = createClient(process.env.SUPABASE_URL, process.env.SUPABASE_KEY);<br><br>exports.handler = async (event) =&gt; {<br>  try {<br>    const { experimentState, studentId, experimentName } = JSON.parse(event.body);<br><br>    // --- STEP 1: AI Inference via Groq ---<br>    // We send the raw state to Groq to get a human-readable summary<br>    const chatCompletion = await groq.chat.completions.create({<br>      messages: [{<br>        role: &quot;user&quot;,<br>        content: `Analyze this engineering experiment state: ${JSON.stringify(experimentState)}. <br>                  Summarize the student&#39;s approach and identify any logical errors in 3 sentences.`<br>      }],<br>      model: &quot;mixtral-8x7b-32768&quot;, // Fast inference model<br>    });<br><br>    const aiSummary = chatCompletion.choices[0]?.message?.content || &quot;Summary unavailable.&quot;;<br><br>    // --- STEP 2: Generate PDF ---<br>    // We inject the AI summary into the PDF document<br>    const doc = new PDFDocument();<br>    let buffers = [];<br>    doc.on(&#39;data&#39;, buffers.push.bind(buffers));<br>    <br>    doc.fontSize(20).text(`Report: ${experimentName}`);<br>    doc.fontSize(14).text(`Student ID: ${studentId}`);<br>    doc.moveDown();<br>    doc.fontSize(12).text(&quot;Automated AI Analysis:&quot;, { underline: true });<br>    doc.text(aiSummary); // &lt;--- The Groq output goes here<br>    <br>    doc.end();<br><br>    // Wait for PDF to finish building<br>    const pdfBuffer = await new Promise(resolve =&gt; doc.on(&#39;end&#39;, () =&gt; resolve(Buffer.concat(buffers))));<br><br>    // --- STEP 3: Upload to Supabase ---<br>    const fileName = `submissions/${studentId}/${Date.now()}.pdf`;<br>    const { data, error } = await supabase.storage<br>      .from(&#39;reports&#39;)<br>      .upload(fileName, pdfBuffer, { contentType: &#39;application/pdf&#39; });<br><br>    if (error) throw error;<br><br>    return {<br>      statusCode: 200,<br>      body: JSON.stringify({ message: &quot;Report generated&quot;, url: data.path }),<br>    };<br><br>  } catch (err) {<br>    return { statusCode: 500, body: JSON.stringify({ error: err.message }) };<br>  }<br>};</pre><h4>4. Database &amp; Auth: Supabase</h4><p>While our compute is on AWS, our data lives in <strong>Supabase</strong>.</p><p>Why split the cloud providers? Speed. Supabase provided us with a production-ready PostgreSQL database and a full Authentication system in minutes.</p><ul><li><strong>Connection:</strong> Our Express app running on AWS Elastic Beanstalk connects to Supabase via standard PostgreSQL connection strings stored in environment variables.</li><li><strong>Storage:</strong> The Lambda function writes the PDFs directly to Supabase Storage buckets, which the Instructor dashboard then reads.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*2Kp-reB95NJ9p_78PZRwRQ.png" /><figcaption>System Architecture</figcaption></figure><h4>Why This Configuration Works</h4><p>This architecture solves the specific problems of an educational platform:</p><ol><li><strong>Burst Traffic Handling:</strong> Exams cause massive traffic spikes. Elastic Beanstalk and Lambda scale up instantly to handle the load, then scale down to save money.</li><li><strong>Isolation of Concerns:</strong> If the PDF generator crashes (because a student submitted corrupt data), it doesn’t crash the main API. The rest of the class can continue working.</li><li><strong>Instructor UX:</strong> Because the PDFs are generated asynchronously and stored in the cloud, instructors can view submissions instantly from anywhere, without downloading huge files to their local machines.</li><li><strong>Cost Efficiency:</strong> By using Groq, we reduced the execution time of our Lambda functions significantly compared to using other AI providers. Faster inference = lower AWS bills.</li><li><strong>Instructor Productivity:</strong> Instructors no longer have to decipher raw JSON logs or replay simulations to understand what a student did. The AI summary gives them immediate context (e.g., <em>“Student failed to close the TCP connection”</em>), allowing them to grade faster.</li><li><strong>Scalability:</strong> Whether it’s 1 student or 1,000, AWS Lambda scales the PDF generation and AI inference requests automatically.</li></ol><h4>Conclusion</h4><p>Building a Virtual Lab wasn’t just about writing code; it was about architecting a system that is resilient, cost-effective, and scalable. By combining the ease of Supabase with the raw power of AWS, we created a platform that is ready for the future of engineering education.</p><p><em>Have you integrated LLMs into your serverless workflows? Let me know in the comments!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=04cbc5fd8ef7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding the Fast Fourier Transform: From Sound Waves to Digital Revolution]]></title>
            <link>https://medium.com/@palash.mahajan22/understanding-the-fast-fourier-transform-from-sound-waves-to-digital-revolution-8e0d127189ab?source=rss-a539f9099d0e------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e0d127189ab</guid>
            <category><![CDATA[signal-processing]]></category>
            <category><![CDATA[fast-fourier-transform]]></category>
            <dc:creator><![CDATA[Palash Mahajan]]></dc:creator>
            <pubDate>Sun, 27 Apr 2025 12:37:05 GMT</pubDate>
            <atom:updated>2025-04-27T12:41:36.147Z</atom:updated>
            <content:encoded><![CDATA[<p>Have you ever wondered how your smartphone recognizes songs, or how astronomers detect patterns in cosmic signals? Behind many of these fascinating technologies lies a powerful mathematical technique called the Fast Fourier Transform, or FFT for short. In this post, I’ll guide you through what the FFT is, how it works, and why it’s become one of the most important algorithms in the digital age — all without getting lost in complex technical details.</p><h3>What is a Fourier Transform?</h3><p>Before diving into the “fast” version, let’s understand the basic concept. The Fourier Transform is named after Jean-Baptiste Joseph Fourier, a French mathematician who lived in the late 18th and early 19th centuries. While studying heat flow, he made a remarkable discovery: any continuous pattern or signal can be broken down into a collection of simple sine waves of different frequencies.</p><p>Think of it like this: when you hear a chord played on a piano, your ear receives one complex sound wave. But that wave is actually a combination of several pure tones (the individual notes) played together. The Fourier Transform is like having a super-ear that can tell you exactly which notes make up that chord and how strong each note is.</p><h3>From Complex to Simple</h3><p>Let’s visualize this with a simple example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ULhmeQl0GO0cEr8x1D_GxQ.png" /></figure><p>The Fourier Transform takes your complex signal (bottom) and tells you exactly which simple waves (top) when added together will recreate your original signal. It’s like having a recipe that lists the exact ingredients needed to make a dish.</p><h3>Why “Fast”? Enter the FFT</h3><p>The original Fourier Transform worked, but it was computationally expensive — requiring a huge number of calculations. In 1965, two mathematicians, James Cooley and John Tukey, published an algorithm that dramatically sped up this process. Their “Fast Fourier Transform” reduced the number of calculations needed from something like N² to N × log(N), where N is the number of data points.</p><p>To put this in perspective, analyzing a music file with 1 million data points would require:</p><ul><li>Original method: 1,000,000,000,000 calculations (one trillion!)</li><li>FFT method: About 20,000,000 calculations (20 million)</li></ul><p>That’s a difference between taking weeks versus seconds on a computer!</p><h3>How Does the FFT Work?</h3><p>While the math behind the FFT gets complex quickly, the core insight is actually quite elegant. The algorithm uses a “divide and conquer” approach:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2g42Gt3Deh6FduflT-O5YQ.png" /></figure><ol><li><strong>Divide</strong>: The FFT splits the original signal into two halves: one containing the even-numbered samples and one containing the odd-numbered samples.</li><li><strong>Conquer</strong>: It then applies the same splitting process recursively until it has broken down the problem into tiny, manageable calculations.</li><li><strong>Combine</strong>: Finally, it merges these results back together in a clever way that saves many calculations.</li></ol><p>This clever approach is what makes the FFT “fast” and has led to its widespread adoption across countless applications.</p><h3>FFT in Action: Real-World Applications</h3><p>The Fast Fourier Transform is truly one of the most versatile mathematical tools ever created. Here are just a few ways it’s used today:</p><h3>Audio Processing and Music</h3><ul><li><strong>Shazam and music recognition</strong>: When you ask your phone “what song is this?”, FFT helps analyze the audio fingerprint</li><li><strong>Audio equalizers</strong>: The sliders you adjust to boost bass or treble work by applying FFT</li><li><strong>Music production</strong>: Auto-tune and other audio effects rely heavily on FFT</li></ul><h3>Images and Video</h3><ul><li><strong>JPEG compression</strong>: FFT-like transforms help reduce image file sizes</li><li><strong>Medical imaging</strong>: MRI and CT scans use FFT to convert raw data into images</li><li><strong>Image enhancement</strong>: Many filters that improve image quality use FFT</li></ul><h3>Science and Engineering</h3><ul><li><strong>Astronomy</strong>: Analyzing light from distant stars</li><li><strong>COVID-19 research</strong>: Analyzing protein structures</li><li><strong>Earthquake detection</strong>: Finding patterns in seismic data</li><li><strong>Weather forecasting</strong>: Processing large amounts of atmospheric data</li></ul><h3>Telecommunications</h3><ul><li><strong>Wi-Fi and 4G/5G</strong>: Modern wireless communications use FFT techniques (specifically OFDM)</li><li><strong>Radar and sonar</strong>: Detecting objects by analyzing signal reflections</li></ul><h3>The History of the FFT</h3><p>While Cooley and Tukey published their groundbreaking FFT algorithm in 1965, the core ideas have a fascinating history:</p><ul><li><strong>1805</strong>: Joseph Fourier first proposes that any function can be represented as a sum of sine waves while studying heat transfer.</li><li><strong>1903</strong>: Early versions of efficient Fourier Transform algorithms appear in work by mathematician Carl Runge.</li><li><strong>1942</strong>: During World War II, mathematician John von Neumann reportedly develops a version of the fast algorithm.</li><li><strong>1965</strong>: James Cooley (IBM) and John Tukey (Princeton) publish their famous FFT paper, motivated by the need to detect nuclear tests by analyzing seismic data.</li></ul><p>Interestingly, the Cooley-Tukey algorithm was later discovered to have been previously invented by Carl Friedrich Gauss around 1805 — but Gauss never published it! This rediscovery and publication in the computer age came at exactly the right moment, as computing power was just becoming widespread enough to make digital signal processing practical.</p><h3>Why the FFT Matters</h3><p>It’s hard to overstate the importance of the Fast Fourier Transform. In 1999, the journal Computing in Science and Engineering named the FFT one of the top 10 algorithms of the 20th century.</p><p>By allowing computers to efficiently move between time and frequency representations of data, the FFT has:</p><ul><li>Enabled countless technological innovations from digital music to cell phones</li><li>Accelerated scientific discoveries across diverse fields</li><li>Transformed how we process and understand signals of all kinds</li></ul><p>Every time you use a smartphone, enjoy digital music, or benefit from medical imaging, you’re experiencing the results of this elegant mathematical technique.</p><h3>Conclusion</h3><p>The Fast Fourier Transform is a perfect example of how a mathematical insight — that complex patterns can be broken down into simpler components — combined with clever algorithmic thinking can transform entire industries and fields of study.</p><p>While the mathematics behind it can be complex, the basic idea remains beautifully simple: breaking complicated things into simpler parts that we can analyze more easily. It’s a lesson that extends far beyond mathematics and into how we approach problem-solving in general.</p><p>Next time you ask your phone to identify a song or look at an MRI scan, remember that the Fast Fourier Transform is working its mathematical magic behind the scenes!</p><p>For further understanding of the algorithm I would suggest watching YouTube videos from the channel <a href="https://youtu.be/spUNpyF58BY?si=_7-pm8QN05CVks2q"><strong>3Blue1Brown</strong></a> and <a href="https://youtu.be/nmgFG7PUHfo?si=mZTAKR6P9YAKbkev"><strong>Veritasium</strong></a>.</p><p>What other mathematical algorithms would you like to learn about? Let me know in the comments below!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e0d127189ab" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>