项目 / Open-Dev-Society/OpenStock
免费开源的行情软件,给炒股理财的人,实时看股价、设提醒、查公司底细。
本站整理,非 GitHub 官方 description。
官方快照(gh_history.db,2026-11-25):总榜 未进 Top50 · 日榜 未进 Top50 · 周榜未满 7 天基线(官方不生成) · 月榜暂无官方口径;下方四卡为站内趋势聚合(周卡按上榜次数,非官方 7 日增量窗)。
以下三段按该项目自己的 GitHub README 章节摘录(可合理截断并标明);README 没有对应章节的留空,不编造。
运行 OpenStock 需要 Node.js 22、MongoDB 和 Finnhub 密钥,配好 .env 后依次运行环境检查、数据库测试和 npm run dev 启动,生产环境用 npm run build 加 npm start。
OpenStock 的仪表盘覆盖美国、印度、德国、加拿大、澳大利亚、沙特、波兰、加密和外汇九个市场,并展示指数脉搏、板块热力图、领涨股和头条。
来自 GitHub 仓库 README / 主页介绍正文,正文较长,已截断:保留前 20000 字符(原始 40,512 字节),完整内容见 GitHub 仓库。
<p align="center"><sub><a href="#sponsors">SPONSORED BY</a></sub></p>
<p align="center">
<a href="https://proxy-seller.com/?partner=0PC6QUN0HW8FI0"><img src="public/assets/images/proxy-seller-banner.png" alt="Proxy-Seller: 220+ GEOs, $0.70/GB, 15% off with promo code RAVI" width="420"></a>
</p>
<p align="center">
<a href="https://www.swiftproxy.net/?ref=OpenStock"><picture><source media="(prefers-color-scheme: dark)" srcset="public/assets/images/swiftproxy-logo.png"><img src="public/assets/images/swiftproxy-banner.png" alt="Swiftproxy: 90M+ residential IPs across 220+ locations, 10% off with code PROXY90" width="300"></picture></a>
</p>
<p align="center">
<a href="https://github.com/diip3sh/orbit"><picture><source media="(prefers-color-scheme: dark)" srcset="public/assets/icons/orbit.png"><img src="public/assets/icons/orbit-black.png" alt="" height="20"></picture></a> <a href="https://github.com/diip3sh/orbit"><b>Orbit</b></a>. Free, open-source macOS screen recorder, screenshot tool and video editor: auto-zoom, smooth cursor, backgrounds, web recordings and AI agent recording.
</p>
<p align="center">
<a href="https://www.star-history.com/open-dev-society/openstock">
<picture><source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/badge?repo=Open-Dev-Society/OpenStock&type=rank&theme=dark" /><source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/badge?repo=Open-Dev-Society/OpenStock&type=rank" /><img alt="Star History Rank" src="https://api.star-history.com/badge?repo=Open-Dev-Society/OpenStock&type=rank" /></picture> <picture><source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/badge?repo=Open-Dev-Society/OpenStock&type=trending&theme=dark" /><source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/badge?repo=Open-Dev-Society/OpenStock&type=trending" /><img alt="GitHub Trending Repository of the Day" src="https://api.star-history.com/badge?repo=Open-Dev-Society/OpenStock&type=trending" /></picture>
</a>
</p>
<p align="center">
<a href="https://trendshift.io/repositories/15728?utm_source=repository-badge&utm_medium=badge&utm_campaign=badge-repository-15728" target="_blank" rel="noopener noreferrer"><img src="https://trendshift.io/api/badge/repositories/15728" alt="Open-Dev-Society%2FOpenStock | Trendshift" width="250" height="55"/></a>
<a href="https://trendshift.io/repositories/15728?utm_source=trendshift-badge&utm_medium=badge&utm_campaign=badge-trendshift-15728" target="_blank" rel="noopener noreferrer"><img src="https://trendshift.io/api/badge/trendshift/repositories/15728/daily?language=TypeScript" alt="Open-Dev-Society%2FOpenStock | Trendshift" width="250" height="55"/></a>
<a href="https://trendshift.io/repositories/15728?utm_source=trendshift-badge&utm_medium=badge&utm_campaign=badge-trendshift-15728" target="_blank" rel="noopener noreferrer"><img src="https://trendshift.io/api/badge/trendshift/repositories/15728/weekly?language=TypeScript" alt="Open-Dev-Society%2FOpenStock | Trendshift" width="250" height="55"/></a>
<a href="https://trendshift.io/repositories/15728?utm_source=trendshift-badge&utm_medium=badge&utm_campaign=badge-trendshift-15728" target="_blank" rel="noopener noreferrer"><img src="https://trendshift.io/api/badge/trendshift/repositories/15728/monthly?language=TypeScript" alt="Open-Dev-Society%2FOpenStock | Trendshift" width="250" height="55"/></a>
<a href="https://idmo.app/p/openstock" target="_blank" rel="noopener noreferrer"><img src="https://idmo.app/badge/openstock" alt="I did my own Bloomberg Terminal" width="250" height="55"/></a>
</p>
<div align="center">
<br />
<a href="https://openstock-ods.vercel.app"><img src="./public/assets/images/dashboard.png" alt="OpenStock: the landing page with the market hours dial, index pulse and live charts" /></a>
<br />
<br />
**[Open OpenStock](https://openstock-ods.vercel.app)** · [Changelog](https://openstock-ods.vercel.app/changelog) · [Self-host it](#self-hosting) · [Sponsor](#sponsors) · [Discord](https://discord.gg/JkJ8kfxgxB)
<br />
<div>
<a href="https://github.com/Open-Dev-Society/OpenStock/releases/latest"><img src="https://img.shields.io/github/v/release/Open-Dev-Society/OpenStock?style=for-the-badge&label=release&color=30B27A" alt="Latest release" /></a>
<img src="https://img.shields.io/badge/-Next.js-black?style=for-the-badge&logoColor=white&logo=next.js&color=000000" alt="Next.js badge" />
<img src="https://img.shields.io/badge/-TypeScript-black?style=for-the-badge&logoColor=white&logo=typescript&color=3178C6"/>
<img src="https://img.shields.io/badge/-Tailwind%20CSS-black?style=for-the-badge&logoColor=white&logo=tailwindcss&color=38B2AC"/>
<img src="https://img.shields.io/badge/-shadcn/ui-black?style=for-the-badge&logoColor=white&logo=shadcnui&color=000000"/>
<img src="https://img.shields.io/badge/-Better%20Auth-black?style=for-the-badge&logoColor=white&logo=betterauth&color=000000"/>
<img src="https://img.shields.io/badge/-MongoDB-black?style=for-the-badge&logoColor=white&logo=mongodb&color=00A35C"/>
<img src="https://img.shields.io/badge/-Inngest-black?style=for-the-badge&logoColor=white&logo=inngest&color=000000"/>
<img src="https://img.shields.io/badge/-TradingView-black?style=for-the-badge&logoColor=white&logo=tradingview&color=2962FF"/>
<img src="https://img.shields.io/badge/-Finnhub-black?style=for-the-badge&logoColor=white&color=30B27A"/>
<img src="https://img.shields.io/badge/-Docker-black?style=for-the-badge&logoColor=white&logo=docker&color=2496ED"/>
</div>
</div>
# OpenStock
**Markets, minus the paywall.** OpenStock is a free, open-source alternative to expensive market platforms: track prices, watch the whole market and dig into company insights. Use it at [openstock-ods.vercel.app](https://openstock-ods.vercel.app), or run your own copy with every feature.
> ❤️ **13,000+ people use OpenStock for free.** Help keep it that way: [sponsor from $5 a month](https://github.com/sponsors/ravixalgorithm/sponsorships?frequency=recurring&amount=5), or read [how OpenStock is funded](#sponsors).
> [!NOTE]
> OpenStock is community-built and not a brokerage. Market data may be delayed depending on the provider and your setup. Nothing here is financial advice.
## 📋 Table of Contents
1. 🔋 [Features](#features)
2. ⏱️ [How fresh is the data](#data-freshness)
3. ⚙️ [Tech stack](#tech-stack)
4. 🤸 [Quick start](#quick-start)
5. 🔐 [Environment variables](#environment-variables)
6. 🐳 [Self-hosting](#self-hosting): Docker, prebuilt image, one-click deploys, Railway, Cloudflare Workers (experimental), Vercel
7. 🧱 [Project structure](#project-structure)
8. 📡 [How it works](#data--integrations)
9. 🌍 [Market support](#market-support)
10. 🧪 [Scripts and tests](#scripts--tooling)
11. 🤝 [Contributing](#contributing)
12. 🏆 [Contributors](#contributors)
13. 🛡️ [Security](#security)
14. 📜 [License](#license)
15. 🌱 [Open Dev Society manifesto](#manifesto)
16. 🙏 [Acknowledgements](#acknowledgements)
17. ❤️ [Sponsor OpenStock](#sponsors)
## 🔋 Features <a name="features"></a>
**Markets**
- A dashboard for nine markets: US, India, Germany, Canada, Australia, Saudi Arabia, Poland, Crypto and Forex, with an index pulse and top stories, plus a heatmap and market leaders, or for Saudi Arabia and Poland today's movers and a quotes table priced from Yahoo Finance.
- Search every exchange Finnhub covers with **⌘K**, and keep stocks open as browser-style tabs.
**Stock pages**
- TradingView candles with drawing tools (trend lines, Fibonacci, shapes, text) and fullscreen.
- Pick indicators once (SMA, EMA, Bollinger Bands, VWAP, RSI, MACD, Stochastic, ATR) and they stay on every chart.
- Financials, technicals, the company profile and the dividend yield.
- Sentiment from Reddit, X, news and Polymarket (with an Adanos key).
- Recent news rated 1 to 10 for relevance, with what each story means for the stock (with an AlphAI key).
**Watchlist and alerts**
- A starred watchlist of up to 50 stocks, plus up to 10 named lists of 50, saved to your account. File a stock into a list from any watchlist row or straight from search.
- Price alerts above or below a target, or when the price crosses its 20, 50, 100 or 200-day moving average, checked every 5 minutes and emailed to you (in realtime mode).
- A weekly, AI-written news digest by email every Monday.
**Accounts**
- Email and password, plus Google and GitHub sign-in when configured; password reset and a profile page.
- Rate-limited sign-in, sign-up and password reset; resetting your password signs out your other devices.
**Languages and devices**
- The app, sign-in pages and emails in English, Polish and Arabic (laid out right to left), from your browser's language or the Language menu in the sidebar. The public site is in English.
- Fits phones and tablets from 320px wide.
**Public pages**
- A TradingView chart and the latest SEC filings for every S&P 500 and Nasdaq-100 company at `/s/<ticker>`, and plain comparison guides at `/compare`, with no account needed.
**Community**
- A [changelog](https://openstock-ods.vercel.app/changelog) that credits everyone who contributed, a [Wall of love](https://openstock-ods.vercel.app/love), and an update banner in the app.
## ⏱️ How fresh is the data <a name="data-freshness"></a>
Charts come from TradingView: live for most markets, end of day for some. Quotes, watchlist prices and alerts come from Finnhub:
| | Quotes | Price alerts | Cost |
|---|---|---|---|
| **Community**: [openstock-ods.vercel.app](https://openstock-ods.vercel.app) | Every hour, shared by everyone | No | Free |
| **OpenStock Cloud** (coming soon) | Every 15 seconds | By email | $5 a month |
| **Self-hosted** | Every hour, or every 15 seconds with `NEXT_PUBLIC_OPENSTOCK_DATA_MODE=realtime` and your own Finnhub keys | By email, in realtime mode | Free |
Saudi and Polish prices come from Yahoo Finance, delayed, on every deployment, because TradingView embeds block Tadawul and show Warsaw only end of day.
## ⚙️ Tech stack <a name="tech-stack"></a>
| | |
|---|---|
| App | Next.js 15 (App Router), React 19, TypeScript, Tailwind CSS v4, shadcn/ui and Radix, next-intl (English, Polish, Arabic) |
| Accounts and data | Better Auth, MongoDB with Mongoose |
| Market data | Finnhub, TradingView widgets, Yahoo Finance (Saudi and Polish quotes), Adanos (sentiment), AlphAI (scored news) |
| Background jobs | Inngest |
| Email | Nodemailer (Gmail), Kit for the newsletter |
| AI | Gemini, MiniMax or Siray |
| Hosting | Vercel; a Docker image on GitHub Container Registry for self-hosting; Cloudflare Workers through vinext (experimental) |
## 🤸 Quick start <a name="quick-start"></a>
You need Node.js 22 LTS, a MongoDB database (a free Atlas cluster, or the [Docker setup](#docker-setup)) and a free [Finnhub](https://finnhub.io) key.
```bash
git clone https://github.com/Open-Dev-Society/OpenStock.git
cd OpenStock
npm ci
cp .env.example .env # fill in MONGODB_URI, BETTER_AUTH_SECRET and FINNHUB_API_KEY
node scripts/check-env.mjs # checks your .env
npm run test:db # checks the MongoDB connection
npm run dev # http://localhost:3000
```
Welcome emails, price alerts and the weekly digest run as [Inngest](https://www.inngest.com) jobs. Locally, start Inngest's dev server alongside the app: `npx inngest-cli@latest dev`.
For production: `npm run build && npm start`.
## 🔐 Environment variables <a name="environment-variables"></a>
Every variable is listed with comments in [`.env.example`](.env.example). The ones that matter:
| Variable | Needed | What it's for |
|---|---|---|
| `MONGODB_URI` | Yes | Your MongoDB database |
| `BETTER_AUTH_SECRET` | Yes | Signs sessions. Generate it with `openssl rand -hex 32`. Auth refuses to run in production without it |
| `BETTER_AUTH_URL` | Yes | The app's public URL, used for auth callbacks and links in emails |
| `FINNHUB_API_KEY` | Yes | Market data. Or put several free keys, comma-separated, in `FINNHUB_API_KEYS`: they're rotated, and each adds 60 requests a minute |
| `NEXT_PUBLIC_OPENSTOCK_DATA_MODE` | No | `cached` (hourly, the default) or `realtime` (every 15 seconds, with price alerts). Fixed when the app is built: rebuild after changing it |
| `INNGEST_SIGNING_KEY`, `INNGEST_EVENT_KEY` | In production | Background jobs: welcome emails, price alerts and the weekly digest |
| `NODEMAILER_EMAIL`, `NODEMAILER_PASSWORD` | No | Sending email through Gmail, with an app password. Without them, emails are skipped |
| `GEMINI_API_KEY` (or MiniMax or Siray) | No | AI-written welcome emails and the news digest |
| `ADANOS_API_KEY` | No | The sentiment card on stock pages |
| `ALPHAI_API_KEY` | No | The scored news card on stock pages |
| `KIT_API_KEY`, `KIT_API_SECRET`, `KIT_WELCOME_FORM_ID` | No | The weekly digest newsletter in Kit |
| `GOOGLE_CLIENT_ID` / `_SECRET`, `GITHUB_CLIENT_ID` / `_SECRET` | No | Social sign-in. Callbacks: `<BETTER_AUTH_URL>/api/auth/callback/google` and `/github` |
`NEXT_PUBLIC_FINNHUB_API_KEY` still works as a name for the Finnhub key. No key is ever sent to the browser.
## 🐳 Self-hosting <a name="self-hosting"></a>
### Docker Compose <a name="docker-setup"></a>
Runs OpenStock and MongoDB together. MongoDB is only reachable inside the Docker network; it isn't published on your machine.
1. Fill in `.env` (see above). For the bundled database, choose a password and use it in both places. Letters and digits are simplest; `@ : / ? #` must be percent-encoded in the URI.
```env
MONGO_ROOT_PASSWORD=change-me
MONGODB_URI=mongodb://root:change-me@mongodb:27017/openstock?authSource=admin
```
2. Start it: `docker compose up -d --build`
3. Open http://localhost:3000
The image build needs no secrets: every variable is read when the container starts, except `NEXT_PUBLIC_OPENSTOCK_DATA_MODE`, which Compose passes to the build from `.env`. Data lives in the `mongo-data` volume, and the MongoDB password is only applied when that volume is first created.
### Prebuilt image
Every push to `main` publishes `ghcr.io/open-dev-society/openstock` for amd64 and arm64, tagged `latest`, `sha-<commit>`, and a version for each release (for example `2026.10.18`). To use it, replace `build:` under `openstock` in `docker-compose.yml` with:
```yaml
image: ghcr.io/open-dev-society/openstock:latest
```
then run `docker compose pull && docker compose up -d`. The prebuilt image runs in cached mode; build it yourself for realtime.
### One-click deploys
[](https://repocloud.io/details/OpenStock/)
[](https://zop.dev/zopday/app/deploy?repo=https://github.com/Open-Dev-Society/OpenStock&port=3000&name=openstock&utm_source=github&utm_medium=one_click&utm_content=openstock)
[](https://railway.com/deploy/openstock-1?utm_medium=integration&utm_source=template&utm_campaign=generic)
### Railway <a name="deploy-on-railway"></a>
OpenStock ships a [`railway.json`](railway.json) that builds the `Dockerfile`, checks health on `/sign-in` and restarts on failure. The template above sets everything up; to do it by hand:
1. Create a project and add a **MongoDB** database (`+ New → Database → MongoDB`).
2. Add a service from this repository (`+ New → GitHub Repo`).
3. In the service's **Variables**, set:
```env
MONGODB_URI=${{MongoDB.MONGO_URL}}
BETTER_AUTH_SECRET=${{secret(32)}}
BETTER_AUTH_URL=https://${{RAILWAY_PUBLIC_DOMAIN}}
FINNHUB_API_KEY=your_finnhub_key
GEMINI_API_KEY=your_gemini_api_key
INNGEST_SIGNING_KEY=your_inngest_signing_key
INNGEST_EVENT_KEY=your_inngest_event_key
NODEMAILER_EMAIL=youraddress@gmail.com
NODEMAILER_PASSWORD=your_gmail_app_password
```
4. Under **Settings → Networking**, generate a public domain and redeploy.
For background jobs, add your Railway domain as an app in the [Inngest dashboard](https://app.inngest.com), pointing to `https://<your-domain>/api/inngest`. To turn on realtime mode, also set `NEXT_PUBLIC_OPENSTOCK_DATA_MODE=realtime`; Railway passes it to the build.
### Cloudflare Workers (experimental)
OpenStock can also run on [Cloudflare Workers](https://developers.cloudflare.com/workers/) through [vinext](https://github.com/cloudflare/vinext). The hosted site still runs on Vercel; Workers is for self-hosters who want it.
1. Set the runtime variables as Worker secrets (`npx wrangler secret put MONGODB_URI`, and the same for `BETTER_AUTH_SECRET`, `BETTER_AUTH_URL`, `FINNHUB_API_KEY`, the email, Inngest and AI keys). `BETTER_AUTH_URL` is your Worker's URL. `NEXT_PUBLIC_*` values are read at build time, so set them before building.
2. Allow Cloudflare's addresses in your database's network access (on Atlas, `0.0.0.0/0` with a strong password).
3. Add `https://<your-worker>/api/auth/callback/google` and `.../github` to your OAuth apps if you use social sign-in, and point Inngest at `https://<your-worker>/api/inngest`.
4. Build and deploy: `npm run build:vinext && npm run deploy:vinext`. `npm run dev:vinext` runs it locally on port 3001.
Each request on Workers opens its own MongoDB connection and closes it when the response is done; Node, Docker and Vercel keep one shared connection.
### Vercel
Import the repository, set the variables above for Production, and connect Inngest (its Vercel integration sets both keys). [`vercel.json`](vercel.json) pins functions to Mumbai (`bom1`), next to the hosted database; change it to the region nearest yours.
## 🧱 Project structure <a name="project-structure"></a>
```
app/
(marketing)/ public pages: landing, about, help, api-docs, sponsor, love, changelog, terms, /s/[ticker], /compare
(auth)/ sign-in, sign-up, forgot-password, reset-password
(root)/ the signed-in app: dashboard, watchlist, stocks/[symbol], profile
api/ auth/[...all] (Better Auth), inngest (background jobs), quotes (live prices)
components/ shell/ (sidebar, tabs), stocks/, watchlist/, landing/, marketing/, sponsors/, forms/, ui/ (shadcn)
database/ MongoDB connection and models (watchlist, named lists, alert)
lib/
actions/ server actions: auth, profile, watchlist, named lists, alerts, Finnhub, Yahoo, sentiment, scored news
better-auth/ auth setup (connects to MongoDB on first use, so builds need no database)
inngest/ background jobs and AI prompts
nodemailer/ email sending and templates
markets.ts the dashboard's markets market-data.ts cached vs realtime
changelog.ts releases and contributor credits sponsors.ts sponsors and tiers
rate-limit.ts MongoDB-backed limits for auth and live quotes
i18n/, messages/ next-intl setup and the English, Polish and Arabic strings
middleware.ts public marketing, /s and /compare pages; app pages redirect to sign-in
scripts/ check-env.mjs, test-db.mjs, and one-off maintenance scripts
__tests__/ Vitest tests
```
## 📡 How it works <a name="data--integrations"></a>
- **Finnhub**: search, quotes, company profiles and news. Responses are cached and shared (for an hour, or 15 seconds in realtime mode), with timeouts and a key pool, so a slow upstream never hangs a page.
- **TradingView**: the chart, heatmap, financials, technicals and profile widgets.
- **Yahoo Finance**: delayed quotes for Saudi Arabia and Poland on the dashboard, stock pages and watchlist.
- **Adanos** (optional): the sentiment card.
- **AlphAI** (optional): the scored news card.
- **Better Auth with MongoDB**: accounts and sessions. Pages and server actions check the session on the server; the middleware only redirects signed-out visitors.
- **Inngest** runs the background jobs:
| Job | When |
|---|---|
| AI-personalised