Free — no signup required

Opportunity Cost in "Build vs. Buy

3 min read

The Road Not Taken

Opportunity cost is the value of the next best alternative that you gave up when you made a choice. It's not a line item on any invoice, but it's often the largest cost in any engineering decision.

Every engineering team has a finite number of hours. When you choose to spend those hours on Task A, you are implicitly choosing not to spend them on Task B, C, and D. The value of the best option you rejected is your opportunity cost.

The Scenario:

Your team wants to build a custom authentication system instead of using a managed service like Auth0 ($1,500/month). You estimate it will take 2 engineers 3 months.

Cost Type Build Custom Auth Buy Auth0
Direct Cost 2 engineers × 3 months × $17K/month fully loaded = $102,000 $1,500/month × 12 months = $18,000/year
Ongoing Maintenance ~$3,000/month (security patches, MFA updates, compliance) $0 (included)
Opportunity Cost Those 2 engineers could have built the "Referral Feature" projected to generate $500,000/year in new revenue Engineers are free to work on revenue-generating features
Time to Market 3 months before auth works; features delayed by 3 months Auth works in 1 week; features ship 3 months sooner

The Real Cost:

Building auth didn't just cost $102K in salary. It cost you the $500K in revenue you delayed. It cost you 3 months of competitive advantage. It cost you the morale of engineers who wanted to build product features but instead spent a quarter implementing OAuth2 flows and SAML integrations that Auth0 has already perfected.

The Build vs. Buy Decision Framework:

BUILD when:
  ✓ It's your core differentiator (Google builds its own search engine)
  ✓ No existing solution fits your constraints (regulatory, scale, latency)
  ✓ The opportunity cost is low (you genuinely have idle engineering capacity)
  ✓ You need deep control for competitive advantage

BUY when:
  ✓ It's commodity infrastructure (auth, payments, email, monitoring)
  ✓ Your engineers' time is better spent on product features
  ✓ A mature solution exists with good SLAs
  ✓ Speed to market matters more than customization

The framework is a starting point, not a formula. A startup with 4 engineers should almost never build commodity infrastructure. A company at Google's scale almost always should, because the customization requirements and cost savings at billions of requests per day justify the investment.

Key Point: The most dangerous phrase in engineering is "How hard could it be?" Engineers systematically underestimate the long-tail cost of building. The initial build is roughly 20% of the lifetime cost. The other 80% is security patches, edge cases, compliance updates, documentation, on-call, onboarding new team members, and the slow accumulation of technical debt in a system that is never anyone's primary focus. Before you build, ask: "Am I willing to own and maintain this for 5 years?" If the honest answer is no, buy.

This is one of 18 chapters

Every chapter is free — Kubernetes, Terraform, SRE, distributed systems, and more — with fast daily review built in.

Sign up free