<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Ivan Napolitano</title>
    <description>The latest articles on Forem by Ivan Napolitano (@ivan91ncl).</description>
    <link>https://forem.com/ivan91ncl</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3675374%2Ff08be5f2-d7fc-4bfa-a473-4c7cd5dd9ae5.jpg</url>
      <title>Forem: Ivan Napolitano</title>
      <link>https://forem.com/ivan91ncl</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ivan91ncl"/>
    <language>en</language>
    <item>
      <title>Building a High-Performance SaaS for $0/mo with Java, Quarkus &amp; Cloud Run</title>
      <dc:creator>Ivan Napolitano</dc:creator>
      <pubDate>Tue, 23 Dec 2025 16:17:12 +0000</pubDate>
      <link>https://forem.com/ivan91ncl/building-a-high-performance-saas-for-0mo-with-java-quarkus-cloud-run-3m2b</link>
      <guid>https://forem.com/ivan91ncl/building-a-high-performance-saas-for-0mo-with-java-quarkus-cloud-run-3m2b</guid>
      <description>&lt;p&gt;Most developers think that running a &lt;strong&gt;Java&lt;/strong&gt; application in the cloud is expensive and heavy. They imagine huge JVMs eating up gigabytes of RAM and taking 10 seconds to start.&lt;/p&gt;

&lt;p&gt;I thought so too, until I discovered the power of &lt;strong&gt;Quarkus Native&lt;/strong&gt; combined with &lt;strong&gt;Google Cloud Run&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In this post, I’ll share how I built and deployed a production-ready &lt;strong&gt;Email Validation API&lt;/strong&gt; that handles syntax checks, MX record lookups, and disposable email detection—all running on a serverless infrastructure that costs me &lt;strong&gt;$0.00/month&lt;/strong&gt; to maintain.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem: Validating Emails is Tricky
&lt;/h2&gt;

&lt;p&gt;I needed a reliable way to validate user emails for a side project. I didn't just want a regex check; I needed to know:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Is the format valid?&lt;/li&gt;
&lt;li&gt;Does the domain actually exist (MX records)?&lt;/li&gt;
&lt;li&gt;Is it a disposable/burner email (like Mailinator)?&lt;/li&gt;
&lt;li&gt;Did the user make a typo (e.g., &lt;code&gt;gmal.com&lt;/code&gt;)?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Existing APIs were either too expensive ($20+/month for hobby tiers) or too slow. So, I decided to build my own "Micro-SaaS".&lt;/p&gt;

&lt;h2&gt;
  
  
  The Stack: Going Cloud Native
&lt;/h2&gt;

&lt;p&gt;To achieve high performance with zero idle costs, I chose this stack:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Language:&lt;/strong&gt; Java 21&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Framework:&lt;/strong&gt; &lt;a href="https://quarkus.io/" rel="noopener noreferrer"&gt;Quarkus&lt;/a&gt; (The "Supersonic Subatomic Java" framework)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compilation:&lt;/strong&gt; GraalVM Native Image&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hosting:&lt;/strong&gt; Google Cloud Run (Serverless Container)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monetization:&lt;/strong&gt; RapidAPI&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Secret Sauce: GraalVM Native Image
&lt;/h2&gt;

&lt;p&gt;The biggest enemy of Serverless Java is the &lt;strong&gt;Cold Start&lt;/strong&gt;. When a container wakes up after being idle, a traditional JVM takes seconds to load classes and initialize. In an API context, a 3-second latency is unacceptable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Enter Quarkus Native.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;By compiling the Java code ahead-of-time (AOT) into a native Linux executable, I achieved:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Startup time:&lt;/strong&gt; &amp;lt; 0.05 seconds (Instant)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Memory Footprint:&lt;/strong&gt; ~30MB (vs 200MB+ for a JVM)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Disk Size:&lt;/strong&gt; The final Docker image is tiny.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This allows the API to "scale to zero". When no one is using it, Google shuts it down (I pay nothing). When a request comes in, it wakes up instantly.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Challenges (and how I fixed them)
&lt;/h2&gt;

&lt;p&gt;It wasn't all smooth sailing. Here are two technical hurdles I faced:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. The Read-Only Filesystem
&lt;/h3&gt;

&lt;p&gt;Cloud Run containers are ephemeral and mostly read-only. My app was trying to cache disposable domain lists to disk.&lt;br&gt;
&lt;strong&gt;Solution:&lt;/strong&gt; I had to modify the code to use the system's temporary directory (&lt;code&gt;/tmp/&lt;/code&gt; on Linux), which is an in-memory writable layer on Cloud Run.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Configuration Injection
&lt;/h3&gt;

&lt;p&gt;Quarkus is smart—sometimes &lt;em&gt;too&lt;/em&gt; smart. It tries to bake configuration values into the binary at build time. When I tried to inject API keys via Environment Variables in the cloud, the app crashed because it expected the values from my local &lt;code&gt;application.properties&lt;/code&gt;.&lt;br&gt;
&lt;strong&gt;Solution:&lt;/strong&gt; I switched to dynamic config lookup using &lt;code&gt;ConfigProvider.getConfig().getValue(...)&lt;/code&gt; at runtime, bypassing the build-time optimization for sensitive keys.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Business Model: RapidAPI
&lt;/h2&gt;

&lt;p&gt;I didn't want to deal with Stripe, VAT handling, or building a frontend dashboard.&lt;br&gt;
I deployed the API behind &lt;strong&gt;RapidAPI&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;They handle:&lt;/strong&gt; Auth keys, rate limiting, billing, and customer support.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;I handle:&lt;/strong&gt; The code and the logic.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This setup allows me to focus purely on the backend.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Economics ($0 Cost)
&lt;/h2&gt;

&lt;p&gt;Google Cloud Run offers a generous free tier:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First 2 million requests/month: &lt;strong&gt;Free&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;First 360,000 GB-seconds of memory: &lt;strong&gt;Free&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Since my Native Image uses so little RAM and executes so fast (milliseconds), I can virtually serve thousands of users without paying a cent. Every dollar generated via RapidAPI is almost pure profit margin.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion &amp;amp; Demo
&lt;/h2&gt;

&lt;p&gt;Building a SaaS doesn't require a VC budget or massive servers. With modern tools like Quarkus and Cloud Run, Java is a top-tier contender for serverless development.&lt;/p&gt;

&lt;p&gt;I've just launched the API publicly. If you are building a registration form and want to block spam or fix user typos, feel free to give it a spin!&lt;/p&gt;

&lt;p&gt;🚀 &lt;strong&gt;Try the API here:&lt;/strong&gt; &lt;a href="https://rapidapi.com/ivannapolitanoit/api/deep-email-validator" rel="noopener noreferrer"&gt;&lt;strong&gt;Deep Email Validator on RapidAPI&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let me know in the comments if you have questions about the Quarkus Native build process!&lt;/p&gt;

</description>
      <category>java</category>
      <category>serverless</category>
      <category>cloud</category>
      <category>startup</category>
    </item>
  </channel>
</rss>
