How I Serve 10,000+ Dynamic Pages for Free with Next.js ISR (and the Mistakes I Made)

Published: (March 14, 2026 at 02:04 AM EDT)
3 min read
Source: Dev.to

Source: Dev.to

Result

secedgardata.com – a free dashboard that serves real‑time SEC data for every publicly‑traded US company.

SEC EDGAR Dashboard showing Alphabet Inc. revenue chart in dark mode

Financial statements table showing Alphabet Inc. income statement with multi‑year data

Search any ticker, see revenue charts, income statements, balance sheets, and SEC filing history. No login, no API key.

The problem: 10 000 pages that can’t be static

  • Backend: FastAPI on a home server (behind Tailscale).
  • Desired URLs: /stock/AAPL, /stock/MSFT, /stock/PLTR, …

Why the naive approach failed

IssueExplanation
Build timegenerateStaticParams would trigger 10 000+ API calls → minutes of build time.
Network accessVercel’s build servers run in AWS and cannot reach my home‑hosted backend → ECONNRESET on every deploy.

The fix: On‑demand ISR with no static params

// src/app/stock/[ticker]/page.tsx
export const revalidate = 86400; // 24 h
export const dynamicParams = true; // no generateStaticParams

When a user visits /stock/AAPL:

  1. Next.js calls the FastAPI backend and renders the page.
  2. The rendered page is cached at the edge for 24 h.
  3. Subsequent visitors receive the cached version instantly.
  • First visit: ~800 ms.
  • Cached visit:
({
  url: `https://secedgardata.com/stock/${t.ticker}`,
  changeFrequency: "weekly",
  priority: 0.8,
});

Submitted to Google Search Console – all 10 464 URLs were recognized on day 1.
Gotcha: Ensure the domain in the sitemap matches the Search Console property; a stale dev URL caused Google to reject the entire list.

The stack

LayerChoiceWhy
FrameworkNext.js 15 (App Router)ISR, Server Components
StylingTailwind + shadcn/uiFast to build, dark‑mode ready
ChartsRechartsLightweight, React‑native
BackendFastAPI (Python)Existing API, easy to extend
HostingVercel (free tier)ISR + edge caching
MonitoringSentry + Vercel AnalyticsError tracking + page‑view stats

Total hosting cost: $0 / month – the free Vercel tier handles everything thanks to ISR caching.

For developers – the same data as an API

pip install sec-edgar-sdk
from sec_edgar import SecEdgar

api = SecEdgar("YOUR_RAPIDAPI_KEY")

for year in api.revenue("AAPL", limit=5):
    print(f"FY{year['fiscal_year']}: ${year['value']:,.0f}")

The backend powering the dashboard is also exposed as a public REST API.

Additional resources

If you hit any bugs or have feature requests, let me know in the comments.

Happy hacking!

0 views
Back to Blog

Related posts

Read more »

Travigo

Travel as fast as you speak with Gemini! Where live agents meet immersive storytelling & 3D navigation. This project was created for entering the Gemini Live Ag...

Micro games

Hey Gamers! 👾 As part of the Rapid Games Prototyping module, we are tasked with reviewing a peer's game. The challenge is to analyse a prototype built in just...