Nextjs App Costs
Cost is an architecture signal. If your bill surprises you, your architecture surprised you first.
Every rendering strategy, data fetch, and image transformation has a price. Know the meter before you ship.
Cost Optimization
| Resource | What Costs Money | Optimization | Savings |
|---|---|---|---|
| Serverless functions | Invocation count + duration | Cache aggressively, reduce cold starts | 50-80% |
| Edge functions | Invocation count (cheaper per call) | Move auth/redirects to edge | 30-60% |
| Image optimization | Transformation count | Use sizes prop, limit formats | 40-70% |
| Bandwidth | Data transfer out | Static generation, CDN caching | 50-90% |
| Build minutes | Build time | Incremental builds, turborepo cache | 30-50% |
| ISR revalidation | Background regeneration calls | Longer revalidation windows | Case by case |
| Database (Vercel Postgres) | Rows read + storage | Connection pooling, query optimization | 20-50% |
Rendering Cost
| Strategy | Cost Profile | When |
|---|---|---|
| Static (SSG) | Build time only, zero runtime | Content that changes rarely |
| ISR | Build + periodic revalidation | Content that changes hourly/daily |
| SSR | Every request costs | Personalized, real-time data |
| Client-side | Zero server cost, user pays | Interactive features, dashboards |
| Edge SSR | Cheaper per request, global | Auth, A/B tests, geolocation |
Warning Signs
| Signal | What It Means |
|---|---|
| Bill doubles month over month | Likely a rendering strategy mistake |
| High function duration | Cold starts or slow database queries |
| Image optimization spike | Missing sizes prop or too many unique transforms |
| Bandwidth spike | Not caching static assets, or SSR where SSG works |
How do costs and benefits compare with Fleek?
Links
Context
- Performance — Performance optimization reduces cost directly
- App Router — Rendering strategy is the biggest cost lever
- Tech Stack — Platform choices set the cost floor
- Anti-patterns — Most cost problems are architecture problems
- Metrics — Track cost as a first-class metric
Questions
What rendering strategy minimizes cost for your traffic pattern?
- At what traffic level does self-hosting beat Vercel?
- How do you set cost alerts before the bill arrives?
- What is the true cost difference between edge and serverless functions at scale?