<?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 Maazy on Medium]]></title>
        <description><![CDATA[Stories by Maazy on Medium]]></description>
        <link>https://medium.com/@mmaazy03?source=rss-0ab702f669ba------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*fYJYIH0Yv_RnZY2PJ7enrQ.jpeg</url>
            <title>Stories by Maazy on Medium</title>
            <link>https://medium.com/@mmaazy03?source=rss-0ab702f669ba------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 13:17:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mmaazy03/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[Build a Two-Way SMS with Node.js and Twilio (Full Code Included)]]></title>
            <link>https://medium.com/@mmaazy03/build-a-two-way-sms-with-node-js-and-twilio-full-code-included-10b1a2cc0bc4?source=rss-0ab702f669ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/10b1a2cc0bc4</guid>
            <category><![CDATA[sms]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[twilio]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Maazy]]></dc:creator>
            <pubDate>Tue, 22 Sep 2026 06:26:46 GMT</pubDate>
            <atom:updated>2026-09-22T06:26:46.332Z</atom:updated>
            <content:encoded><![CDATA[<h4>Almost every tutorial teaches you how to send a text and then waves goodbye. Here’s the half nobody finishes: actually listening for replies.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fYJL3d1OxZyeMvq1MX6hUw.png" /></figure><p>That “listening” half is where the real magic lives. It’s what turns a one-way notification into an OTP flow, a support bot, an appointment system that confirms itself. So that’s what we’re building today: a small Node.js server that can text a phone <em>and</em> wake up whenever that phone texts back.</p><p>It took me an afternoon. It’ll take you less, because I already hit the potholes.</p><h3>Before We Start</h3><p>Grab these:</p><ul><li>A <a href="https://www.twilio.com/">Twilio</a> account — the free trial hands you around $15 in credit, which is plenty for this</li><li><a href="https://www.postman.com/">Postman</a> (or any tool to poke your endpoints)</li><li>Node.js on your machine</li><li><a href="https://ngrok.com/">ngrok</a> — the thing that lets Twilio reach your laptop</li></ul><p>Two goals, that’s it: <strong>send</strong> a text from Node, and <strong>receive</strong> replies back into it.</p><p>Let’s go.</p><h3>Step 1: The Bare-Bones Server</h3><p>Make a folder, create a server.js inside it, and paste this in:</p><pre>const express = require(&quot;express&quot;);<br>const bodyParser = require(&quot;body-parser&quot;);<br>const hostname = &quot;127.0.0.1&quot;;<br>const port = 3000;<br>const app = express();<br><br>app.use(bodyParser.json());<br>app.use(bodyParser.urlencoded({ extended: true }));<br><br>const baseUrl = &quot;/api/v1/&quot;;<br><br>app.get(`${baseUrl}`, (req, res) =&gt; {<br>  res.status(200).json({ message: &quot;Hello World&quot; });<br>});<br>app.listen(port, hostname, () =&gt; {<br>  console.log(`Server running at http://${hostname}:${port}/`);<br>});</pre><p>Install what you need:</p><pre>npm init -y<br>npm install express body-parser</pre><p>Fire it up and visit http://127.0.0.1:3000/api/v1/. If you see &quot;Hello World,&quot; you&#39;re in business.</p><h3>Step 2: Let the Outside World In (ngrok)</h3><p>Here’s the thing — Twilio lives on the internet, and your server lives on your laptop. They can’t talk unless you build a bridge. That’s ngrok’s whole job. (Heroku used to be the free go-to here, but those days are gone.)</p><p>Follow the <a href="https://ngrok.com/docs">ngrok docs</a> to install and authenticate, then add a script to package.json:</p><pre>&quot;scripts&quot;: {<br>  &quot;ngrok&quot;: &quot;ngrok http http://127.0.0.1:3000/&quot;<br>}</pre><p>Run it in two steps — server first, then the tunnel:</p><pre>npm run ngrok</pre><p>ngrok will spit out a public HTTPS URL like https://abcd-1234.ngrok-free.app. Keep that tab open.</p><blockquote><strong><em>The pothole I hit:</em></strong><em> on the free plan, that URL changes </em>every single time you restart ngrok<em>. If your webhook mysteriously stops working later, this is almost always why. Restart ngrok → update the URL in Twilio. Every time.</em></blockquote><h3>Step 3: Set Up Twilio</h3><p>Sign up, then head to your dashboard and copy two things into a .env file:</p><p>env</p><pre>ACCOUNT_SID_TWILIO=your_account_sid<br>AUTH_TOKEN_TWILIO=your_auth_token</pre><p>On the left panel you can pin products you only need <strong>Messaging</strong> and <strong>Phone Numbers</strong> for this.</p><h4>Buy a Number</h4><p>You can’t send or receive anything without a Twilio number.</p><ol><li>Go to <strong>Phone Numbers → Buy a number</strong></li><li>Pick one you like (US numbers are usually the cheapest)</li><li>Twilio deducts it from your trial credit, and it shows up under your active numbers</li></ol><h4>Create a Messaging Service</h4><ol><li>Open <strong>Messaging</strong> and create a new <strong>Messaging Service</strong></li><li><strong>Sender Pool step:</strong> add the number you just bought</li><li><strong>Integration step:</strong> choose <strong>Send a webhook</strong>, and in both the <strong>Request URL</strong> and <strong>Fallback URL</strong>, paste your ngrok URL + /api/v1/smse.g. https://abcd-1234.ngrok-free.app/api/v1/sms. Don&#39;t worry, we&#39;ll build that endpoint in a minute.</li><li>Skip the next step and finish</li></ol><p>Copy the <strong>Messaging Service SID</strong> and add it, plus your number, to .env:</p><pre>FROM_TWILIO=+1XXXXXXXXXX<br>MESSAGING_SERVICE_SID_TWILIO=your_messaging_service_sid</pre><h3>Step 4: Bring Twilio Into Node</h3><p>Install the SDK (and dotenv, so your .env actually loads):</p><pre>npm install twilio dotenv</pre><p>At the very top of server.js:</p><pre>require(&quot;dotenv&quot;).config();<br><br>const client = require(&quot;twilio&quot;)(<br>  process.env.ACCOUNT_SID_TWILIO,<br>  process.env.AUTH_TOKEN_TWILIO<br>);</pre><h3>Goal 1: Sending a Text</h3><pre>app.post(`${baseUrl}sendSms`, async (req, res) =&gt; {<br>  try {<br>    await client.messages.create({<br>      body: &quot;Hello&quot;,<br>      from: process.env.FROM_TWILIO,<br>      messagingServiceSid: process.env.MESSAGING_SERVICE_SID_TWILIO,<br>      to: &quot;+92XXXXXXXXXX&quot;, // whoever you&#39;re texting<br>    });<br>    res.status(200).json({ message: &quot;Text sent successfully&quot; });<br>  } catch (err) {<br>    res.status(500).json({ error: err.message });<br>  }<br>});</pre><p>What each field is doing:</p><ul><li><strong>body</strong> — the message text</li><li><strong>from</strong> — your Twilio number</li><li><strong>messagingServiceSid</strong> — the service SID from earlier</li><li><strong>to</strong> — the recipient, in E.164 format (+92..., +1..., etc.)</li></ul><p>Hit POST /api/v1/sendSms from Postman, and your phone should buzz. 🎉</p><blockquote><strong><em>Second pothole:</em></strong><em> on a trial account, Twilio only lets you text numbers you’ve </em>verified<em> in the console. If your message vanishes into the void, that’s why. Verify the recipient first, or upgrade.</em></blockquote><h3>Goal 2: Actually Listening for Replies</h3><p>This is the part nobody teaches. When someone replies to your Twilio number, Twilio takes that message and forwards it to the webhook you set up (/sms). Your job is to catch it.</p><p>Add this near your imports:</p><pre>const MessagingResponse = require(&quot;twilio&quot;).twiml.MessagingResponse;</pre><p>Then the listener — and here’s the one rule that trips everyone up: <strong>this endpoint has to exactly match the webhook URL you gave Twilio.</strong> In our case, /api/v1/sms:</p><pre>app.post(`${baseUrl}sms`, (req, res) =&gt; {<br>  // Fires every time someone replies to your number<br>  const twiml = new MessagingResponse();<br>console.log(&quot;INCOMING -----&gt;&quot;, req.body.Body);<br>  res.writeHead(200, { &quot;Content-Type&quot;: &quot;text/xml&quot; });<br>  res.end(twiml.toString());<br>});</pre><p>Text your Twilio number from your phone, watch your terminal, and there’s your message sitting in req.body.Body. That&#39;s the whole loop closed.</p><h3>Bonus: Make It Talk Back</h3><p>Right now your bot listens but stays silent. One line changes that:</p><pre>const incoming = req.body.Body.trim().toLowerCase();<br>if (incoming === &quot;hi&quot;) {<br>  twiml.message(&quot;Hey there! How can I help?&quot;);<br>} else {<br>  twiml.message(&quot;Hmm, I didn&#39;t catch that.&quot;);<br>}</pre><p>twiml.message() sends a reply straight back to the sender. That&#39;s the seed of every SMS bot you&#39;ve ever interacted with — keyword routing, booking confirmations, &quot;reply STOP to unsubscribe.&quot; All of it starts right here.</p><h3>That’s the Whole Thing</h3><p>You’ve got a server that sends <em>and</em> receives the two halves nobody usually finishes. From here the world opens up: save conversations to a database, build a proper keyword bot, or bolt on OTP verification for logins.</p><p>If you build something with this, I’d genuinely love to hear about it. Drop a comment or, you know, text me. 😄</p><h3>The Complete Code</h3><pre>require(&quot;dotenv&quot;).config();<br><br>const express = require(&quot;express&quot;);<br>const bodyParser = require(&quot;body-parser&quot;);<br>const MessagingResponse = require(&quot;twilio&quot;).twiml.MessagingResponse;<br>const client = require(&quot;twilio&quot;)(<br>  process.env.ACCOUNT_SID_TWILIO,<br>  process.env.AUTH_TOKEN_TWILIO<br>);<br>const hostname = &quot;127.0.0.1&quot;;<br>const port = 3000;<br>const app = express();<br>app.use(bodyParser.json());<br>app.use(bodyParser.urlencoded({ extended: true }));<br><br>const baseUrl = &quot;/api/v1/&quot;;<br>// Health check<br>app.get(`${baseUrl}`, (req, res) =&gt; {<br>  res.status(200).json({ message: &quot;Hello World&quot; });<br>});<br><br>// Goal 1: Send an SMS<br>app.post(`${baseUrl}sendSms`, async (req, res) =&gt; {<br>  try {<br>    await client.messages.create({<br>      body: &quot;Hello&quot;,<br>      from: process.env.FROM_TWILIO,<br>      messagingServiceSid: process.env.MESSAGING_SERVICE_SID_TWILIO,<br>      to: &quot;+92XXXXXXXXXX&quot;, // whoever you&#39;re texting<br>    });<br>    res.status(200).json({ message: &quot;Text sent successfully&quot; });<br>  } catch (err) {<br>    res.status(500).json({ error: err.message });<br>  }<br>});<br><br>// Goal 2: Receive replies (this endpoint must match your Twilio webhook)<br>app.post(`${baseUrl}sms`, (req, res) =&gt; {<br>  const twiml = new MessagingResponse();<br>  console.log(&quot;INCOMING -----&gt;&quot;, req.body.Body);<br>  // Optional auto-reply:<br>  // const incoming = req.body.Body.trim().toLowerCase();<br>  // if (incoming === &quot;hi&quot;) {<br>  //   twiml.message(&quot;Hey there! How can I help?&quot;);<br>  // } else {<br>  //   twiml.message(&quot;Hmm, I didn&#39;t catch that.&quot;);<br>  // }<br>  res.writeHead(200, { &quot;Content-Type&quot;: &quot;text/xml&quot; });<br>  res.end(twiml.toString());<br>});<br><br>app.listen(port, hostname, () =&gt; {<br>  console.log(`Server running at http://${hostname}:${port}/`);<br>});</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=10b1a2cc0bc4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ship JavaScript Fixes in Minutes, Not Days: OTA Updates in React Native with Hot Updater]]></title>
            <link>https://medium.com/@mmaazy03/ship-javascript-fixes-in-minutes-not-days-ota-updates-in-react-native-with-hot-updater-31c801e22b74?source=rss-0ab702f669ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/31c801e22b74</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[ota-update]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[mobile-development]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[Maazy]]></dc:creator>
            <pubDate>Tue, 15 Sep 2026 15:26:40 GMT</pubDate>
            <atom:updated>2026-09-15T15:26:40.905Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A-2pl3FhvEuR1ge9Jodw6g.png" /></figure><p>If you’ve ever pushed a one-line fix to a React Native app and then waited two days for App Store review for a change that never touched a single line of native code. you already know the problem OTA solves.</p><p>This is a walkthrough of how I set up over-the-air updates in a production logistics app (a React Nativeapp on the New Architecture, RN 0.85), using <strong>hot-updater</strong> with a self-hosted Supabase backend. I’ll start with what OTA actually is, why I picked hot-updater over the alternatives, and then the full integration init, the update hook, the run command, and per-environment deploy scripts.</p><h3>1. What is OTA (Over-the-Air) Updating?</h3><p>A React Native app is really two things bundled into one binary:</p><ul><li><strong>Native code</strong> — the Android/iOS shell, native modules, permissions, anything under android/ and ios/.</li><li><strong>The JavaScript bundle</strong> — all your business logic, screens, components, most bug fixes and feature work.</li></ul><p>When you ship through the stores, both get frozen into an APK/IPA that a user installs. The catch: the vast majority of your day-to-day changes are <strong>pure JavaScript</strong>. A typo in a label, a broken API call, a tweak to a screen — none of that needs a new native binary, yet the traditional flow forces you through the full build-and-review cycle anyway.</p><p><strong>OTA updating breaks the JS bundle out of that cycle.</strong> Instead of embedding the JS forever, your app checks a server on launch, and if a newer JS bundle exists, it downloads and swaps it in — no store, no review, no reinstall. Users get the fix the next time they open the app.</p><p>The golden rule that governs everything below:</p><blockquote><strong><em>JS-only change → ship via OTA.</em></strong><em> </em><strong><em>Native change (new dependency, version bump, native module) → you still need a real store/pipeline build.</em></strong></blockquote><p>OTA is not a way around native builds. It’s a way to stop native builds from holding your JavaScript hostage.</p><h3>2. Why hot-updater?</h3><p>For years the default answer was Microsoft CodePush. That’s gone <strong>AppCenter/CodePush is deprecated</strong>, which sent everyone hunting for a replacement. Here’s how the current field looked when I evaluated it, and why I landed where I did.</p><ul><li><strong>CodePush / AppCenter</strong> — Deprecated. Non-starter.</li><li><strong>EAS Update</strong> — Solid, but pulls you into the Expo ecosystem. I’m on bare RN and didn’t want the coupling.</li><li><strong>Revopush / Codemagic CodePush</strong> — Good drop-in replacements, but <strong>paid</strong> services.</li><li><strong>Firebase Storage as a backend</strong> — Requires the paid Blaze plan.</li><li><strong>hot-updater</strong> — Free, open source, self-hosted, New Architecture support.</li></ul><p><a href="https://github.com/gronxb/hot-updater"><strong>hot-updater</strong></a> won for a few concrete reasons:</p><ul><li><strong>Free and open source</strong> — zero licensing cost, no per-MAU billing.</li><li><strong>New Architecture compatible</strong> — essential; I’m on RN 0.85 with the New Arch enabled.</li><li><strong>Backend is your choice</strong> — it’s plugin-based. You pick the storage/DB backend. I used <strong>Supabase</strong> (generous free tier, storage + Postgres + an edge function for the update server, all in one project).</li><li><strong>Web console + CLI</strong> — you’re not stuck in a CLI-only workflow.</li><li><strong>Instant rollback</strong> — a bad bundle is one toggle away from being pulled. No new deploy, no store review. More on this below.</li><li><strong>Staged rollouts &amp; cohorts</strong> — ship to 1% of devices first, watch, then ramp to 100% — or target a specific cohort like qa. More on this below.</li><li><strong>Actively maintained</strong> — not a weekend project that’ll rot in six months.</li></ul><p>The one thing to understand going in: <strong>“free” depends on the backend you choose.</strong> hot-updater itself is free; you’re responsible for where bundles live. Supabase’s free tier comfortably covers a small-to-mid app.</p><p><strong><em>The two features that matter most in production</em></strong></p><p>Getting an update <em>out</em> fast is only half the job. The other half is controlling the blast radius when something goes wrong — and this is where hot-updater’s console earns its keep.</p><p><strong>Instant rollback.</strong> Every bundle in the console has an <strong>Enabled</strong> toggle. Push a bundle that turns out to be broken? Flip it off. On their next check, devices that received it fall back to the last known-good bundle — no rebuild, no redeploy, no waiting on Apple or Google. There’s also a hot-updater rollback CLI command to revert the most recently deployed bundle. This is the single biggest reason OTA is safe to rely on: the escape hatch is instant.</p><h3>3. Integration &amp; Setup</h3><p>Here’s the actual integration path. Three pieces: install, initialize, and wire up the update flow.</p><p><strong>3.1 Install</strong></p><p>bash</p><pre>npm install @hot-updater/react-native<br>npm install -D @hot-updater/bare @hot-updater/supabase hot-updater</pre><p>Then provision the backend. hot-updater scaffolds Supabase for you:</p><pre>npx hot-updater init</pre><p>This creates the storage bucket, the database tables, and deploys the update-server edge function that your app will hit. It also drops a .env with the credentials — <strong>keep it gitignored</strong>, and remember you&#39;ll have to recreate it on fresh clones from your Supabase service-role keys.</p><p><strong>3.2 Initialize once, at the entry point</strong></p><p>HotUpdater.init() must run <strong>once at module scope in </strong><strong>index.js</strong>, before anything else uses it. This is what tells the library <em>where</em> to check for updates. Without it, every update check has no server URL and silently does nothing.</p><p>javascript</p><pre>// index.js<br>import { HotUpdater } from &#39;@hot-updater/react-native&#39;;<br>import Config from &#39;react-native-config&#39;;<br>import { analytics, AnalyticsEvent } from &#39;@services&#39;;</pre><pre>HotUpdater.init({<br>  baseURL: Config.HOT_UPDATER_SUPABASE_FUNCTION_URL, // your edge function URL<br>  updateStrategy: Config.HOT_UPDATER_UPDATE_STRATEGY, // e.g. &#39;appVersion&#39;<br>  onError: (error) =&gt; {<br>    // Bootstrap-level handler — keep it dependency-free.<br>    // Just enough to know init itself failed.<br>    if (__DEV__) console.log(&#39;🔥 [OTA] init error&#39;, error);<br>    analytics.track(AnalyticsEvent.OTA_INIT_ERROR, {<br>      message: String(error?.message ?? error),<br>    });<br>  },<br>});</pre><p>One subtle point worth internalizing: init decides <strong>where</strong> to check. A feature flag or your own logic decides <strong>whether</strong> to check. Keep those two concerns separate — it pays off later.</p><p><strong>3.3 The update flow: a silent hook instead of </strong><strong>wrap()</strong></p><p>The library ships a HotUpdater.wrap() HOC that handles everything automatically. That&#39;s the quickest way to get started, and if you just want &quot;check on launch, update, done,&quot; use it.</p><p>I wanted more control — silent background staging, a custom modal, throttling, and the ability to gate the whole thing behind a feature flag — so I drove it manually with a hook. Here’s the trimmed-down core:</p><pre>// useOtaUpdater.ts<br>import { useCallback, useEffect, useRef, useState } from &#39;react&#39;;<br>import { AppState, Modal } from &#39;react-native&#39;;<br>import { HotUpdater } from &#39;@hot-updater/react-native&#39;;<br><br>export const useOtaUpdater = () =&gt; {<br>  const otaModalRef = useRef&lt;Modal | null&gt;(null);<br>  const stagedRef = useRef(false);   // a bundle is downloaded &amp; waiting<br>  const busyRef = useRef(false);     // a check is in flight<br>  const [otaForced, setOtaForced] = useState(false);<br>  // 1. Check the server + stage the bundle in the background (no reload yet).<br>  const runSilentOtaCheck = useCallback(async () =&gt; {<br>    if (busyRef.current || stagedRef.current) return;<br>    busyRef.current = true;<br>    try {<br>      const updateInfo = await HotUpdater.checkForUpdate({<br>        updateStrategy: &#39;appVersion&#39;,<br>        requestTimeout: 20000, // default 5s is too tight for a cold edge function<br>      });<br>      if (!updateInfo) return; // null → up to date (or check failed)<br>      // Download &amp; stage to disk - does NOT reload the app.<br>      await updateInfo.updateBundle();<br>      stagedRef.current = true;<br>      setOtaForced(!!updateInfo.shouldForceUpdate);<br>      otaModalRef.current?.openModal(); // ask the user to apply it<br>    } finally {<br>      busyRef.current = false;<br>    }<br>  }, []);<br>  // 2. User tapped &quot;Update&quot; → swap the JS bundle and restart.<br>  const applyOtaUpdate = useCallback(async () =&gt; {<br>    await HotUpdater.reload(); // this is what actually applies the update<br>  }, []);<br>  // 3. Triggers: check on launch and whenever the app returns to foreground.<br>  useEffect(() =&gt; {<br>    const timer = setTimeout(runSilentOtaCheck, 3000); // backstop launch check<br>    const sub = AppState.addEventListener(&#39;change&#39;, (s) =&gt; {<br>      if (s === &#39;active&#39;) runSilentOtaCheck();<br>    });<br>    return () =&gt; {<br>      clearTimeout(timer);<br>      sub.remove();<br>    };<br>  }, [runSilentOtaCheck]);<br>  return { otaModalRef, otaForced, applyOtaUpdate };<br>};<br><br></pre><p>A few decisions baked in here that were learned the hard way:</p><ul><li><strong>requestTimeout: 20000.</strong> The library default is 5 seconds. A cold Supabase edge function routinely blows past that, the request times out, and checkForUpdate returns null — which looks identical to &quot;you&#39;re up to date.&quot; Bumping the timeout to 20s covers the cold start.</li><li><strong>Stage first, apply later.</strong> updateBundle() downloads the bundle silently to disk. reload() is the <em>only</em> call that actually swaps it in. Separating them means the user is never yanked mid-task — you download in the background, then prompt.</li><li><strong>A single entry point with guards.</strong> Every trigger (launch, foreground, reconnect) funnels through one function that self-gates on busyRef/stagedRef, so you never run two checks at once or re-download a bundle you already have.</li></ul><p>3.4 Wire it into your app</p><p>Mount the hook near the root and render a modal for the two update types — <strong>optional</strong> (dismissible) and <strong>forced</strong> (not):</p><pre>// App.tsx<br>const { otaModalRef, otaForced, applyOtaUpdate } = useOtaUpdater();<br><br>return (<br>  &lt;InfoModal<br>    modalRef={otaModalRef}<br>    subText={otaForced ? &#39;A required update is available.&#39; : &#39;An update is available.&#39;}<br>    onAcceptPress={applyOtaUpdate}<br>    showCancelButton={!otaForced}  // forced updates can&#39;t be dismissed<br>    dismissable={!otaForced}<br>  /&gt;<br>);</pre><h4>3.5 Native side (channels)</h4><p>The last piece is telling each build which <strong>channel</strong> it belongs to — development, stage, or production. This gets baked into the native binary so the update server knows which stream of bundles to serve. On Android that&#39;s a HOT_UPDATER_CHANNEL value per flavour in the manifest; on iOS, per target in Info.plist. Set it once per flavour and forget it.</p><blockquote><strong><em>Two gotchas that will bite you:</em></strong><em> OTA only works on </em><strong><em>release builds</em></strong><em>, not debug. And after </em>every<em> new native build, run a deploy once to register that build as the base bundle — otherwise the next deploy reports </em><em>Skipped (no compatible base bundles).</em></blockquote><h3>4. The Command to Ship an Update</h3><p>Once it’s wired up, shipping a JS change is a single command:</p><pre>npx hot-updater deploy -p android -t 3.0.0 -c development</pre><ul><li>-p — platform (android / ios)</li><li>-t — target app version the bundle is compatible with (your native versionName)</li><li>-c — channel</li><li>-f — (optional) force the update immediately</li></ul><p>That’s it. Push your JS, run the deploy, and the next time a driver opens the app on that channel, the update is waiting.</p><h3>5. Per-Environment Deploy Scripts</h3><p>Typing the full command for two platforms across three channels gets old fast, and it’s easy to fat-finger the wrong channel. So I wrapped it in a small script driven by env vars and exposed clean npm scripts.</p><p><strong>package.json:</strong></p><p>json</p><pre>{<br>  &quot;scripts&quot;: {<br>    &quot;ota:dev&quot;:   &quot;OTA_CHANNEL=development node scripts/ota-deploy.mjs&quot;,<br>    &quot;ota:stage&quot;: &quot;OTA_CHANNEL=stage       node scripts/ota-deploy.mjs&quot;,<br>    &quot;ota:prod&quot;:  &quot;OTA_CHANNEL=production  node scripts/ota-deploy.mjs&quot;,<br>    &quot;ota:dev:force&quot;:   &quot;OTA_CHANNEL=development OTA_FORCE=true node scripts/ota-deploy.mjs&quot;,<br>    &quot;ota:stage:force&quot;: &quot;OTA_CHANNEL=stage       OTA_FORCE=true node scripts/ota-deploy.mjs&quot;,<br>    &quot;ota:prod:force&quot;:  &quot;OTA_CHANNEL=production  OTA_FORCE=true node scripts/ota-deploy.mjs&quot;<br>  }<br>}</pre><p><strong>scripts/ota-deploy.mjs</strong> — reads the channel and force flag from the environment, pulls the target version from build.gradle automatically, and deploys both platforms in one go:</p><pre>import { execSync } from &#39;node:child_process&#39;;<br>import { readFileSync } from &#39;node:fs&#39;;<br>// Pull the native versionName straight from build.gradle so -t is never stale.<br>function getVersion() {<br>  if (process.env.OTA_VERSION) return process.env.OTA_VERSION;<br>  const gradle = readFileSync(&#39;./android/app/build.gradle&#39;, &#39;utf8&#39;);<br>  const match = gradle.match(/versionName\s+[&quot;&#39;]([^&quot;&#39;]+)[&quot;&#39;]/);<br>  if (!match) throw new Error(&#39;Could not find versionName in build.gradle&#39;);<br>  return match[1];<br>}<br>const version = getVersion();<br>const channel = process.env.OTA_CHANNEL ?? &#39;development&#39;;<br>const force = process.env.OTA_FORCE === &#39;true&#39; ? &#39;-f&#39; : &#39;&#39;;<br>for (const platform of [&#39;android&#39;, &#39;ios&#39;]) {<br>  const cmd = `npx hot-updater deploy -p ${platform} -t ${version} -c ${channel} ${force}`.trim();<br>  execSync(cmd, { stdio: &#39;inherit&#39; });<br>}</pre><p>Now the whole workflow collapses to:</p><p>bash</p><pre>npm run ota:dev     # ship to the dev channel, both platforms<br>npm run ota:prod    # ship to production<br>npm run ota:prod:force   # ship to production, force immediately</pre><p>Reading the version from Gradle instead of hardcoding it means you can never accidentally deploy against the wrong target version one less footgun in a release.</p><h3>6. Your Safety Net: Rollback &amp; Staged Rollouts</h3><p>Getting an update <em>out</em> fast is only half the job. The other half is controlling the blast radius when something goes wrong — and this is where hot-updater’s console earns its keep.</p><h3>Instant rollback</h3><p>Every bundle in the console has an <strong>Enabled</strong> toggle. Push a bundle that turns out to be broken? Flip it off. On their next check, devices that received it fall back to the last known-good bundle no rebuild, no redeploy, no waiting on Apple or Google. There’s also a hot-updater rollback CLI command to revert the most recently deployed bundle.</p><p>This is the single biggest reason OTA is safe to rely on: the escape hatch is instant.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uHa7OlY5tbt_UftLaaE77A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*XJN0zE1Je1yqf4G0OI5OdQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=31c801e22b74" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>