AboutExperienceSkillsWork
SK
GuestbookBlogResumeContact
HomeWorkExp.BlogGuests
Cover
BlogsBack to Blogs
January 1, 2026, 12:24 AMUpdated: Jan 1, 2026, 4:02 AM5 min read

Escaping the 503: How I Architected a Zero-Downtime Portfolio for $0

It was New Year's Eve, 2025. I was ready to relax, and wait for the countdown πŸŽ†. I opened my portfolio to check something, and there it was:

503 Service Unavailable

My backend, hosted on Render's free tier, had been suspended. I had hit the monthly uptime limits. My Resume, my Projects, my AI Chatbotβ€”all dead. πŸ’€

I had two choices:

  1. Pay $7/month: The easy, boring way.
  2. Over-engineer a solution for $0: The fun, educational way.

Obviously, I chose option 2. Thus began the journey to architect a Zero-Downtime, Multi-Cloud Failover System.


πŸ›‘ The Problem: Active Servers cost Money

I run a FastAPI (Python) backend. Unlike Node.js, Python apps traditionally run in containers (Docker).

  • Render: Great for containers, but the free tier spins down after 15 minutes of inactivity and has a monthly runtime cap.
  • Heroku: No longer free.
  • AWS/GCP: Complexity overload for a portfolio.

I needed a place to run Python that was Fast, Always On, and Free.

πŸ” Exploration: Finding a New Home

I explored several options:

1. Koyeb

Verdict: Good, but strict limits. Koyeb is a modern platform similar to Render. It offers a "forever free" tier, but it requires credit card verification (a friction point) and still runs as a container that consumes resources. It didn't feel significantly different from Render's constraints.

2. Fly.io

Verdict: Too complex for tonight. Fly.io is amazing, but managing persistent volumes and regions manually was more ops work than I wanted for a static portfolio backend.

3. Vercel (The Wildcard)

Verdict: The Winner via Serverless. πŸ† We usually think of Vercel for Next.js/Frontend. But Vercel supports Python Serverless Functions.

  • Pros: Infinite scaling (to a point), generous free tier, insanely fast cold starts compared to containers.
  • Cons: No persistent filesystem, no background tasks, 10-second timeout.

πŸ›  The Architecture: Active-Passive Failover

I realized I didn't have to choose one. I could use both.

Validating Vercel for Python

Migrating a standard FastAPI app to Vercel requires some tweaks. You can't just pip install.

  1. vercel.json: You need to tell Vercel to treat api/index.py (or main.py) as a serverless entry point.
  2. Secrets: My app uses firebase-admin sdk which needs a JSON key file. Vercel's file system is read-only.
    • Solution: Minify the JSON key into a single Environment Variable string and parse it in memory.

The "Circuit Breaker" Frontend

This is where the magic happens. I modified my frontend API client (api.ts) to be smart.

Instead of hardcoding one URL, I gave it two:

  • PRIMARY_URL: Vercel (Fast, Serverless)
  • BACKUP_URL: Render (Slow, Container)

I wrote a wrapper function fetchWithFailover:

typescript
async function fetchWithFailover(endpoint, options) { try { // Try Primary (Vercel) return await fetch(`${PRIMARY}/${endpoint}`, options); } catch (error) { console.warn("Primary failed, switching to Backup πŸ›‘οΈ"); // Fallback to Secondary (Render) return await fetch(`${BACKUP}/${endpoint}`, options); } }

Now, if Vercel ever hiccups (or I break it), the request seamlessly retries on Render. The user never sees an error.

πŸš€ The Result

I deployed the changes at 12:05 AM, Jan 1st, 2026.

  1. Primary Backend: Vercel. My API responses dropped from ~2s (Render cold start) to ~300ms.
  2. Backup Backend: Render. It sits there, sleeping, ready to wake up if Vercel fails.
  3. Cost: $0.00.

What about "Heavy" Tasks?

The only downside? Serverless functions can't run background threads (like my "Ingest Knowledge Base" task that parses PDFs).

  • Solution: Since I only update my resume once a month, I run the ingestion script locally or hit the Render endpoint explicitly for that one admin task. For everything else (reading blogs, projects), Serverless is king.

πŸ’‘ Key Takeaways

  • Don't rely on one cloud provider. The free tier allows you to diversify.
  • Serverless Python is underrated. For read-heavy REST APIs, it beats containers on cost and speed.
  • Smart Frontends save Backends. A customized fetch wrapper is better than a 503 error page.

Happy Coding, and Happy New Year! πŸŽ†

Topics
#System Design#FastAPI#Vercel#Serverless#DevOps#Cloud Architecture
Thanks for reading!
Share this post: