A Next.js (App Router) application for screening US equities and options with live market data, modern UI (shadcn/ui + Tailwind), and both Novice and Advanced dashboards.
- Live stocks data (prices, volume, OHLC) via Polygon.io
- Indices (S&P 500, Dow 30, Nasdaq, VIX) via FMP (Financial Modeling Prep)
- One-Click Screeners (Trending, Value, Growth, Volume) with volume and market cap
- Quick Search with enriched market cap
- Optional features: Portfolio overview, Active screeners, Live alerts
- Framework: Next.js 14 (App Router, SSR)
- Language: TypeScript / React 18
- UI: TailwindCSS, shadcn/ui
- Data:
- Polygon.io (Stocks: snapshots, aggregates, indicators)
- FMP (Indices: ^GSPC, ^DJI, ^IXIC, ^VIX)
- Auth: NextAuth (configured, optional)
- DB: Prisma + (optional) Postgres (e.g., Supabase) — not strictly required to run core features
Create a .env.local (for local) or set these in your deployment environment:
Required
NEXTAUTH_SECRET— random string (required if NextAuth used)POLYGON_API_KEY— Polygon API keyFMP_API_KEY— Financial Modeling Prep API key
Optional / As needed
DATABASE_URL— Postgres connection string (Prisma). Only required if you use the DB-backed features.
Recommended (Prod)
NEXTAUTH_URL— your site base URL in production (e.g.,https://your-domain.com)
Note:
- We recommend NOT committing real
.envto source control. Instead, commit a.env.examplewith placeholders, keep.envignored, and manage secrets in your platform (Vercel/Render) env settings.
Prerequisites
- Node.js 18+
- Yarn v1 (classic) or npm
- Polygon.io API key
- FMP API key
Setup
# Install dependencies yarn # Create local env file cp .env .env.local # or create .env.local manually # Fill POLYGON_API_KEY, FMP_API_KEY, NEXTAUTH_SECRET (and DATABASE_URL if needed)Run
yarn dev # open http://localhost:3000Build & start
yarn build yarn startScripts
yarn dev— start devyarn build— production buildyarn start— run production serveryarn lint— (optional) lint
- Stocks (prices/volume/aggregates): Polygon.io
- Indices (S&P 500, Dow 30, Nasdaq, VIX): FMP (due to Polygon plan limitations for indices)
- Screeners & Quick Search: Use Polygon for stocks; market cap enriched via Polygon
/v3/reference/tickers/{ticker}, with fallback computed asweighted_shares_outstanding * pricewhenmarket_capis unavailable.
Make sure both POLYGON_API_KEY and FMP_API_KEY are present.
Vercel auto-detects Next.js and optimizes SSR.
- Fork or connect the repo to Vercel
- Import GitHub repository in Vercel dashboard
- Configure Environment Variables (Project Settings → Environment Variables)
NEXTAUTH_SECRET(required if using NextAuth)NEXTAUTH_URL(e.g.,https://your-vercel-domain.vercel.app) — set for ProductionPOLYGON_API_KEYFMP_API_KEYDATABASE_URL(only if using DB features)- Optional: Create separate variables per environment (Development, Preview, Production)
- Build & Output
- No changes required; Vercel detects Next.js.
- (Advanced) If needed, set Node.js version and region.
- Deploy
- Trigger a deployment by pushing to the default branch (master).
- Post-deploy Checks
- Visit
/dashboard - Confirm Market Overview tiles show S&P 500, Dow 30, Nasdaq, VIX values (FMP)
- Run Quick Search (e.g., AAPL) and verify Market Cap & Volume render
- Verify Screeners return populated Volume and Market Cap
Vercel CLI (optional)
npm i -g vercel vercel login vercel link vercel env pull .env.local vercel # deploy preview vercel --prod # deploy productionRender runs the Next.js server as a Node process (SSR).
- Create a New Web Service
- From Dashboard, “New +” → “Web Service”
- Connect your GitHub repo
- Select branch:
master
- Configure
- Environment:
Node - Build Command:
yarn install && yarn build - Start Command:
yarn start - Node Version: ensure 18+ (use Render’s default or specify in Environment tabs if needed)
- Auto-Deploy: Enable if desired
- Environment Variables (Settings → Environment)
- Add:
NEXTAUTH_SECRETNEXTAUTH_URL(e.g.,https://your-render-service.onrender.com)POLYGON_API_KEYFMP_API_KEYDATABASE_URL(optional)
- Save and redeploy
- Health Check
- Path:
/ - Render should detect Next.js server and show healthy after build
- Post-deploy Checks
- As above (indices tiles, Quick Search Market Cap, Screeners)
Notes:
- Render uses a persistent server process. Ensure the Start Command matches
yarn start. - If using “free” instance types, expect cold starts.
Missing Market Cap in results
- Verify
POLYGON_API_KEYis set and valid - The API call
/v3/reference/tickers/{ticker}must be permitted for your Polygon plan - Fallback computation uses
weighted_shares_outstanding * pricewhen Polygon omitsmarket_cap
VIX or Index tiles empty
- Indices use FMP
^VIX,^GSPC,^DJI,^IXIC - Verify
FMP_API_KEYis set and valid - Check provider status/rate limits
NEXTAUTH warning in dev
- Set
NEXTAUTH_URL=http://localhost:3000(dev) and your production URL (prod) - Ensure
NEXTAUTH_SECRETis a random strong string
.env in Source Control shows as modified
- Keep
.envignored and use platform env variables - To hide local changes from Git (without committing):
git update-index --skip-worktree .env - Or stop tracking
.enventirely and commit.env.examplewith placeholders
Build failures on Render/Vercel
- Ensure Node 18+ and correct build/start commands
- Remove stale build artifacts: delete
.nextlocally, rebuild, re-push
app/ api/ indices/[symbol]/route.ts # FMP indices endpoint (I:GSPC, I:DJI, I:IXIC, I:VIX) screeners/route.ts # Screeners via Polygon market snapshot + market cap enrichment market-status/route.ts # Market status via Polygon stocks/[symbol]/route.ts # Stocks snapshot + aggregates; quick search enrichment components/ novice-dashboard.tsx # Market Overview (tiles), Quick Search, One-Click Screeners advanced-dashboard.tsx # Pro UI, ChartWidget, Portfolio, Alerts, etc. stock-table.tsx # Results table (volume + formatted market cap) lib/ polygon.ts # Polygon client (snapshots, aggregates, reference overview) fmp.ts # FMP client (indices quotes) - Do not commit secrets (.env) to the repository
- Rotate exposed keys if
.envwas ever committed previously - Use Vercel/Render environment variable management for production
Proprietary. All rights reserved.