Stock Option Profit Calculator — Next.js 16.1 / App Router / Netlify.
For most development (no Netlify Blobs needed):
pnpm devImportant: Local development that requires Netlify Blobs (token storage for Schwab OAuth) must use the Netlify CLI instead:
pnpm dev:netlifyThis starts netlify dev, which provides the Netlify Blobs runtime locally. Use this whenever you need the Schwab OAuth flow or quote fetching to work end-to-end.
On first deploy to Netlify:
- Visit
/api/auth/schwab/loginin your browser. - You will be redirected to Schwab's authorization page — log in and approve access.
- Schwab redirects back to
/api/auth/schwab/callback, which exchanges the code for tokens and stores them in Netlify Blobs. - All subsequent token refreshes are handled automatically by the server — no manual steps needed.
Copy .env.local and fill in your Schwab credentials:
SCHWAB_API_KEY= # Your Schwab app client ID
SCHWAB_API_SECRET= # Your Schwab app client secret
SCHWAB_REDIRECT_URI= # Must match what's registered in your Schwab app
NETLIFY_SITE_ID and NETLIFY_TOKEN are provided automatically by the Netlify runtime — do not add them manually.
Deployed on Netlify. Build configuration is in netlify.toml.
pnpm build # production build