β‘ TL;DR: We moved Pocket Portfolio to Next.js 14 + Firebase v10 + Edge to make reliability (βnever 0.00β), fast cold starts, and simpler DX the default.
π§ Why rebuild?
We promised users that:
- Prices should never degrade to
0.00 - Profit/Loss should be explainable and reproducible
- Fallbacks should be visible, not silent
But our old MVP had:
- Serverful APIs with inconsistent latency
- Duplicated auth/session logic
- Hard-to-debug cold starts
So we rebuilt β on Next.js 14 Route Handlers, Edge Runtime, and Firebase v10 β to simplify, speed up, and scale out.
ποΈ New architecture (high-level)
-
Next.js 14 Route Handlers β
/apiendpoints - React Server Components (RSC) for dashboards (less JS over the wire)
- Edge runtime for quote + health endpoints β low p95 latency, regional caching
- Firebase v10 handles Auth, Firestore, Storage; Functions only where needed
Flow (in words):
Browser β Next.js Edge (Route Handlers) β Quote Providers (Yahoo, Chart, Stooq) β Health Store (Upstash Redis or in-memory) β Firestore (user data).
A CDN cache fronts Edge endpoints for instant fetches.
π What changed (numbers)
| Metric | Before | After (Edge) | Ξ |
|---|---|---|---|
| TTFB (dashboard) | β | β 31% | π |
| First quote p95 (EU) | ~650 ms | < 450 ms | β‘ |
| Cold start (health) | ~600 ms | near-zero | π |
π§© Code crumbs
- Edge endpoint:
export const runtime = 'edge';
export async function GET() { β¦ }
`
UI:
RSC for portfolio lists + a small client island for live updates.Health widget:
See Previous Week - (the βNever 0.00β pipeline).
π¦ Rollout guardrails
- Canary release via custom header flag
- Feature switch in the UI
- Smoke tests for Yahoo + Stooq reachability
- Observability: RAG badges π’π π΄ in UI +
/api/health-priceJSON endpoint
π Links
- π Web: pocketportfolio.app
- π» Repo: github.com/PocketPortfolio/Financialprofilenetwork
- π§ Docs: docs.pocketportfolio.app (coming soon)
π§‘ About Pocket Portfolio
Pocket Portfolio is an open-source fintech tracker that helps you make better investment decisions β together.
Built with Next.js 14, Firebase v10, and Edge, itβs designed to stay fast, transparent, and community-driven.
Follow the journey:
- π GitHub Org
- π¬ Discord
- π° Dev.to Series
Top comments (0)