惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog RSS Feed
L
LangChain Blog
博客园_首页
量子位
Stack Overflow Blog
Stack Overflow Blog
F
Fortinet All Blogs
S
Secure Thoughts
P
Privacy & Cybersecurity Law Blog
H
Help Net Security
T
Threatpost
N
Netflix TechBlog - Medium
Cyberwarzone
Cyberwarzone
P
Proofpoint News Feed
C
Cisco Blogs
G
Google Developers Blog
The GitHub Blog
The GitHub Blog
MyScale Blog
MyScale Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
I
InfoQ
Cisco Talos Blog
Cisco Talos Blog
A
Arctic Wolf
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
C
CERT Recently Published Vulnerability Notes
U
Unit 42
博客园 - 三生石上(FineUI控件)
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
CXSECURITY Database RSS Feed - CXSecurity.com
Security Latest
Security Latest
WordPress大学
WordPress大学
T
Tailwind CSS Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
D
Docker
C
Check Point Blog
TaoSecurity Blog
TaoSecurity Blog
Project Zero
Project Zero
www.infosecurity-magazine.com
www.infosecurity-magazine.com
SecWiki News
SecWiki News
F
Full Disclosure
S
Security @ Cisco Blogs
T
Tor Project blog
V
V2EX
Y
Y Combinator Blog
S
SegmentFault 最新的问题
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
GbyAI
GbyAI
B
Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
V
Visual Studio Blog
酷 壳 – CoolShell
酷 壳 – CoolShell

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
How We Built an AI SaaS on the Edge for Nearly $0 in Infrastructure Costs
Theo Oliveira · 2026-06-18 · via DEV Community

1. Introduction

A few months ago, we started building Propoza, a tool that generates business proposals with AI for Brazilian freelancers and small business owners.

The problem was practical: freelancers spend hours crafting proposals in Canva or Word, delivering generic documents that don't protect the project scope. The tool needed to be simple — the user describes the service, the AI structures a complete proposal with scope, timeline, and payment terms.

The technical challenge: how do you run a freemium SaaS for Brazilian freelancers without blowing your budget before you have revenue?

A lean SaaS or micro SaaS typically costs between $5 and $20 per month before your first paying customer — just for server, managed database, and CDN. For a validation-phase product, that's burned money.

We decided to try a different route: build everything on the edge, with serverless infrastructure and zero servers to manage. Here's what worked, the trade-offs, and what we learned.


2. The problem with the traditional SaaS stack

Before choosing our stack, we calculated the minimum cost of a Brazilian SaaS running on conventional infrastructure:

Component Typical Provider Estimated Monthly Cost
Server DigitalOcean / AWS EC2 $8–$30
Database Managed PostgreSQL (RDS, Supabase) $10–$40
CDN Cloudflare (paid plan) or similar $5–$20
Domain Namecheap / Porkbun ~$1/month
Total $10–$90/month

That's not unreasonable for an established SaaS. But for a product still validating its market fit with zero paying customers, it means burning $100–500 before you even know if the model works.

There's another Brazil-specific problem: latency. Servers concentrated in São Paulo and Rio de Janeiro leave users in the North and Northeast with poor experiences, especially on mobile connections. A CDN helps, but adds cost.

We needed something that:

  • Cost near $0 in the first few months
  • Offered low latency across all of Brazil
  • Scaled without manual intervention

That's when we looked at the edge serverless model.


3. The stack we chose (and why)

3.1 Cloudflare Workers as the edge runtime

The application's backbone is Cloudflare Workers — a serverless runtime that executes code across 330+ data centers worldwide, including points of presence in Brazil (São Paulo, Rio de Janeiro, Fortaleza).

  • Code runs in the data center closest to the user. For Brazilian users, latency stays under 50ms.
  • Workers keeps a warm runtime, unlike Lambda functions that freeze between executions. The first request is as fast as subsequent ones.
  • If the product goes viral and 10,000 people access it simultaneously, Workers distributes automatically.

The trade-off: Workers is not Node.js. There's no filesystem access, native WebSocket, or Node standard library. It's an isolated V8 runtime. Most things you need exist as native APIs (fetch, Web Crypto, streams), but libraries depending on fs or net won't work.

3.2 Hono as the HTTP framework

We needed an HTTP framework that ran inside Workers with zero overhead.

Most popular Node.js frameworks (Express, Fastify, Koa) were designed for full Node.js environments and have compatibility issues. They depend on the http module, use synchronous APIs, or carry middleware too heavy for the serverless model.

Hono sidesteps all that. It's under 14KB, runs natively on Workers, Deno, Bun, and Node.js, and is TypeScript-first with strong type inference. It supports middleware, route params, and Zod validation.

Here's a proposal generation route:

import { Hono } from 'hono'
import { z } from 'zod'
import { zValidator } from '@hono/zod-validator'

const app = new Hono()

const proposalSchema = z.object({
  clientName: z.string().min(1),
  projectDescription: z.string().min(10),
  deliverables: z.array(z.string()).min(1),
  deadline: z.string(),
  paymentMethod: z.string()
})

app.post('/api/proposals/generate', zValidator('json', proposalSchema), async (c) => {
  const data = c.req.valid('json')
  const result = await generateProposal(data)
  return c.json({ proposal: result })
})

export default app

Validation with Zod at the edge of the request, combined with Hono's inferred types, eliminates several runtime bugs without adding processing overhead.

3.3 Database on the edge

The database choice was the hardest decision. For an application that needs to persist proposals, users, and settings, the relational model is still the most natural fit.

We examined two options in the edge ecosystem:

  • D1 (Cloudflare): Distributed, managed SQLite. Queries go directly to the Worker's storage, no connection pools.
  • Turso: Distributed SQLite with per-region replication.

We went with D1 for its native integration with Workers. You define the schema locally, run migrations with wrangler d1 migrations apply, and queries run in the same data center as the Worker.

CREATE TABLE proposals (
  id TEXT PRIMARY KEY,
  user_id TEXT NOT NULL,
  client_name TEXT NOT NULL,
  content TEXT NOT NULL,
  status TEXT DEFAULT 'draft',
  created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
  updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE users (
  id TEXT PRIMARY KEY,
  email TEXT UNIQUE NOT NULL,
  name TEXT NOT NULL,
  proposals_count INTEGER DEFAULT 0,
  created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);

Issues we ran into:

  • D1 doesn't support all SQLite queries. ALTER TABLE with complex constraints, RETURNING, and some window functions aren't available. Always test with wrangler dev before deploying.
  • Write latency is higher than read latency. The free plan prioritizes eventual consistency — fine for business proposals.
  • Migrations work, but altering tables with lots of data requires planning.
  • Heavy write access sometimes needs distribution via queues or KV-backed caching.

3.4 Cloudflare AI Gateway

The most expensive part of an AI SaaS isn't infrastructure — it's the LLM API. Each call costs fractions of a penny, but hundreds of calls per day add up fast.

The AI Gateway acts as a proxy between the Worker and the LLM API:

  • Response caching: if two users generate proposals with similar context, the response comes from cache.
  • Per-user rate limiting: on the free plan, we limit to 5 proposals/month. The gateway applies this with zero extra code.
  • Observability: latency, tokens, and error rates are logged automatically.

The request flow:

Request -> Worker -> AI Gateway -> Cache hit? Return cached response
                                -> Cache miss? LLM API -> Cache the response -> Return

Caching cut about 40% of actual LLM calls in the first few weeks. Many users test with similar inputs.

3.5 Frontend: React + Vite + Cloudflare Pages

Frontend with React + Vite, hosted on Cloudflare Pages. The free tier covers 500 builds/month and unlimited bandwidth for static sites.

Communication with the API is via typed fetch, leveraging the fact that both Worker and frontend share the same TypeScript types:

// shared types
interface GenerateRequest {
  clientName: string
  projectDescription: string
  deliverables: string[]
  deadline: string
  paymentMethod: string
}

// client-side call
const response = await fetch('/api/proposals/generate', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify(request)
})

One detail that made a difference: PDFs are generated client-side, using libraries like @react-pdf/renderer or html2canvas + jspdf. The Worker never allocates memory or CPU for PDF rendering — the user's browser handles it.


4. The real cost

After a few weeks in production with dozens of active users:

Component Service Cost/Month
API / Backend Cloudflare Workers (Free Tier) $0
Database Cloudflare D1 (Free Tier) $0
Frontend / Hosting Cloudflare Pages (Free Tier) $0
AI (LLM) External API (cached via AI Gateway) ~$1–$4
Domain Namecheap / Porkbun ~$1/month
Total < $5/month

The only variable cost is the LLM. It scales with actual usage, not with registered users. If someone signs up but never generates a proposal, the cost is zero.

This isn't forever. When we scale to thousands of users, the Workers free tier will need an upgrade ($5+/month after 100k requests/day), and D1 may need a paid plan. But for PMF validation, it buys you months of experimentation.


5. What we learned

Five things we'd take to the next project:

1. Remote debugging on Workers is harder. Wrangler tail helps.

There's no SSH into a Worker. wrangler tail streams live production logs. Pair it with structured logging (JSON with requestId, userId, latency).

2. Secrets, vars, and bindings have nuances.

API keys go in secrets. Public config in vars. Resources like D1 or KV go in bindings (direct runtime references). Secrets aren't accessible via wrangler dev without a .dev.vars file.

3. D1 doesn't accept everything SQLite accepts.

A migration that worked locally broke on D1 because it used ALTER TABLE ... ADD COLUMN with constraints D1 rejects. Test every migration with wrangler d1 migrations apply --local.

4. AI Gateway saved us instrumentation work.

We didn't need to implement token logging, caching, or rate limiting manually. The gateway delivers everything through environment variables. Saved days of work.

5. Hono + Zod is a solid combo for secure edge APIs.

Validation at the request edge with auto-inferred types eliminates runtime errors without adding noticeable latency.


6. Conclusion

Building on the edge with Cloudflare Workers let us validate the product without the fixed costs of a traditional SaaS. The stack is lean, deployment is wrangler deploy, and the infra bill doesn't scare you.

Is this for every SaaS? No. If you need heavy computation, complex queues, or a database with all the features of PostgreSQL, the edge stack has limitations. But for validation in markets where every dollar counts, it works.

The tool we built is called Propoza — an AI-powered proposal generator for freelancers. It's free to use.

If you've used this stack or have a different approach to low-cost SaaS infrastructure, I'd love to hear about it in the comments. The goal here is to share experience, not to sell technology.