Architecture
How OpenStock works.
A transparent look at the event-driven, multi-provider system behind your market data and emails.
v1.0.0Gemini with MiniMax fallbackOpen source · AGPL-3.0
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
HourlyDefault 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 secondsFor OpenStock Cloud and self-hosting. Set NEXT_PUBLIC_OPENSTOCK_DATA_MODE=realtime and on-screen prices refresh live and email price alerts turn on.
| Market | Charts | Our quotes and alerts |
|---|---|---|
| US stocks, crypto | Live | Yes |
| Forex | Live | No |
| Canada, Australia | Delayed | No |
| India (BSE), Germany | End of day | No |
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 is retried on MiniMax-M3, or any OpenAI-compatible provider you configure.
- 1A user signs up, or a cron fires
- 2Inngest runs the function
- 3Gemini writes the text
- 4MiniMax takes over if Gemini fails
- 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 news
Summarises the week’s market news and sends it as a Kit broadcast.
Mon 09:00
Price alerts
Checks every active alert against Finnhub quotes and emails the owner when one fires. Realtime mode only.
Every 5 min
Re-engagement
Finds dormant accounts and sends a gentle nudge.
Daily 10:00
Stack
Built on services you can inspect.
FinnhubQuotes, company profiles, search and news. A pool of keys, rotated per request.TradingViewCharts, heatmaps, technicals and market widgets, embedded live.InngestBackground jobs and schedules, with retries.Better AuthEmail, Google and GitHub sign-in with MongoDB sessions.MongoDB AtlasUsers, watchlists and alerts.KitNewsletter broadcasts for the weekly digest.