<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Harsh Sharma</title>
    <description>The latest articles on Forem by Harsh Sharma (@harsh9887).</description>
    <link>https://forem.com/harsh9887</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3853217%2F45244818-a644-44ce-884b-2ab1e69ee029.png</url>
      <title>Forem: Harsh Sharma</title>
      <link>https://forem.com/harsh9887</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/harsh9887"/>
    <language>en</language>
    <item>
      <title>Building an AI-Powered UPSC Platform with Next.js 15, Supabase &amp; Gemini 3 Flash</title>
      <dc:creator>Harsh Sharma</dc:creator>
      <pubDate>Tue, 31 Mar 2026 10:12:19 +0000</pubDate>
      <link>https://forem.com/harsh9887/building-an-ai-powered-upsc-platform-with-nextjs-15-supabase-gemini-3-flash-4noo</link>
      <guid>https://forem.com/harsh9887/building-an-ai-powered-upsc-platform-with-nextjs-15-supabase-gemini-3-flash-4noo</guid>
      <description>&lt;h2&gt;
  
  
  Why We Built Vaidra
&lt;/h2&gt;

&lt;p&gt;Over a million students attempt India's UPSC Civil Services Exam every year. Most lack access to quality coaching. We built&lt;br&gt;
  &lt;a href="https://vaidra.in" rel="noopener noreferrer"&gt;Vaidra&lt;/a&gt; — a free, AI-powered platform to democratize UPSC preparation.&lt;/p&gt;

&lt;p&gt;## Tech Stack&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Frontend:&lt;/strong&gt; Next.js 15 + React 19 (App Router, Server Components)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Styling:&lt;/strong&gt; Tailwind CSS + Framer Motion (spring physics animations)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Backend:&lt;/strong&gt; Self-hosted Supabase (PostgreSQL 15.8) on VPS&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI:&lt;/strong&gt; Google Gemini 3 Flash with native structured output (&lt;code&gt;responseSchema&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Payments:&lt;/strong&gt; Razorpay&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Maps:&lt;/strong&gt; Mapbox GL&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hosting:&lt;/strong&gt; Vercel + VPS (PM2 cluster, 8 instances)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;## Architecture Decisions That Matter&lt;/p&gt;

&lt;p&gt;### Event-First Data Architecture&lt;/p&gt;

&lt;p&gt;Every user action is logged as an immutable event in &lt;code&gt;user_events&lt;/code&gt;. This is our single source of truth. We never UPDATE or DELETE events — append&lt;br&gt;
  only.&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
typescript
  // Step 1: Log event FIRST (must succeed)
  const { data: event } = await supabase
    .from('user_events')
    .insert({
      user_id: userId,
      event_type: 'test_completed',
      event_data: { score, time_taken }
    })
    .select('id')
    .single();

  // Step 2: Update denormalized tables for O(1) reads
  await supabase.from('user_stats_summary')
    .upsert({ user_id: userId, tests_completed: newCount });

  AI with Structured Output

  We use Gemini 3 Flash's native responseSchema for guaranteed JSON responses — no prompt hacking or string parsing needed.

  React Query Everywhere

  All data fetching uses @tanstack/react-query. No manual fetch() + useState + useEffect patterns. Centralized caching, automatic refetching,
  optimistic updates.

  Accessibility First (WCAG 2.1 AA/AAA)

  - prefers-reduced-motion support via custom hook + CSS
  - Skeleton loaders for all loading states (like Notion)
  - Comprehensive ARIA labels on every interactive element
  - Keyboard navigation throughout

  Key Features

  - AI Prelims Practice — Adaptive MCQs with instant AI explanations
  - AI Mains Evaluation — Write answers, get detailed AI feedback on structure and content
  - Daily Current Affairs — AI-curated news mapped to UPSC syllabus
  - Interactive Study Maps — Visual syllabus navigation with progress tracking
  - Government Schemes DB — Searchable database essential for both Prelims and Mains

  Why Free?

  A student in rural Bihar deserves the same prep quality as someone in Delhi coaching centres. AI lets us deliver at near-zero marginal cost. Free
  tier has full access; premium (₹99/month) adds unlimited mains evaluations.

  Try it: https://vaidra.in

  ---
  Built with Next.js 15, React 19, Supabase, and Gemini 3 Flash.

  ---
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>ai</category>
      <category>nextjs</category>
      <category>webdev</category>
      <category>react</category>
    </item>
  </channel>
</rss>
