How I Replaced a $20/Month Server with $1.50 in Serverless
I knew what to build. I didn’t need to be the one typing it.
The Problem
MarketCapy is a sarcastic capybara that roasts the financial markets. It’s a fun side project. It makes zero dollars. And it was running on a $20/month DigitalOcean droplet.
The droplet ran a Node.js backend that had accumulated features like barnacles on a ship: gRPC streaming, stock endpoints, portfolio simulators, DCA calculators. Most of it was dead code. The app had evolved into a digest-first experience. All it actually needed was three things:
- Generate a sarcastic market digest (via AI) on a schedule
- Send push notifications when a new digest drops
- Serve coin data when someone taps a
$TICKERmention
That’s it. Three things. Running on a server that was provisioned for twenty.
The Decision: Supabase Edge Functions + pg_cron
Once I realized the app was just “scheduled AI call + simple queries,” the architecture became obvious. Supabase gives you Edge Functions for HTTP endpoints, pg_cron for scheduling, and a PostgreSQL database. No server to maintain. No container to deploy. No SSH.
The new architecture is four Edge Functions:
- generate-digest — calls Perplexity’s
sonarmodel with a prompt that makes the AI behave like a sarcastic capybara, stores the result, fires push notifications via APNs - get-digest — returns the latest digest for a given language
- get-coin — proxies CoinGecko data with a 5-minute cache layer in the database
- register-push — stores device tokens for push notifications
Scheduling is handled entirely inside PostgreSQL. Five time slots, two languages each, plus cleanup jobs for old digests and stale cache. Twelve cron entries total, all defined in a single migration file.
What I Actually Did (vs. What the AI Did)
Here’s the honest breakdown.
My job was the thinking:
- Recognizing that the droplet was massive overkill for three features
- Choosing Supabase over other serverless options (I was already using it for auth)
- Deciding which features to kill and which to keep
- Designing the prompt contract between the AI-generated digest and the iOS parser
- Reviewing every diff before it shipped
Claude Code’s job was the implementation:
- Writing all four Edge Functions in TypeScript
- Setting up the pg_cron schedules and cleanup jobs
- Swapping the iOS networking layer to point at Supabase
- Ripping out hundreds of lines of dead code — the gRPC layer, stock endpoints, portfolio simulators, DCA calculators, an entire
GRPC/directory - Updating all imports and making sure nothing broke
I described the old architecture, pointed Claude Code at the existing codebase, told it what needed to stay and what needed to go, and reviewed the output. The whole migration took about 40 minutes.
The One Thing That Required Real Thinking
The iOS app parses each digest by splitting on ". " to separate the intro, body, and closing. First sentence becomes the intro card. Middle sentences become the body. Last sentence becomes the closing. Simple and fragile.
This meant the Perplexity prompt had to be treated as a contract, not a suggestion. If the AI uses line breaks, bullet points, or forgets trailing periods, the parser chokes. So the system prompt is extremely strict about format — continuous plain text, every sentence ending with a period and a space, no markdown, no citations.
Post-processing strips anything that slips through anyway.
The lesson: when your AI output feeds a deterministic parser, you need to think about the interface carefully. That’s architecture, not code. And it’s the part that still requires a human.
Cost Breakdown
| Component | DigitalOcean (before) | Supabase (after) |
|---|---|---|
| Server/hosting | $20/month (droplet) | $0 (free tier) |
| Database | included | $0 (free tier, <500MB) |
| Edge Functions | N/A | $0 (free tier, <500K invocations) |
| Perplexity API | ~$1.50/month | ~$1.50/month |
| Total | $20/month | ~$1.50/month |
92% reduction. The Perplexity calls are the only real cost, and those would exist regardless of infrastructure.
The Bigger Point
This post isn’t really about Supabase. It’s about what happens when you realize a better tool exists for your use case and you have AI agents to do the grunt work.
The old way: you discover a better architecture, weigh whether the migration effort is worth it, probably decide “it works fine, I’ll do it later,” and keep paying $20/month for years.
The new way: you make the decision, describe the migration, hand it to an agent, review the output, and ship. The cost of acting on a better idea dropped to nearly zero. So you just… act on it.
I didn’t write a single line of TypeScript or SQL for this migration. I didn’t need to. My job was knowing what to build and why. The implementation was delegation.
The capybara remains unimpressed.
Want to see the capybara in action? MarketCapy is currently in TestFlight — a sarcastic AI-powered daily market digest, delivered by a pixel-art capybara with zero chill. If you want early access, reach out.