Open-Dev-Society / OpenStock
Open-Dev-Society / OpenStock
New from Open Dev Society: kitbash. Before you build, find out which parts already exist on GitHub. Borrow them, adapt them, or write the rest. © Open Dev Society. This project is licensed under AGPL-3.0; if you modify, redistribute, or deploy it (including as a web service), you must release your source code under the same license and credit the original authors. Open Dev Society 最新力作:kitbash。在开始构建之前,先看看 GitHub 上是否已有现成的组件。你可以直接借用、修改,或者只编写剩余的部分。© Open Dev Society。本项目采用 AGPL-3.0 协议授权;如果你修改、重新分发或部署它(包括作为 Web 服务),你必须在相同的协议下发布你的源代码,并注明原作者。
OpenStock is an open-source alternative to expensive market platforms. Track real-time prices, set personalized alerts, and explore detailed company insights — built openly, for everyone, forever free. Note: OpenStock is community-built and not a brokerage. Market data may be delayed based on provider rules and your configuration. Nothing here is financial advice. OpenStock 是昂贵市场交易平台的开源替代方案。它支持追踪实时价格、设置个性化提醒并探索详细的公司洞察——完全公开构建,面向所有人,永久免费。注意:OpenStock 由社区构建,并非经纪商。市场数据可能会根据提供商规则和你的配置产生延迟。本文内容不构成任何财务建议。
📋 Table of Contents / 目录
✨ Introduction / 简介 🌍 Open Dev Society Manifesto / 宣言 ⚙️ Tech Stack / 技术栈 🔋 Features / 功能特性 🤸 Quick Start / 快速开始 🐳 Docker Setup / Docker 部署 🔐 Environment Variables / 环境变量 🧱 Project Structure / 项目结构 📡 Data & Integrations / 数据与集成 🌍 Market Support / 市场支持 🧪 Scripts & Tooling / 脚本与工具 🤝 Contributing / 贡献指南 🛡️ Security / 安全性 📜 License / 许可证 🙏 Acknowledgements / 致谢
✨ Introduction / 简介
OpenStock is a modern stock market app powered by Next.js (App Router), shadcn/ui and Tailwind CSS, Better Auth for authentication, MongoDB for persistence, Finnhub for market data, and TradingView widgets for charts and market views. OpenStock 是一款现代化的股票市场应用,基于 Next.js (App Router)、shadcn/ui 和 Tailwind CSS 构建,使用 Better Auth 进行身份验证,MongoDB 进行数据持久化,Finnhub 提供市场数据,并集成 TradingView 小部件用于图表和市场视图展示。
🌍 Open Dev Society Manifesto / 宣言
We live in a world where knowledge is hidden behind paywalls. Where tools are locked in subscriptions. Where information is twisted by bias. Where newcomers are told they’re not “good enough” to build. We believe there’s a better way. 我们生活在一个知识被付费墙阻隔的世界。工具被订阅制锁定,信息被偏见扭曲,新手被告知“不够格”去创造。我们相信有更好的方式。
Our Belief: Technology should belong to everyone. Knowledge should be open, free, and accessible. Communities should welcome newcomers with trust, not gatekeeping. 我们的信念:技术应属于每个人。知识应是开放、免费且易于获取的。社区应以信任而非门槛来欢迎新人。
Our Mission: Build free, open-source projects that make a real difference: Tools that professionals and students can use without barriers. Knowledge platforms where learning is free, forever. Communities where every beginner is guided, not judged. Resources that run on trust, not profit. 我们的使命:构建真正有价值的免费开源项目:让专业人士和学生能无障碍使用的工具;让学习永久免费的知识平台;让每个初学者都能得到指导而非评判的社区;基于信任而非利润运行的资源。
Our Promise: We will never lock knowledge. We will never charge for access. We will never trade trust for money. We run on transparency, donations, and the strength of our community. 我们的承诺:我们绝不锁定知识,绝不收取访问费用,绝不用信任换取金钱。我们依靠透明度、捐赠以及社区的力量运行。
Our Call: If you’ve ever felt you didn’t belong, struggled to find free resources, or wanted to build something meaningful — you belong here. Because the future belongs to those who build it openly. 我们的号召:如果你曾感到格格不入,难以找到免费资源,或者想构建有意义的事物——这里就是你的归宿。因为未来属于那些公开构建它的人。
⚙️ Tech Stack / 技术栈
Core: Next.js 15 (App Router), React 19, TypeScript, Tailwind CSS v4 (via @tailwindcss/postcss), shadcn/ui + Radix UI primitives, Lucide icons. 核心: Next.js 15 (App Router), React 19, TypeScript, Tailwind CSS v4 (通过 @tailwindcss/postcss), shadcn/ui + Radix UI 原生组件, Lucide 图标。
Auth & Data: Better Auth (email/password) with MongoDB adapter, MongoDB + Mongoose, Finnhub API for symbols, profiles, and market news, TradingView embeddable widgets. 身份验证与数据: Better Auth (邮箱/密码) 及 MongoDB 适配器, MongoDB + Mongoose, Finnhub API (用于股票代码、资料和市场新闻), TradingView 可嵌入小部件。
Automation & Comms: Inngest (events, cron, AI inference via Gemini), Nodemailer (Gmail transport), next-themes, cmdk (command palette), react-hook-form. 自动化与通信: Inngest (事件、定时任务、通过 Gemini 进行 AI 推理), Nodemailer (Gmail 传输), next-themes, cmdk (命令面板), react-hook-form。
Language composition: TypeScript (~93.4%), CSS (~6%), JavaScript (~0.6%). 语言构成: TypeScript (~93.4%), CSS (~6%), JavaScript (~0.6%)。
🔋 Features / 功能特性
- Authentication: Email/password auth with Better Auth + MongoDB adapter. Protected routes enforced via Next.js middleware. 身份验证: 使用 Better Auth + MongoDB 适配器的邮箱/密码验证。通过 Next.js 中间件强制执行受保护路由。
- Global search and Command + K palette: Fast stock search backed by Finnhub. Popular stocks when idle; debounced querying. 全局搜索与 Command + K 面板: 由 Finnhub 支持的快速股票搜索。空闲时显示热门股票;支持防抖查询。
- Watchlist: Per-user watchlist stored in MongoDB (unique symbol per user). 自选列表: 存储在 MongoDB 中的用户自选列表(每个用户拥有唯一的股票代码)。
- Stock details: TradingView symbol info, candlestick/advanced charts, baseline, technicals. Company profile and financials widgets. Optional cross-source sentiment insights for Reddit, X.com, news, and Polymarket. 股票详情: TradingView 股票信息、K 线/高级图表、基准线、技术指标。包含公司资料和财务小部件。可选跨来源情绪洞察(Reddit, X.com, 新闻, Polymarket)。
- Market overview: Heatmap, quotes, and top stories (TradingView widgets). 市场概览: 热力图、报价和头条新闻(TradingView 小部件)。
- Personalized onboarding: Collects country, investment goals, risk tolerance, preferred industry. 个性化引导: 收集国家、投资目标、风险承受能力和偏好行业。
- Email & automation: AI-personalized welcome email (Gemini via Inngest). Daily news summary emails (cron) personalized using user watchlists. 邮件与自动化: AI 个性化欢迎邮件(通过 Inngest 调用 Gemini)。基于用户自选列表的每日新闻摘要邮件(定时任务)。
- Polished UI: shadcn/ui components, Radix primitives, Tailwind v4 design tokens. Dark theme by default. Keyboard shortcut Cmd/Ctrl + K for quick actions/search. 精美 UI: shadcn/ui 组件、Radix 原生组件、Tailwind v4 设计令牌。默认深色主题。支持 Cmd/Ctrl + K 快捷键进行快速操作/搜索。
🤸 Quick Start / 快速开始
Prerequisites: Node.js 20+, pnpm or npm, MongoDB connection string, Finnhub API key, Gmail account, Optional: Google Gemini API key. 前置条件: Node.js 20+, pnpm 或 npm, MongoDB 连接字符串, Finnhub API 密钥, Gmail 账号, 可选:Google Gemini API 密钥。
Clone and install:
git clone https://github.com/Open-Dev-Society/OpenStock.git
cd OpenStock
pnpm install # or npm install
克隆并安装:(同左)
Configure environment: Create a .env file. Verify DB connectivity: pnpm test:db.
配置环境: 创建 .env 文件。验证数据库连接:pnpm test:db。
Run development:
pnpm dev # Next.js dev
npx inngest-cli@latest dev # Run Inngest locally
运行开发环境:(同左)
🐳 Docker Setup / Docker 部署
You can run OpenStock and MongoDB easily with Docker Compose. Ensure Docker and Docker Compose are installed. 你可以通过 Docker Compose 轻松运行 OpenStock 和 MongoDB。请确保已安装 Docker 和 Docker Compose。
Start the stack:
docker compose up -d mongodb && docker compose up -d --build
启动服务栈:(同左)
Access the app at http://localhost:3000. MongoDB is available at mongodb:27017.
访问应用:http://localhost:3000。MongoDB 可在 mongodb:27017 访问。