How I Serve 10,000+ Dynamic Pages for Free with Next.js ISR (and the Mistakes I Made)
Source: Dev.to
Result
secedgardata.com – a free dashboard that serves real‑time SEC data for every publicly‑traded US company.


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
| Issue | Explanation |
|---|---|
| Build time | generateStaticParams would trigger 10 000+ API calls → minutes of build time. |
| Network access | Vercel’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 generateStaticParamsWhen a user visits /stock/AAPL:
- Next.js calls the FastAPI backend and renders the page.
- The rendered page is cached at the edge for 24 h.
- 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
| Layer | Choice | Why |
|---|---|---|
| Framework | Next.js 15 (App Router) | ISR, Server Components |
| Styling | Tailwind + shadcn/ui | Fast to build, dark‑mode ready |
| Charts | Recharts | Lightweight, React‑native |
| Backend | FastAPI (Python) | Existing API, easy to extend |
| Hosting | Vercel (free tier) | ISR + edge caching |
| Monitoring | Sentry + Vercel Analytics | Error 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-sdkfrom 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
- REST API on RapidAPI: sec-edgar-data-api — Free tier: 100 req/month
- Python SDK on PyPI: sec-edgar-sdk
- Source on GitHub: LiamAltie/sec-edgar-sdk
- Try the dashboard: secedgardata.com
If you hit any bugs or have feature requests, let me know in the comments.
Happy hacking!