Architecture

How StockLens works.

A transparent look at the event-driven, multi-provider system behind your market data and emails.

v1.0.0Gemini with backup AI providersBuilt on OpenStock

Market data

Two data modes, one cache.

Charts always stream from TradingView. Everything we price ourselves goes through a shared cache with timeouts, so a slow provider never stalls a page.

Cached

Hourly

Default for the public site. Quotes are fetched once an hour and shared by every user, so cost grows with symbols, not people.

Realtime

Every 15 seconds

For self-hosting. Set NEXT_PUBLIC_OPENSTOCK_DATA_MODE=realtime and on-screen prices refresh live and email price alerts turn on.

MarketChartsOur quotes and alerts
US stocks, cryptoLiveYes
ForexLiveNo
Canada, AustraliaDelayedNo
India (BSE), GermanyEnd of dayNo
Full market support notes

AI

Emails that don’t go down with a provider.

Welcome emails and news summaries are written by Gemini 2.5 Flash-Lite. If it fails, the request moves down a chain of backup providers (Groq, OpenRouter, DeepSeek, OpenAI), free ones first. Readers with the same stocks share one summary.

  1. 1A user signs up, or a cron fires
  2. 2Inngest runs the function
  3. 3Gemini writes the text
  4. 4Groq, OpenRouter, DeepSeek or OpenAI take over if it fails
  5. 5The email goes out

Background jobs

Four jobs keep things moving.

Welcome email

An AI-written intro tailored to the country, goal, risk and industry picked at sign-up.
On sign-up

Weekly digest

An AI summary of the week’s news for each user’s own watchlist, sent to every subscriber, with a one-click unsubscribe. The top headlines also go out on WhatsApp to those who chose it.
Mon 09:00 IST

Price alerts

Checks every active alert against live Finnhub quotes and notifies the owner by email and WhatsApp when one fires.
Every 5 min

WhatsApp wrap-up

How the US stocks and crypto on each subscriber’s watchlist moved in the last session, one line per stock.
Weekdays 08:30 IST

Stack

Built on services you can inspect.