<?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 Sahansa Amarasinghe on Medium]]></title>
        <description><![CDATA[Stories by Sahansa Amarasinghe on Medium]]></description>
        <link>https://medium.com/@SahansaAmarasinghe?source=rss-347f3a7738de------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*kp0W3iYfIhQqNdN_</url>
            <title>Stories by Sahansa Amarasinghe on Medium</title>
            <link>https://medium.com/@SahansaAmarasinghe?source=rss-347f3a7738de------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 23:32:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@SahansaAmarasinghe/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[Stepping Beyond Application Development: What Working With Databases Taught Me as an Associate…]]></title>
            <link>https://medium.com/@SahansaAmarasinghe/stepping-beyond-application-development-what-working-with-databases-taught-me-as-an-associate-c96ff8ed348f?source=rss-347f3a7738de------2</link>
            <guid isPermaLink="false">https://medium.com/p/c96ff8ed348f</guid>
            <category><![CDATA[database-engineering]]></category>
            <category><![CDATA[database-administration]]></category>
            <category><![CDATA[database-design]]></category>
            <category><![CDATA[ai-in-data-engineering]]></category>
            <category><![CDATA[database-security]]></category>
            <dc:creator><![CDATA[Sahansa Amarasinghe]]></dc:creator>
            <pubDate>Sun, 27 Sep 2026 11:42:49 GMT</pubDate>
            <atom:updated>2026-09-27T11:45:55.850Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Stepping Beyond Application Development: What Working With Databases Taught Me as an Associate Software Engineer</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bion3OAk_EXhb3oYz3OxZg.png" /></figure><p>As an Associate Software Engineer, most of my work has traditionally been focused on application development, building features, APIs, frontend and backend systems, debugging issues, and writing code.</p><p>I used to think of a database simply as the place where an application stores its data. Recently, I had the opportunity to work much more closely with databases and see what happens beyond the application layer, from database design and administration to security, performance, migration, and maintenance.<br> <br>What started as an opportunity to work on another part of the system ended up changing the way I think about software engineering.</p><h4><strong>From Writing Code to Understanding Systems</strong></h4><p>With AI becoming increasingly capable of writing code, I started thinking more about what makes an engineer valuable beyond simply producing code.<br> <br>Today, AI can generate features, modify existing code, write SQL, create migration scripts, suggest indexes, explain errors, and try different implementation approaches in seconds. And I think this is only going to improve.</p><p>But working with databases made me realize that generating a change and understanding its impact are two very different things. Not every part of a system can be changed with the same level of freedom.<br> <br>With application code, we can often try an approach, test it, make changes, and try again. We can iterate relatively quickly.</p><p>A database doesn’t always give you that luxury. It often sits at the core of an application, and a seemingly small change can affect many layers around it.</p><p>That was one of the biggest things this experience taught me.</p><h4><strong>Why Database Design Requires Thinking Ahead</strong></h4><p>Database design isn’t simply about creating tables that satisfy today’s requirements.<br>- When designing a database, we also need to think about how the system might evolve.<br>- Will the design meet the client’s business requirements?<br>- Will it support sensitive data and auditing requirements?<br>- Can it accommodate future requirements without major restructuring?<br>- What happens when another application needs to consume the same data?<br>A decision that seems perfectly reasonable today can become difficult to change later when multiple parts of the system depend on it.</p><p>For example, changing a column or relationship may seem like a small database modification. But that change can affect APIs, stored procedures, reports, integrations, background jobs, or other applications.</p><p>The SQL itself may be simple.<br>The impact of the SQL may not be.<br> <br>This changed the way I think about database design. It isn’t only about making something work today; it is also about making decisions that leave room for the system to grow.</p><h4><strong>Database Administration Comes With a Different Kind of Responsibility</strong></h4><p>I also gained exposure to the administrative side of databases, permissions, users, roles, security, configuration, backups, migrations, and environment-specific changes.<br>This made me appreciate how much responsibility comes with managing a database.</p><p>A change that takes seconds to make can sometimes take days to understand, validate, and safely roll back.<br> <br>A small change can have a much larger impact than expected. A permission change could prevent an application from accessing the database. A configuration change could affect application behaviour. A schema change could break several dependent components.<br>In a production environment, one incorrect change could potentially prevent users from accessing an application altogether.<br> <br>There is also the security aspect.<br>A database is where an application’s data ultimately lives. That data can include personal information, business information, financial information, credentials, and other sensitive or confidential data. Working with databases therefore means working directly with information that needs to be protected.<br> <br>Permissions, access controls, encryption, configuration, and security practices aren’t simply technical settings. They determine who can access and potentially modify that information.<br> <br>This gave me a much greater appreciation for database security and why database changes need to be handled carefully.<br>It also showed me that database work requires communication. When making significant changes, developers, database administrators, project managers, and other stakeholders may need to understand the change, its impact, timing, validation, and rollback plan.</p><p>With application code, there is often room to experiment and iterate.<br>With a production database, “let’s try it and see what happens” isn’t always an option.</p><h4><strong>Where AI Fits Into This</strong></h4><p>This is where my thoughts about AI became even more interesting.<br> <br>It can already generate SQL, migrations, queries, indexes, and configuration changes. In the future, it will likely assist with much more of the database engineering process.<br>But database work highlights an important difference between generating a change and understanding its wider impact.</p><p>Imagine an application needs more database permissions. A quick fix could be:</p><pre>ALTER ROLE db_owner ADD MEMBER SomeUser;</pre><p>Problem solved… or is it?</p><p>Should that user really have db_owner?</p><p>Maybe it’s acceptable in Development. But would you want the same permission in UAT or Production? Perhaps the application only needs a much more limited permission.</p><p>The SQL is simple. Knowing what permission is appropriate, in which environment, and why, that’s where the real decision lies.</p><p>The same applies to performance. AI can also suggest an index that makes a slow query faster. Sounds like a win, right? But what happens to the rest of the database?</p><p>That index takes up storage. It can add overhead to INSERT, UPDATE, and DELETE operations. It might already be covered by another index, or it might help one query while making other operations more expensive.</p><p>So the recommendation might be technically correct, but is it the right change for this database?</p><p>A good change isn’t just one that solves the immediate problem. It’s one that makes sense for the system as a whole.</p><p>The same applies to migrations and schema changes.</p><p>A migration could mean moving data from one database server to another, moving a database to a new environment, or changing the structure of data that several applications depend on.</p><p>AI can help generate scripts and automate parts of the process, but there is much more to consider: what needs to be migrated, what depends on the data, how applications will connect afterward, how the migration will be validated, and what the rollback plan looks like if something goes wrong.</p><p>AI is already part of database administration and design, and its capabilities will continue to grow.<br>But I believe the harder part is replicating the level of human thinking required to understand context, anticipate consequences, and make decisions when a small change can have a significant impact.</p><p>AI may continue to evolve toward this level of reasoning, but I think it still has a long way to go. Until then, human review and engineering judgment remain especially important for changes that sit at the foundation of a system.</p><h4><strong>What This Experience Taught Me</strong></h4><p>As software engineers, our primary focus naturally tends to be the application layer. There are also specialized teams and roles responsible for areas such as infrastructure and database administration.<br>My experience gave me an opportunity to understand some of those areas more closely.<br> <br>I got exposure to areas such as:</p><ul><li>Database schema and design</li><li>Users, logins, roles, and permissions</li><li>Database security and vulnerability remediation</li><li>Query performance and indexing</li><li>Data migration</li><li>Backup and restoration</li><li>Database configuration</li><li>Environment-specific changes</li></ul><p>I realized that we don’t need to become database administrators to benefit from understanding databases.<br>Having a working knowledge of these areas helps us understand the systems around the code we write and the consequences of the decisions we make.<br> <br>The biggest lesson I took away is that being a good software engineer isn’t only about knowing how to write code.<br>We also need to understand:<br>The data.<br>The architecture.<br>The security.<br>The environments.<br>The dependencies.<br>And the consequences of our decisions.<br> <br>More importantly, this experience changed the way I look at software.<br>The application, database, infrastructure, security, and data are not isolated pieces. They are connected parts of the same system.<br>A developer doesn’t necessarily need to be an expert in every one of them.<br>But understanding how they connect can make us better engineers.</p><h4><strong>Final Thoughts</strong></h4><p>Working with databases changed the way I look at software engineering.</p><p>I started with the mindset of <em>“How do I implement this?”</em> and gradually learned to ask, <em>“Why are we doing this, what could it affect, and what happens next?”</em></p><p>That shift in thinking has probably been the biggest lesson for me.</p><p>As AI makes writing code and SQL easier, I believe this kind of thinking will become even more important. The value isn’t only in producing the change, but in understanding the problem, the system, and the consequences of making it.</p><p>A developer doesn’t need to know everything. But understanding how code, data, security, infrastructure, and business requirements connect can make a huge difference.</p><p>Because sometimes, <strong>the hardest part isn’t making a change. It’s knowing whether you should make it in the first place.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c96ff8ed348f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How We Built an Asynchronous Email Notification System Using Azure Queue Storage and Azure…]]></title>
            <link>https://medium.com/@SahansaAmarasinghe/how-we-built-an-asynchronous-email-notification-system-using-azure-queue-storage-and-azure-e92014630405?source=rss-347f3a7738de------2</link>
            <guid isPermaLink="false">https://medium.com/p/e92014630405</guid>
            <category><![CDATA[email]]></category>
            <category><![CDATA[queue]]></category>
            <category><![CDATA[azure-functions]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[dotnet]]></category>
            <dc:creator><![CDATA[Sahansa Amarasinghe]]></dc:creator>
            <pubDate>Wed, 04 Feb 2026 10:18:13 GMT</pubDate>
            <atom:updated>2026-02-04T10:18:13.960Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>How We Built an Asynchronous Email Notification System Using Azure Queue Storage and Azure Functions in .NET</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kEAw96NT6XWih7WSuSFY3w.png" /></figure><p>In almost every modern application, emails power critical workflows, account verifications, password resets, invoices, and many other notifications running quietly in the background. However, when these emails are sent synchronously within an API request, they can quickly become a performance bottleneck. A slow SMTP response, a temporary network issue, or throttling by the email provider can turn a simple user action into a frustrating wait, or even lead to request timeouts.</p><p>To overcome this, we re-architected our email flow and built an asynchronous email notification system using Azure Queue Storage and .NET, with an Azure Function App acting as the email processor. By adopting a clean producer–consumer pattern, we decoupled email delivery from the main request pipeline. This enables faster API responses, built-in retries, improved fault tolerance, and resilient email delivery through support for multiple providers with graceful fallback during provider failures, while scaling effortlessly as notification volume grows.</p><h4><strong>The Problem with Synchronous Email Sending</strong></h4><p>Initially, our API sent emails directly as part of the request flow:</p><ol><li>Client calls API</li><li>API prepares the email</li><li>API sends the email</li><li>API returns the response</li></ol><p>This approach introduced several issues:</p><ul><li>Users had to wait until the email was fully sent before receiving a response.</li><li>If the email service was slow or temporarily unavailable, the entire API became slow or unresponsive.</li><li>Failures in email delivery directly resulted in failed API requests.</li><li>Traffic spikes (for example, during marketing campaigns or OTP bursts) could overload the email service and cascade into API timeouts.</li></ul><p>We needed a better approach, one that would:</p><ul><li>Respond to users immediately, without waiting for email delivery.</li><li>Process emails reliably in the background.</li><li>Automatically retry transient failures.</li><li>Isolate email issues so they do not impact core application workflows.</li><li>Avoid dependency on a single email provider by supporting multiple providers with graceful fallback.</li></ul><h4><strong>Why Azure Queue Storage?</strong></h4><p>Azure Queue Storage is a lightweight, highly available message queue service that fits perfectly for background processing scenarios:</p><ul><li>Simple producer–consumer model</li><li>Built-in retry using visibility timeouts</li><li>High durability and availability</li><li>Seamless integration with .NET and Azure Functions</li><li>Cost-effective for high-volume workloads</li></ul><p>It allowed us to offload email processing from the API and handle it asynchronously without adding unnecessary architectural complexity.</p><h4><strong>High-Level Architecture</strong></h4><p>Our system consists of three main components:</p><ol><li><strong>API (Producer)</strong><br> Receives user requests and pushes email messages to a queue.</li><li><strong>Azure Queue Storage</strong><br> Temporarily stores email requests.</li><li><strong>Azure Function App (Consumer / Email Service)</strong><br> Triggered by queue messages and responsible for sending emails.</li></ol><p>Flow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*rLw_Nu_pW1YplGL8B0fIXw.png" /></figure><ul><li><strong>API</strong> acts as the producer.</li><li><strong>Azure Queue Storage</strong> acts as the buffer.</li><li><strong>Azure Function App</strong> acts as the consumer.</li><li><strong>Azure Communication Services (Email)</strong> handles delivery.</li></ul><p>This design ensures that the API remains fast and responsive, while email delivery happens independently in the background.</p><h4><strong>Designing the Queue Message</strong></h4><p>We defined a lightweight DTO that contains only what the email service needs:</p><pre>public class EmailQueueMessageDto<br>{<br>    public string Recipient { get; set; }<br>    public string Subject { get; set; }<br>    public string HTMLTemplate { get; set; }<br>}</pre><p>This keeps the queue payload clean, independent, and easy to evolve.</p><h4><strong>Implementing the Producer (API Layer)</strong></h4><p>Instead of sending emails directly, the API now pushes messages to Azure Queue Storage.</p><pre>public async Task EnqueueEmailAsync(EmailQueueMessageDto email)<br>{<br>  if (!_isEmailEnabled) return;<br>  <br>  var queueClient = new QueueClient(_storageConnectionString, _emailQueueName);<br>  await queueClient.CreateIfNotExistsAsync();<br>  <br>  var json = JsonSerializer.Serialize(email);<br>  string base64Json = Convert.ToBase64String(Encoding.UTF8.GetBytes(json));<br>  <br>  await queueClient.SendMessageAsync(<br>    base64Json,<br>    visibilityTimeout: TimeSpan.Zero,<br>    timeToLive: TimeSpan.FromMinutes(7)<br>  );<br>}</pre><p><strong>Key Design Decisions</strong></p><ul><li><strong>Feature Toggle</strong><br>Email sending can be enabled or disabled through configuration without redeploying the application. This allows quick control during incidents, testing, or maintenance.</li><li><strong>Base64 Encoding</strong><br>Azure Queue Storage expects messages to be Base64-encoded. While the modern Azure Queue SDK can handle this automatically, explicit encoding ensures safe and predictable handling of JSON and HTML email content.</li><li><strong>Time-to-Live (TTL)</strong><br>TTL defines how long a message is allowed to exist in the queue. If the message is not processed within this time, it is automatically discarded. The TTL value should be decided based on business rules, if not explicitly set, Azure Queue Storage uses a default value of <strong>7 days</strong>.</li><li><strong>Visibility timeout<br></strong>Visibility timeout controls how long a message is hidden after a function picks it up for processing. During this period, no other consumer can process the same message. If not specified, Azure Queue Storage applies a default visibility timeout of <strong>30 seconds</strong>.</li><li><strong>Observability</strong><br>Logs are written for enqueue operations and failures for traceability.</li></ul><p>The API now returns instantly while the email is processed asynchronously</p><h4><strong>Implementing the Consumer (Azure Function)</strong></h4><p>The email processor runs as an Azure Function App using a queue-triggered function. The Function App is created using standard Azure tooling and connected to Azure Queue Storage via application settings, keeping infrastructure setup separate from application logic.</p><p><strong>Configuration &amp; Environment Setup</strong></p><p>The Function App is configured using standard application settings for queue names, storage connections, and email provider credentials. All sensitive values are injected via environment variables, keeping the implementation secure, environment-agnostic, and easy to manage across local, staging, and production environments.</p><p>We use an Azure Function with a Queue Trigger:</p><pre>[Function(&quot;EmailProcessorFunction&quot;)]<br>public async Task RunAsync(<br>    [QueueTrigger(&quot;%EmailQueueName%&quot;, Connection = &quot;AzureWebJobsStorage&quot;)]<br>    string queueMessageJson)<br>{<br>    var dto = JsonSerializer.Deserialize&lt;EmailQueueMessageDto&gt;(queueMessageJson);<br>    await _emailSender.EmailSenderAsync(dto);<br>}</pre><p><strong>What Happens Here</strong></p><ol><li>The function is triggered automatically when a new message arrives.</li><li>The message is deserialized into EmailQueueMessageDto.</li><li>The email is sent via a dedicated email service.</li><li>On success → message is removed from the queue.</li><li>On failure → exception is thrown and Azure retries automatically.</li></ol><p><strong>Built-in Reliability</strong></p><p><strong>1. Visibility Timeout</strong><br>When a message is picked up by the Azure Function, it becomes temporarily invisible to other consumers. This is called the visibility timeout.<br>If the function completes successfully, the message is deleted. If the function crashes or times out, the message becomes visible again and is retried. This prevents duplicate processing while ensuring no message is lost.</p><p><strong>2. Automatic Retries</strong><br>If an exception is thrown while processing the email (for example, email provider downtime or network issues), Azure Functions automatically makes the message visible in the queue again. The same message is then retried based on the queue and function configuration, making the system resilient to transient failures.</p><p>Retries are influenced by several factors:</p><ul><li>maxDequeueCount -Defines how many times a message can be dequeued before it is considered a poison message.</li><li>Function host.json settings - Control retry behavior and queue processing options.</li><li>Queue visibility timeout - Determines how long a message stays invisible while a function execution is in progress.</li><li>Function execution timeout - Limits how long a single execution is allowed to run before failing.</li></ul><p>By default, a queue message is retried up to 5 times. If all retry attempts fail, the message is moved to the poison queue for further inspection.</p><p><strong>3. Poison Queue (Dead-Letter Handling)</strong><br>If a message fails repeatedly (for example, due to invalid email format or corrupted payload), it is moved to a poison queue.<br>This prevents a single bad message from blocking the entire pipeline and allows engineers to inspect and fix problematic messages without affecting the normal flow of emails.</p><h4><strong>Sending Emails with Azure Communication Services</strong></h4><p>The actual email delivery is handled by a dedicated service:</p><pre>public async Task EmailSenderAsync(EmailQueueMessageDto model)<br>{<br>    var emailClient = new EmailClient(_configuration[&quot;AzureEmailService&quot;]);<br><br>    await emailClient.SendAsync(<br>        WaitUntil.Completed,<br>        _configuration[&quot;AzureSenderEmail&quot;],<br>        model.Recipient,<br>        model.Subject,<br>        model.HTMLTemplate<br>    );<br>}</pre><p><strong>Email Provider Fallback Support</strong></p><p>Because email sending is handled asynchronously inside the Azure Function, the system can easily support multiple email providers with fallback logic.</p><p>If the primary email service is unavailable (timeouts, throttling, outages), the email processor can automatically retry the send using a secondary provider. If all providers fail, the message is retried by Azure Queue Storage and eventually moved to the poison queue if failures persist.</p><p>This approach ensures:</p><ul><li>No single email provider becomes a point of failure</li><li>Email delivery remains resilient during provider outages</li><li>Provider switching can be configuration-driven without API changes</li></ul><h4><strong>Error Handling &amp; Observability</strong></h4><p>We implemented:</p><ul><li>Structured logging in API, Function, and Email service</li><li>Blob-based audit logs for traceability</li><li>Automatic retries via Azure Queue semantics</li><li>Dead-letter (poison) queue for failed messages</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*7YeZmlMjnbeAgfjjpJSHuA.png" /></figure><h4><strong>Results</strong></h4><p>After moving to the queue-based asynchronous model:</p><ul><li>API latency dropped significantly.</li><li>Email failures no longer affected business flows.</li><li>Retry and recovery became automatic.</li><li>Monitoring and debugging improved.</li><li>The system became cloud-native and horizontally scalable.</li></ul><h4><strong>Conclusion</strong></h4><p>By combining Azure Queue Storage, Azure Functions, and Azure Communication Services, we built a robust, scalable, and fault-tolerant email notification pipeline using a clean producer–consumer architecture.</p><p>This pattern is not limited to email. The same idea can be used for many background tasks, such as:</p><ul><li>Report generation</li><li>File processing</li><li>Payment callbacks</li><li>Notifications</li><li>Event-driven microservices</li></ul><p>Queues are one of the simplest and most effective tools in distributed systems. When used with Azure’s serverless services, they help build systems that are easy to scale, easier to maintain, and more resilient to failures, often with very little added complexity.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e92014630405" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Maintenance Mode and the Power of Firebase Remote Config]]></title>
            <link>https://medium.com/@SahansaAmarasinghe/maintenance-mode-and-the-power-of-firebase-remote-config-42f593c6ca20?source=rss-347f3a7738de------2</link>
            <guid isPermaLink="false">https://medium.com/p/42f593c6ca20</guid>
            <dc:creator><![CDATA[Sahansa Amarasinghe]]></dc:creator>
            <pubDate>Sun, 21 Sep 2025 04:53:59 GMT</pubDate>
            <atom:updated>2025-09-21T04:58:32.645Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GXAXatuFBBnow2Ic" /></figure><p>Picture this: It’s midnight and your team is in the middle of a critical database migration. The backend is down for a few hours, but users don’t know that. They open your app, try to log in, and are greeted with spinning loaders, half-loaded pages, or worse random error codes.</p><p>Now imagine the alternative. Instead of confusion and frustration, users see a clear message:</p><blockquote>“We’re performing scheduled maintenance from 1AM–3AM IST. Please check back soon.”</blockquote><p>No angry tweets. Just transparency.</p><p>That’s the magic of <strong>maintenance mode, </strong>giving users clarity instead of chaos during planned (or even emergency) downtime.</p><p>But here’s the real challenge: you can’t push an app store update every time you need to toggle maintenance mode. That would be slow, messy, and impractical.</p><p>This is where <strong>Firebase Remote Config</strong> comes in. It acts like a remote control for your app, letting you turn maintenance mode on or off instantly, update messages in real time, and even show pre-maintenance warnings, all without publishing a new build.</p><p>And the best part? Maintenance mode is just one of many things Remote Config can do.</p><h4>Why Maintenance Mode is Needed</h4><p>Every app will eventually need downtime:</p><ul><li>Planned maintenance (database migrations, server upgrades).</li><li>API changes (deprecating old endpoints, introducing new flows).</li><li>Emergency fixes (patching bugs or vulnerabilities).</li></ul><p>Without proper maintenance handling, users end up facing:</p><ul><li>Blank screens.</li><li>Endless spinners.</li><li>Broken features.</li><li>Incorrect or failed outputs.</li></ul><p>The result? Frustrated users, negative reviews, and lost trust.</p><h4>What Maintenance Mode Looks Like</h4><p>A well designed maintenance mode doesn’t just block users abruptly. Instead, it provides layers of communication and fallback so the experience feels smooth.</p><p>Here are the common approaches:</p><ul><li><strong>Pre-maintenance notifications</strong><br> Show users a heads-up hours before downtime begins. <br>Example: <em>“Scheduled maintenance from 1AM–3AM IST. Some features may be unavailable.”</em></li><li><strong>In-app banners</strong><br>Lightweight, non-blocking messages displayed at the top of the app. Useful for early warnings or when maintenance has just started.</li><li><strong>Full-screen blocking screens</strong><br>During critical downtime, block the entire app with a clear, branded message. <br>Example: <em>“Maintenance in progress. We’ll be back shortly.”</em></li><li><strong>Grace periods for ongoing actions</strong><br>If a user is making a payment or submitting a form when maintenance kicks in, give them a few minutes to finish before blocking access. This avoids frustration and failed transactions.</li><li><strong>Consistent return experience</strong><br>Once maintenance ends, ensure users can seamlessly continue where they left off, rather than being forced to restart completely.</li></ul><p>The goal is simple: <strong>keep users informed, not confused</strong>. A clear banner or message is always better than unexplained errors.</p><h4>How Firebase Remote Config Helps</h4><p>Traditionally, handling maintenance mode meant adding flags in your backend or hardcoding logic inside the app. Both approaches have problems:</p><ul><li>Backend APIs add complexity and require extra infra.</li><li>Hardcoded flags mean you need to release a new app version just to update a message.</li></ul><p>Neither is flexible enough when you need to act fast.</p><p><strong>Firebase Remote Config</strong> changes that. It’s like a remote switchboard for your app:</p><ul><li><strong>Remote control without new builds</strong><br>Toggle maintenance on or off directly from the Firebase Console.</li><li><strong>Real-time updates</strong><br>Use fetch(0) in development or emergencies to bypass cache and instantly get the latest values.</li><li><strong>Custom messages</strong><br>Instead of generic “App under maintenance,” you can show precise, time-bound messages like <em>“We’ll be back by 3:00AM IST.”</em></li><li><strong>Targeting and segmentation</strong><br>Remote Config even lets you target maintenance messages to specific users, countries, or app versions if needed.</li></ul><h4>Setting Up Firebase Remote Config for Maintenance Mode</h4><h4>1. Enable Firebase Remote Config</h4><p>1.1 Go to Firebase Console</p><ul><li>Open the <a href="https://console.firebase.google.com/">Firebase Console</a>.</li><li>Create a new project (or use an existing one).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DAkUaRW1qTjNRq_dq8dDtg.png" /><figcaption>Project dashboard in Firebase Console</figcaption></figure><ul><li>Add your Android and iOS apps to the project.</li><li>Download the config files: <br>google-services.json → place inside android/app/.<br>GoogleService-Info.plist → add to your Xcode project in ios/.</li></ul><p>1.2 Open Remote Config</p><p>From the left sidebar, go to <strong>Build → Remote Config</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WsNTQJIU_yw1XkEt89ahFg.png" /><figcaption>Accessing Remote Config under the Build section</figcaption></figure><p>If it’s your first time, click <strong>Create Configuration</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t3W_QEvV29hpJwejAryR1A.png" /><figcaption>Initializing Remote Config for the first time</figcaption></figure><p>1.3 Add a New Parameter</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LaAXLrj4TsjyHS1gx1arow.png" /><figcaption>Entering key, default value, and description for a new parameter</figcaption></figure><ul><li>Click <strong>Add parameter</strong>.</li><li>Enter:<br><strong>Parameter key</strong> → e.g., maintenance_mode.<br><strong>Default value</strong> → e.g., &quot;false&quot;.</li></ul><p>1.4 (Optional) Add Conditional Values</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4O2wVLKjLLf5mRUYVetURw.png" /><figcaption>Defining conditional values for specific platforms, countries, or languages</figcaption></figure><ul><li>Under the parameter, click Add value for condition.</li><li>Choose a predefined condition (like App Version, Platform, User in Country, etc.) or create your own.</li><li>Set a value specific to that condition.</li></ul><p>1.5 Publish Changes</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cqc91haPA8zw0VsyK4YzBg.png" /><figcaption>Publishing the draft so values are live to client apps</figcaption></figure><ul><li>After adding all parameters, click <strong>Publish changes</strong>.</li><li>Remote Config will now store those values in the cloud.</li></ul><p>To have a fully functional maintenance mode, you can have these parameters in the Firebase Console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tg0gXDviXGhMALX-b89vig.png" /></figure><p>You can expand this list further, for example by adding end times, countdown durations, or custom messages per region depending on your needs.</p><h4>2. Install Dependencies</h4><p>In your React Native project, install the Firebase packages:</p><pre>npm install @react-native-firebase/app @react-native-firebase/remote-config</pre><h4>3. Configure ios &amp; android</h4><p>Android:</p><p>Open android/app/build.gradle and add:</p><pre>implementation &#39;com.google.firebase:firebase-config:16.1.3&#39;</pre><p>Make sure google-services.json is already added inside android/app/.</p><p>ios:</p><p>Finally, initialize Firebase in AppDelegate.swift:</p><pre>import FirebaseCore<br><br>FirebaseApp.configure()</pre><p>Make sure GoogleService-Info.plist is added to your Xcode project.</p><h4>Implementation Overview</h4><h4>What users see (3 states)</h4><ol><li><strong>Pre-maintenance</strong></li></ol><ul><li><strong>When</strong>: Up to 24 hours before maintenance.</li><li><strong>UI</strong>: A non-blocking toast/banner at the top.</li><li><strong>Behavior</strong>: Swipe/dismiss allowed. If the user quits and reopens the app, the banner shows again while pre-maintenance is active.</li><li><strong>Goal</strong>: Give advance notice without interrupting usage.</li></ul><p><strong>2. In-app maintenance (Grace Period)</strong></p><ul><li><strong>When</strong>: Maintenance is switched ON while the user is already inside the app.</li><li><strong>UI</strong>: A warning toast reappears periodically, plus a visible countdown (10 minutes by default).</li><li><strong>Behavior</strong>: The app stays usable during the countdown (you may choose to block high-risk actions).</li><li><strong>After countdown</strong>: The app transitions to full-screen maintenance (hard block).</li><li><strong>Goal</strong>: Let users finish critical actions safely before lockout.</li></ul><p><strong>3. Full maintenance block</strong></p><ul><li><strong>When</strong>:A user opens the app from outside during maintenance, or<br>The grace period ends, or<br>The user backgrounds → returns while maintenance is active.</li><li><strong>UI</strong>: Full-screen maintenance view with a clear message and optional return time.</li><li><strong>Behavior</strong>: App content and navigation are blocked (users can still receive phone calls if your app needs that).</li><li><strong>Goal</strong>: Prevent broken flows while backend/API/DB work happens.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5lu9ubY9mXolK0DZRm2rww.png" /><figcaption>Overview of app UI outcomes for each scenario.</figcaption></figure><h4>Implementation</h4><h4>1) Wrapper placement</h4><p>This is done in a wrapper that sits above your navigation and thus wraps all screens.</p><pre>// Root.js<br>import React from &quot;react&quot;;<br>import UpdateMaintenanceGuard from &quot;./guards/UpdateMaintenanceGuard&quot;; // the wrapper<br>import AppNavigator from &quot;./AppNavigator&quot;;<br><br>export default function Root() {<br>  return (<br>    &lt;UpdateMaintenanceGuard&gt;<br>      &lt;AppNavigator /&gt;<br>    &lt;/UpdateMaintenanceGuard&gt;<br>  );<br>}</pre><p>The wrapper reads Remote Config flags, shows banners or full-screen blocks, and handles the grace period.</p><h4>2) Imports &amp; Component Skeleton</h4><pre>import React, { useEffect, useState, useRef, useCallback } from &quot;react&quot;;<br>import { View, AppState } from &quot;react-native&quot;;<br>import { getApp } from &quot;@react-native-firebase/app&quot;;<br>import Toast from &quot;react-native-toast-message&quot;;<br>import MaintenanceFullScreen from &quot;../pages/MaintenanceFullScreen/MaintenanceFullScreen&quot;;</pre><p>This section brings in everything you need: React hooks, Firebase Remote Config APIs, and your UI components (Toast, MaintenanceFullScreen).</p><pre>import {<br>  getRemoteConfig,<br>  setConfigSettings,<br>  setDefaults,<br>  fetchAndActivate,<br>  getValue,<br>} from &quot;@react-native-firebase/remote-config&quot;;</pre><p>Firebase App &amp; Remote Config:</p><ul><li>getRemoteConfig – get the RC instance for the current app</li><li>setConfigSettings – set fetch behavior (e.g., cache interval)</li><li>setDefaults – safe fallback values when RC is unreachable</li><li>fetchAndActivate – fetch latest values and make them available to getValue</li><li>getValue – read parameters like maintenance_mode or messages</li></ul><pre>const UpdateMaintenanceGuard = ({ children }) =&gt; {<br>  // component body…<br>  return &lt;View style={{ flex: 1 }}&gt;{children}&lt;/View&gt;;<br>};<br><br>export default UpdateMaintenanceGuard;</pre><h4>3) State &amp; Refs (Pre-maintenance, Maintenance, Counters)</h4><pre>// inside UpdateMaintenanceGuard<br><br>// Pre-maintenance<br>const [preMaintenance, setPreMaintenance] = useState(false);<br>const [preMaintenanceMessage, setPreMessage] = useState(&quot;&quot;);<br><br>// Maintenance<br>const [isUnderMaintenance, setIsUnderMaintenance] = useState(false);<br>const [maintenanceMessage, setMaintMessage] = useState(&quot;&quot;);<br>const [countdownStarted, setCountdownStarted] = useState(false);<br>const [countdownExpired, setCountdownExpired] = useState(false);<br>const [remainingSeconds, setRemainingSeconds] = useState(0);<br><br>// Refs (don’t trigger re-renders)<br>const initialMaintenance = useRef(undefined);<br>const countdownTimer = useRef(null);<br>const countdownInterval = useRef(null);<br>const lastBucketRef = useRef(null);</pre><p>All state you render from, plus refs for data you don’t want to re-render on change.</p><p><strong>State</strong></p><ul><li>preMaintenance, preMaintenanceMessage – pre-maintenance banner control</li><li>isUnderMaintenance, maintenanceMessage – main maintenance toggle/messages</li><li>countdownStarted, countdownExpired, remainingSeconds – grace period handling</li></ul><p><strong>Refs</strong></p><ul><li>initialMaintenance – remembers if maintenance was already ON at app launch</li><li>countdownTimer / countdownInterval – control the 10-minute timer and per-second ticks</li><li>lastBucketRef – buckets time so the toast re-shows periodically (not every second)</li></ul><blockquote><em>Refs prevent unnecessary re-renders while still holding critical control data.</em></blockquote><h4>4) Constants &amp; helpers</h4><pre>// inside UpdateMaintenanceGuard<br><br>// Polling (development: 15s; produsction: 60–120s)<br>const POLL_TIME = 15;<br><br>// Grace period before hard block (seconds)<br>const MAINTENANCE_WARNING_TIME = 10 * 60; // 10 minutes<br><br>// Toast reappear cadence during grace<br>const TOAST_RERENDER = 15;<br><br>const clearAllCountdowns = useCallback(() =&gt; {<br>  if (countdownTimer.current) {<br>    clearTimeout(countdownTimer.current);<br>    countdownTimer.current = null;<br>  }<br>  if (countdownInterval.current) {<br>    clearInterval(countdownInterval.current);<br>    countdownInterval.current = null;<br>  }<br>}, []);</pre><ul><li>POLL_TIME – how often to fetch RC values (dev: 15s, prod: 60–120s recommended)</li><li>MAINTENANCE_WARNING_TIME – grace period duration (default 10 minutes)</li><li>TOAST_RERENDER – how often the maintenance toast should reappear during grace</li><li>clearAllCountdowns() – cleans timers to avoid leaks or double-timers</li></ul><h4>5) Resume Check (foreground re-entry)</h4><pre>// inside UpdateMaintenanceGuard<br><br>const resumeCheckAndForceBlock = useCallback(async () =&gt; {<br>  try {<br>    const config = getRemoteConfig(getApp());<br>    await fetchAndActivate(config);<br>    const nowMaintenance = getValue(config, &quot;maintenance_mode&quot;).asBoolean();<br><br>    if (nowMaintenance) {<br>      setIsUnderMaintenance(true);<br>      setCountdownStarted(false);<br>      setRemainingSeconds(0);<br>      clearAllCountdowns();<br>      setCountdownExpired(true); // go straight to full-screen<br>    }<br>  } catch (e) {<br>    console.warn(&quot;Resume maintenance check failed&quot;, e);<br>  }<br>}, [clearAllCountdowns]);<br><br>useEffect(() =&gt; {<br>  const sub = AppState.addEventListener(&quot;change&quot;, (state) =&gt; {<br>    if (state === &quot;active&quot;) {<br>      resumeCheckAndForceBlock();<br>    }<br>  });<br>  return () =&gt; sub.remove();<br>}, [resumeCheckAndForceBlock]);</pre><p>When the app comes back to the foreground (e.g., after a call), this forces a fresh fetch from Remote Config. If maintenance is ON, it skips grace and immediately shows the full-screen block, keeping behavior consistent.</p><h4>6) Initial Remote Config setup + polling loop</h4><pre>// inside UpdateMaintenanceGuard<br><br>useEffect(() =&gt; {<br>  const config = getRemoteConfig(getApp());<br>  let isMounted = true;<br><br>  const initialSetConfig = async () =&gt; {<br>    try {<br>      await setConfigSettings(config, {<br>        // dev: instant; prod: consider 3600*1000<br>        minimumFetchIntervalMillis: 0,<br>      });<br>      await setDefaults(config, {<br>        maintenance_mode: false,<br>        maintenance_message: &quot;&quot;,<br>        pre_maintenance: false,<br>        pre_maintenance_message: &quot;&quot;,<br>      });<br>    } catch (err) {<br>      console.warn(&quot;Config settings/defaults error&quot;, err);<br>    }<br>  };<br><br>  const checkConfig = async () =&gt; {<br>    if (!isMounted) return;<br>    try {<br>      await fetchAndActivate(config);<br><br>      const preMaint = getValue(config, &quot;pre_maintenance&quot;).asBoolean();<br>      const preMaintMsg = getValue(config, &quot;pre_maintenance_message&quot;).asString();<br><br>      const maintenance = getValue(config, &quot;maintenance_mode&quot;).asBoolean();<br>      const maintMsg = getValue(config, &quot;maintenance_message&quot;).asString();<br><br>      setPreMaintenance(preMaint);<br>      setPreMessage(preMaintMsg);<br><br>      // record startup state once<br>      if (initialMaintenance.current === undefined) {<br>        initialMaintenance.current = maintenance;<br>      }<br><br>      // sync maintenance state/message<br>      if (maintenance !== isUnderMaintenance) {<br>        setIsUnderMaintenance(maintenance);<br>        setMaintMessage(maintMsg);<br>      }<br><br>      // maintenance flipped ON while user is inside → start grace<br>      if (maintenance &amp;&amp; !initialMaintenance.current &amp;&amp; !countdownStarted &amp;&amp; !countdownExpired) {<br>        setMaintMessage(maintMsg);<br>        setCountdownStarted(true);<br>        setRemainingSeconds(MAINTENANCE_WARNING_TIME);<br><br>        // after grace → full-screen<br>        countdownTimer.current = setTimeout(() =&gt; {<br>          setCountdownExpired(true);<br>          setCountdownStarted(false);<br>          clearInterval(countdownInterval.current);<br>        }, MAINTENANCE_WARNING_TIME * 1000);<br><br>        // countdown tick<br>        countdownInterval.current = setInterval(() =&gt; {<br>          setRemainingSeconds((prev) =&gt; (prev &lt;= 1 ? 0 : prev - 1));<br>        }, 1000);<br>      }<br><br>      // maintenance ended → reset everything<br>      if (!maintenance) {<br>        initialMaintenance.current = false;<br>        setCountdownStarted(false);<br>        setCountdownExpired(false);<br>        setRemainingSeconds(0);<br>        clearAllCountdowns();<br>      }<br>    } catch (err) {<br>      console.warn(&quot;Polling fetch error&quot;, err);<br>    }<br>  };<br><br>  (async () =&gt; {<br>    await initialSetConfig();<br>    await checkConfig();<br>  })();<br><br>  const interval = setInterval(checkConfig, POLL_TIME * 1000);<br><br>  return () =&gt; {<br>    isMounted = false;<br>    clearInterval(interval);<br>    clearAllCountdowns();<br>  };<br>}, [clearAllCountdowns, countdownExpired, countdownStarted, isUnderMaintenance]);</pre><ul><li><strong>Setup defaults</strong> so if Firebase fails, the app assumes “no maintenance.”</li><li><strong>Fetch &amp; activate</strong> config values.</li><li><strong>Read keys</strong> (pre_maintenance, maintenance_mode, etc.) and update state accordingly.</li><li><strong>Grace logic</strong>: if maintenance flips ON while the app is running, start the countdown timer and show warnings before blocking.</li><li><strong>Polling</strong>: keeps checking Firebase every few seconds to pick up new flags.</li></ul><h4>7) UI State Derivation</h4><pre>// inside UpdateMaintenanceGuard<br><br>// full-screen if maintenance was ON at startup OR grace ended<br>const maintOutApp =<br>  isUnderMaintenance &amp;&amp; (initialMaintenance.current || countdownExpired);<br><br>// in-app grace window if maintenance flipped ON while inside<br>const maintInApp =<br>  isUnderMaintenance &amp;&amp; !maintOutApp &amp;&amp; countdownStarted &amp;&amp; !countdownExpired;</pre><p>Simplifies logic into two cases:</p><ul><li>maintOutApp: Maintenance ON at startup or grace expired → full block.</li><li>maintInApp: Maintenance started while inside, grace still active → toast countdown.</li></ul><p>This helps decide what to render.</p><h4>8) Toast helpers &amp; logic (pre-maintenance + grace)</h4><pre>// inside UpdateMaintenanceGuard<br><br>const showMaintenanceToast = useCallback(() =&gt; {<br>  Toast.show({<br>    type: &quot;warning&quot;,<br>    position: &quot;top&quot;,<br>    text1: &quot;Maintenance in progress&quot;,<br>    text2: &quot;Some actions are temporarily disabled.&quot;,<br>    autoHide: false,<br>    onPress: () =&gt; Toast.hide(),<br>  });<br>}, []);<br><br>useEffect(() =&gt; {<br>  const secs = Math.max(remainingSeconds, 0);<br><br>  // full-screen states → hide toast<br>  if (maintOutApp) {<br>    Toast.hide();<br>    lastBucketRef.current = null;<br>    return;<br>  }<br><br>  // in-app grace → periodic maintenance toast<br>  if (maintInApp) {<br>    const bucket = Math.ceil(secs / TOAST_RERENDER);<br>    if (lastBucketRef.current !== bucket) {<br>      lastBucketRef.current = bucket;<br>      showMaintenanceToast();<br>    }<br>    return;<br>  }<br><br>  // pre-maintenance banner toast<br>  if (preMaintenance) {<br>    lastBucketRef.current = null;<br>    Toast.show({<br>      type: &quot;info1&quot;,<br>      position: &quot;top&quot;,<br>      text1: &quot;Scheduled maintenance&quot;,<br>      text2:<br>        preMaintenanceMessage &amp;&amp; preMaintenanceMessage.trim().length &gt; 0<br>          ? `Planned between ${preMaintenanceMessage}. You may experience brief downtime.`<br>          : &quot;Planned within the next 24 hours. You may experience brief downtime.&quot;,<br>      autoHide: false,<br>      onPress: () =&gt; Toast.hide(),<br>    });<br>    return;<br>  }<br><br>  // default → hide<br>  Toast.hide();<br>}, [<br>  maintOutApp,<br>  maintInApp,<br>  preMaintenance,<br>  preMaintenanceMessage,<br>  remainingSeconds,<br>  showMaintenanceToast,<br>]);</pre><p>Controls user-facing banners:</p><ul><li><strong>In-app grace</strong> → periodic toast reminder every TOAST_RERENDER seconds.</li><li><strong>Pre-maintenance</strong> → toast warning of upcoming downtime.</li><li><strong>Maintenance full-screen</strong> → hides toasts to avoid overlap.</li></ul><p>This ensures users always get clear, context-appropriate messages.</p><h4>9) Final render (full-screen vs normal flow)</h4><pre>// inside UpdateMaintenanceGuard<br><br>if (maintOutApp) {<br>  return (<br>    &lt;MaintenanceFullScreen<br>      message={maintenanceMessage || &quot;We’ll be back soon.&quot;}<br>    /&gt;<br>  );<br>}<br><br>return &lt;View style={{ flex: 1 }}&gt;{children}&lt;/View&gt;;</pre><p>The actual UI output:</p><ul><li>If maintOutApp → show MaintenanceFullScreen.</li><li>Else → render children (your normal app).</li></ul><p>This makes the wrapper the single gatekeeper for maintenance.</p><h4>Notifications: Toasts vs Banners</h4><p>When showing maintenance notices, you can use either toasts (floating overlays) or banners (sticky bars at the top). Both approaches work; the choice depends on your app’s UX style.</p><ul><li><strong>Banners</strong> stay visible until dismissed. They’re good for persistent reminders (e.g., scheduled downtime).</li><li><strong>Toasts</strong> pop up temporarily and can reappear at intervals (e.g., every 15 seconds during in-app maintenance). They’re less intrusive but still effective.</li></ul><h4>10) Toast implementation</h4><p>In this implementation, I used <strong>toasts</strong> powered by the <a href="https://github.com/calintamas/react-native-toast-message">react-native-toast-message</a>library.</p><p>In your package.json, add:</p><pre>&quot;react-native-toast-message&quot;: &quot;^2.1.6&quot;</pre><p><strong>Toast Configuration</strong></p><p>I created a <strong>toast.js</strong> config file to define custom toast styles.</p><pre>// toast.js<br>import React from &quot;react&quot;;<br>import { StyleSheet } from &quot;react-native&quot;;<br>import { BaseToast, ErrorToast } from &quot;react-native-toast-message&quot;;<br><br>const toastConfig = {<br>  info1: (props) =&gt; (<br>    &lt;BaseToast<br>      {...props}<br>      style={styles.base}<br>      text1Style={[styles.title, { color: &quot;#555&quot; }]}<br>      text2Style={styles.subtitle}<br>      text1NumberOfLines={4}<br>      text2NumberOfLines={4}<br>    /&gt;<br>  ),<br><br>  warning: (props) =&gt; (<br>    &lt;ErrorToast<br>      {...props}<br>      style={styles.errorBase}<br>      text1Style={[styles.title, { color: &quot;#d82016&quot; }]}<br>      text2Style={[styles.subtitle, { color: &quot;#707070&quot; }]}<br>      text1NumberOfLines={4}<br>      text2NumberOfLines={4}<br>    /&gt;<br>  ),<br>};<br><br>const styles = StyleSheet.create({<br>  base: {<br>    marginLeft: 20,<br>    marginRight: 20,<br>    width: &quot;98%&quot;,<br>    height: 100,<br>    borderLeftWidth: 6,<br>    borderLeftColor: &quot;#0561cd&quot;,<br>    borderRadius: 10,<br>    paddingBottom: 5,<br>    marginTop: 65,<br>    backgroundColor: &quot;#ffffff&quot;,<br>    elevation: 20,<br>    shadowColor: &quot;#000&quot;,<br>    shadowOffset: { width: 0, height: 6 },<br>    shadowOpacity: 0.15,<br>    shadowRadius: 12,<br>  },<br><br>  errorBase: {<br>    marginLeft: 20,<br>    marginRight: 20,<br>    width: &quot;98%&quot;,<br>    height: 100,<br>    borderLeftWidth: 6,<br>    borderLeftColor: &quot;#d82016&quot;,<br>    borderRadius: 10,<br>    paddingBottom: 5,<br>    marginTop: 65,<br>    backgroundColor: &quot;#ffffff&quot;,<br>    elevation: 20,<br>    shadowColor: &quot;#000&quot;,<br>    shadowOffset: { width: 0, height: 6 },<br>    shadowOpacity: 0.15,<br>    shadowRadius: 12,<br>  },<br><br>  title: {<br>    fontSize: 16,<br>    fontWeight: &quot;700&quot;,<br>    lineHeight: 30,<br>    flexShrink: 1,<br>  },<br>  subtitle: {<br>    fontSize: 14,<br>    color: &quot;#555&quot;,<br>    lineHeight: 20,<br>  },<br>});<br><br>export default toastConfig;</pre><p><strong>App Entry Setup</strong></p><p>In your main App.js (or wherever you mount the app), include Toast and your config:</p><pre>import React from &quot;react&quot;;<br>import { NavigationContainer } from &quot;@react-navigation/native&quot;;<br>import Toast from &quot;react-native-toast-message&quot;;<br>import toastConfig from &quot;./toast&quot;;<br><br>import Root from &quot;./Root&quot;;<br><br>export default function App() {<br>  return (<br>    &lt;NavigationContainer&gt;<br>      &lt;Root /&gt;<br>      &lt;Toast config={toastConfig} /&gt;<br>    &lt;/NavigationContainer&gt;<br>  );<br>}</pre><p>If a user is inside the application when maintenance mode is toggled on, you need to be mindful of how it could affect critical flows like calls, payments, or data submissions. In my implementation, a banner is shown immediately to let users know maintenance has started, followed by a 10-minute grace period so they can wrap up ongoing actions. After this, they are hard-blocked with a full-screen maintenance screen. If the user leaves the app and comes back during that grace period, the full block is applied straight away. This approach fit my app’s structure and architecture well, balancing transparency with safety. That said, the wrapper is highly flexible — you could freeze only risky APIs (such as payments, writes, or uploads), run controlled experiments by toggling different behaviors for different users, conditionally apply values based on context (e.g., region, version, or platform), or even customize messages to match your brand voice. Whether you choose banners, toasts, or modals, the key is that you can decide the exact logic and experience that best suits your application.</p><h4>Other Use Cases for Remote Config</h4><p>Maintenance mode is just the beginning. Remote Config can unlock many powerful scenarios:</p><ul><li><strong>Feature Flags</strong> → Gradually roll out new features by enabling them for a subset of users first. If something goes wrong, flip the switch off instantly.</li><li><strong>A/B Testing</strong> → Compare different onboarding flows, button placements, or layouts, and see which version drives better engagement before committing.</li><li><strong>UI Theming</strong> → Dynamically change app colors, banners, or text for events like holidays, campaigns, or promotions without pushing updates.</li><li><strong>Targeted Experiments</strong> → Release a feature to only 10% of users or in a specific region, test performance, and scale up with confidence.</li><li><strong>Emergency Messaging</strong> → Push urgent notifications (like “Service outage in progress”) across all users without needing a separate messaging system.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I8Q3BSdTPy0sSzgFcQApOQ.png" /><figcaption>Condition applied to iOS users in the Sri Lanka region</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BV5dUo2wD9Ul_4DV23eo7w.png" /><figcaption>Condition applied to Android users in Sri Lanka with app language set to English</figcaption></figure><p>And the best part: all of this happens without resubmitting to the App Store or Play Store, saving you time and keeping your release pipeline flexible.</p><h4>Why Remote Config is a Good Fit</h4><ul><li><strong>Cross-Platform</strong> → Works seamlessly across Android and iOS.</li><li><strong>No Extra Infrastructure</strong> → No need to build or maintain your own flagging/feature toggle backend.</li><li><strong>Scalable &amp; Secure</strong> → Backed by Firebase and Google Cloud, built to handle millions of active users.</li><li><strong>Cost-Effective</strong> → Generous free quotas make it ideal for startups, indie devs, and small teams.</li><li><strong>Dynamic Messaging</strong> → Customize maintenance messages, update prompts, or feature announcements in real time without shipping a new build.</li><li><strong>Real-Time Control</strong> → With fetchAndActivate(0), you can push changes instantly, ensuring critical updates reach users immediately.</li></ul><p>Think of it as having a remote control for your app, letting you dynamically manage features, downtime, and experiments with zero hassle.</p><h4>Conclusion</h4><p>Downtime is inevitable , but user frustration isn’t. By using Firebase Remote Config to power maintenance mode, you:</p><ul><li>Keep users informed and calm during downtime.</li><li>Allow critical actions to finish safely before hard blocks.</li><li>Prevent broken flows and negative reviews.</li></ul><p>And beyond downtime, Remote Config opens the door to smarter app management , from experiments to feature rollouts to UI changes on the fly.</p><p>It’s not just a quick fix for emergencies, it’s a strategic tool for building more resilient, adaptive, and user-friendly apps.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42f593c6ca20" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>