<?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 Sarvesh M Rao on Medium]]></title>
        <description><![CDATA[Stories by Sarvesh M Rao on Medium]]></description>
        <link>https://medium.com/@sarveshmrao?source=rss-4c4d2c06f7cb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*XuhuYe5XYYo5BeYZ5-tgtA.png</url>
            <title>Stories by Sarvesh M Rao on Medium</title>
            <link>https://medium.com/@sarveshmrao?source=rss-4c4d2c06f7cb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 11:55:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sarveshmrao/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[GitHub as a Database? Yes and We Built Real-Time Push Notifications With It]]></title>
            <link>https://sarveshmrao.medium.com/github-as-a-database-yes-and-we-built-real-time-push-notifications-with-it-c16a9e2a3c33?source=rss-4c4d2c06f7cb------2</link>
            <guid isPermaLink="false">https://medium.com/p/c16a9e2a3c33</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[product]]></category>
            <category><![CDATA[notifications]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Sarvesh M Rao]]></dc:creator>
            <pubDate>Sat, 06 Dec 2025 05:45:29 GMT</pubDate>
            <atom:updated>2025-12-06T05:45:29.254Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_a0SrWXy96RGPGSnj9Cd7Q.png" /><figcaption>tamilnadu.tech</figcaption></figure><p>A few months ago I was staring at the analytics for <a href="http://tamilnadu.tech/">tamilnadu.tech</a> and felt a little sad :(</p><p>People would visit the site, scroll through the community list or the events page, and then disappear.</p><p>Sometimes a really cool meetup in Madurai or a hackathon in Coimbatore would get announced ten minutes after someone left the site. They’d miss it completely. We were just a fancy directory, not a living platform.</p><p>We needed push notifications. Badly.</p><p>But here’s the thing: I did not want to spin up a server, pay for a database, or wake up at 3 a.m. because Redis ran out of memory. The whole site is happily hosted on Vercel as a static Next.js app. Adding a traditional backend just for push subscriptions felt like putting a V8 engine on a bicycle.</p><p>So I did something a bit ridiculous instead: I used GitHub itself as the database and GitHub Actions as the notification sender.</p><p>Yes, really.</p><p>And it works really well.</p><h3><strong>The moment everything clicked</strong></h3><p>One evening I was reviewing a PR in our <a href="http://tamilnadu.tech/">tamilnadu.tech</a> repo and thought:</p><p>“Wait… every time someone merges an event update, GitHub already runs workflows. What if that same workflow also sent push notifications?”</p><p>30 minutes later I had a proof of concept. Two weeks later we shipped it.</p><p>Here’s how the whole thing works.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*Pq_sEsSmezxj6wy2QO_r3Q.png" /><figcaption>flowchart of how things work ehre</figcaption></figure><p><strong>1. The user subscribes</strong></p><p>When someone clicks the little bell icon on tamilnadu.tech, two things happen in the browser:</p><pre><br>// public/sw.js (service worker)<br>self.addEventListener(&#39;push&#39;, event =&gt; {<br> const data = event.data.json();<br> <br> self.registration.showNotification(data.title, {<br> body: data.body,<br> icon: &#39;/icon-192.png&#39;,<br> badge: &#39;/badge-72.png&#39;,<br> data: data.url,<br> tag: &#39;tamilnadu-event&#39;<br> });<br>});<br><br><br>self.addEventListener(&#39;notificationclick&#39;, event =&gt; {<br> event.notification.close();<br> clients.openWindow(event.notification.data);<br>});</pre><p>And on the frontend we ask for permission and send the subscription to our API:</p><pre>const subscription = await registration.pushManager.subscribe({<br> userVisibleOnly: true,<br> applicationServerKey: urlBase64ToUint8Array(process.env.NEXT_PUBLIC_VAPID_PUBLIC_KEY)<br>});<br><br>await fetch(&#39;/api/save-subscription&#39;, {<br> method: &#39;POST&#39;,<br> body: JSON.stringify(subscription)<br>});</pre><p>Simple, standard Web Push stuff.</p><p><strong>2. We commit that subscription straight into GitHub</strong></p><p>Instead of saving it to Supabase or Firebase, our Next.js API route opens a PR (authenticated) pull request that creates a tiny JSON file in a private folder called _subscriptions.</p><p>Example file name: <em>_subscriptions/SUB_8f3c9d2e1a.json</em></p><pre>{<br> &quot;endpoint&quot;: &quot;https://fcm.googleapis.com/fcm/send/xyz...&quot;,<br> &quot;keys&quot;: {<br> &quot;p256dh&quot;: &quot;BD…&quot;,<br> &quot;auth&quot;: &quot;Xy…&quot;<br> },<br> &quot;createdAt&quot;: &quot;2025–07–21T10:32:41Z&quot;,<br> &quot;userAgent&quot;: &quot;Chrome/126 on macOS&quot;<br>}</pre><p>Version-controlled, auditable, and free.</p><p><strong>3. When a new event lands → everyone gets notified</strong></p><p>Every time someone merges an update to events.json (which powers the entire events calendar), a GitHub workflow called <strong><em>send-notifications.yml</em></strong> wakes up.</p><p>It does three things:</p><p>1. Downloads the previous and current version of <strong><em>events.json</em></strong><br>2. Finds the newly added events (simple diff)<br>3. Loops through every file in <strong><em>_subscriptions/</em></strong> loads the subscription, and fires the notification using the web-push library.</p><p>Here’s the juicy part of the workflow (heavily simplified):</p><pre> name: Send Push Notifications<br> run: node ./scripts/send-notifications.js<br> env:<br> VAPID_PRIVATE_KEY: ${{ secrets.VAPID_PRIVATE_KEY }}<br> GITHUB_TOKEN: ${{ secrets.GH_PAT }}</pre><p>And the Node script is small. It literally reads:</p><pre>for (const file of subscriptionFiles) {<br> const sub = JSON.parse(readFile(file));<br> await webpush.sendNotification(sub, payload);<br>}</pre><p>That’s it. No queue, no workers, no billing surprise at the end of the month.</p><p><strong>The result?</strong></p><p>Within seconds of a new meetup being announced, hundreds of browsers light up:</p><p>“Hey! New event: NammaFlutter Meetup -&gt; This Saturday at Mako IT Lab”</p><p>People started showing up to events they would have completely missed otherwise. Community organisers told me attendance went up noticeably. That felt good.</p><p><strong>Final thoughts</strong></p><p>Sometimes the craziest ideas turn out to be the best ones. We now have a battle tested, zero cost, fully serverless push notification system that’s literally powered by GitHub.</p><p>If you ever thought “I wish I could add real-time features but I’m just a static site”, try getting creative with the tools you already have. You might surprise yourself.</p><p>Want to steal/borrow the code? Here’s the PR that made it all happen:</p><p><a href="https://github.com/FOSSUChennai/Communities/pull/368">PR #368 Push Notification System with GitHub-Driven Subscription Management</a></p><p>And yes, the bell icon on tamilnadu.tech is live. <br>Go ahead, smash it. <br>I am asking you to.</p><p>See you at the next meet-up (you’ll know about it, I promise)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c16a9e2a3c33" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>