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.
OpenStock is an open-source alternative to expensive market platforms. Track real-time prices, watch the whole market, and explore detailed company insights — built openly, for everyone, forever free.
❤️ 13,000+ people use OpenStock for free. Help keep it that way: sponsor from $5 a month, or read how OpenStock is funded.
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.
- ✨ Introduction
- 🌍 Open Dev Society Manifesto
- ⚙️ Tech Stack
- 🔋 Features
- 🤸 Quick Start
- 🐳 Docker Setup
- 🔐 Environment Variables
- 🧱 Project Structure
- 📡 Data & Integrations
- 🌍 Market Support
- 🧪 Scripts & Tooling
- 🤝 Contributing
- 🛡️ Security
- 📜 License
- 🙏 Acknowledgements
- ❤️ Sponsor OpenStock
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.
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.
Core
- Next.js 15 (App Router), React 19
- TypeScript
- Tailwind CSS v4 (via @tailwindcss/postcss)
- shadcn/ui + Radix UI primitives
- Lucide icons
Auth & Data
- Better Auth (email/password) with MongoDB adapter
- MongoDB + Mongoose
- Finnhub API for symbols, profiles, and market news
- TradingView embeddable widgets
Automation & Comms
- Inngest (events, cron, AI inference via Gemini)
- Nodemailer (Gmail transport)
- next-themes, cmdk (command palette), react-hook-form
Language composition
- TypeScript (~93.4%), CSS (~6%), JavaScript (~0.6%)
- Authentication
- Email/password auth with Better Auth + MongoDB adapter
- Protected routes enforced via Next.js middleware
- Global search and Command + K palette
- Fast stock search backed by Finnhub
- Popular stocks when idle; debounced querying
- Watchlist
- Per-user watchlist stored in MongoDB (unique symbol per user)
- 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
- Market overview
- Heatmap, quotes, and top stories (TradingView widgets)
- Personalized onboarding
- Collects country, investment goals, risk tolerance, preferred industry
- Email & automation
- AI-personalized welcome email (Gemini via Inngest)
- Weekly news summary email (cron) sent as a Kit broadcast
- Polished UI
- shadcn/ui components, Radix primitives, Tailwind v4 design tokens
- Dark theme by default
- Keyboard shortcut
- Cmd/Ctrl + K for quick actions/search
Prerequisites
- Node.js 20+ and pnpm or npm
- MongoDB connection string (MongoDB Atlas or local via Docker Compose)
- Finnhub API key (free tier supported; real-time may require paid)
- Optional: Gmail account for email (or update Nodemailer transport) if you want welcome and news summary emails
- Optional: Google Gemini API key (for AI-generated welcome intros)
Clone and install
git clone https://github.com/Open-Dev-Society/OpenStock.git
cd OpenStock
# choose one:
pnpm install
# or
npm installConfigure environment
- Create a
.envfile (see Environment Variables). - Verify DB connectivity:
pnpm test:db
# or
npm run test:dbRun development
# Next.js dev (Turbopack)
pnpm dev
# or
npm run devRun Inngest locally (workflows, cron, AI)
npx inngest-cli@latest devBuild & start (production)
pnpm build && pnpm start
# or
npm run build && npm startOpen http://localhost:3000 to view the app.
You can run OpenStock and MongoDB easily with Docker Compose.
-
Ensure Docker and Docker Compose are installed.
-
docker-compose.yml includes two services:
- openstock (this app)
- mongodb (MongoDB database with a persistent volume)
- Create your
.env(see examples below). For the Docker setup, use a local connection string like:
MONGODB_URI=mongodb://root:example@mongodb:27017/openstock?authSource=admin- Start the stack:
# from the repository root
docker compose up -d mongodb && docker compose up -d --build- Access the app:
- App: http://localhost:3000
- MongoDB is available inside the Docker network at host mongodb:27017
Notes
- The app service depends_on the mongodb service.
- Credentials are defined in Compose for the MongoDB root user; authSource=admin is required on the connection string for root.
- Data persists across restarts via the docker volume.
NODEMAILER_EMAILandNODEMAILER_PASSWORDare optional for local Docker runs. If they are omitted, the app still starts but email features stay disabled.
Optional: Example MongoDB service definition used in this project:
services:
mongodb:
image: mongo:7
container_name: mongodb
restart: unless-stopped
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: example
ports:
- "27017:27017"
volumes:
- mongo-data:/data/db
healthcheck:
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
interval: 10s
timeout: 5s
retries: 5
volumes:
mongo-data:Create .env at the project root. Choose either a hosted MongoDB (Atlas) URI or the local Docker URI.
Hosted (MongoDB Atlas):
# Core
NODE_ENV=development
# Database (Atlas)
MONGODB_URI=mongodb+srv://<user>:<pass>@<cluster>/<db>?retryWrites=true&w=majority
# Better Auth
BETTER_AUTH_SECRET=your_better_auth_secret
BETTER_AUTH_URL=http://localhost:3000
# Finnhub
# Note: NEXT_PUBLIC_FINNHUB_API_KEY is required for Vercel deployment
NEXT_PUBLIC_FINNHUB_API_KEY=your_finnhub_key
FINNHUB_BASE_URL=https://finnhub.io/api/v1
# Sentiment insights (optional)
ADANOS_API_KEY=your_adanos_api_key
# ADANOS_API_BASE_URL=https://api.adanos.org
# AI Provider (optional, default: "gemini")
# Supported: "gemini", "minimax", "siray"
# AI_PROVIDER=gemini
# Gemini
GEMINI_API_KEY=your_gemini_api_key
# MiniMax (optional, used when AI_PROVIDER=minimax or as fallback)
# Get your key at https://platform.minimaxi.com
# MINIMAX_API_KEY=your_minimax_api_key
# Inngest Signing Key (required for Vercel deployment)
# Get this from your Inngest dashboard: https://app.inngest.com/env/settings/keys
INNGEST_SIGNING_KEY=your_inngest_signing_key
# Required in production so sign-up can send the welcome-email event
INNGEST_EVENT_KEY=your_inngest_event_key
# Market data (optional)
# Several free Finnhub keys, rotated per request: each adds 60 requests/min.
# FINNHUB_API_KEYS=key_one,key_two
# "cached" (default) refreshes quotes hourly for everyone; "realtime" refreshes every 15s
# and turns on email price alerts (an OpenStock Cloud feature).
# NEXT_PUBLIC_OPENSTOCK_DATA_MODE=cached
# Social sign-in (optional; each provider is hidden server-side until set)
# Callback URLs: <BETTER_AUTH_URL>/api/auth/callback/google and /api/auth/callback/github
# Leave these commented out until you have real credentials: any value turns the provider on
# GOOGLE_CLIENT_ID=your_google_client_id
# GOOGLE_CLIENT_SECRET=your_google_client_secret
# GITHUB_CLIENT_ID=your_github_client_id
# GITHUB_CLIENT_SECRET=your_github_client_secret
# Email (optional; Nodemailer via Gmail, consider App Passwords if 2FA)
# NODEMAILER_EMAIL=youraddress@gmail.com
# NODEMAILER_PASSWORD=your_gmail_app_passwordLocal (Docker Compose) MongoDB:
# Core
NODE_ENV=development
# Database (Docker)
MONGODB_URI=mongodb://root:example@mongodb:27017/openstock?authSource=admin
# Better Auth
BETTER_AUTH_SECRET=your_better_auth_secret
BETTER_AUTH_URL=http://localhost:3000
# Finnhub
# Note: NEXT_PUBLIC_FINNHUB_API_KEY is required for Vercel deployment
NEXT_PUBLIC_FINNHUB_API_KEY=your_finnhub_key
FINNHUB_BASE_URL=https://finnhub.io/api/v1
# Sentiment insights (optional)
ADANOS_API_KEY=your_adanos_api_key
# ADANOS_API_BASE_URL=https://api.adanos.org
# AI Provider (optional, default: "gemini")
# Supported: "gemini", "minimax", "siray"
# AI_PROVIDER=gemini
# Gemini
GEMINI_API_KEY=your_gemini_api_key
# MiniMax (optional, used when AI_PROVIDER=minimax or as fallback)
# Get your key at https://platform.minimaxi.com
# MINIMAX_API_KEY=your_minimax_api_key
# Inngest Signing Key (required for Vercel deployment)
# Get this from your Inngest dashboard: https://app.inngest.com/env/settings/keys
INNGEST_SIGNING_KEY=your_inngest_signing_key
# Required in production so sign-up can send the welcome-email event
INNGEST_EVENT_KEY=your_inngest_event_key
# Market data (optional)
# Several free Finnhub keys, rotated per request: each adds 60 requests/min.
# FINNHUB_API_KEYS=key_one,key_two
# "cached" (default) refreshes quotes hourly for everyone; "realtime" refreshes every 15s
# and turns on email price alerts (an OpenStock Cloud feature).
# NEXT_PUBLIC_OPENSTOCK_DATA_MODE=cached
# Social sign-in (optional; each provider is hidden server-side until set)
# Callback URLs: <BETTER_AUTH_URL>/api/auth/callback/google and /api/auth/callback/github
# Leave these commented out until you have real credentials: any value turns the provider on
# GOOGLE_CLIENT_ID=your_google_client_id
# GOOGLE_CLIENT_SECRET=your_google_client_secret
# GITHUB_CLIENT_ID=your_github_client_id
# GITHUB_CLIENT_SECRET=your_github_client_secret
# Email (optional; Nodemailer via Gmail, consider App Passwords if 2FA)
# NODEMAILER_EMAIL=youraddress@gmail.com
# NODEMAILER_PASSWORD=your_gmail_app_passwordNotes
- Keep private keys server-side whenever possible.
- If using
NEXT_PUBLIC_variables, remember they are exposed to the browser. - In production, prefer a dedicated SMTP provider over a personal Gmail.
- If the Nodemailer credentials are omitted, the app still runs but welcome and news summary emails are disabled.
- Do not hardcode secrets in the Dockerfile; use
.envand Compose.
app/
(auth)/
layout.tsx
sign-in/page.tsx
sign-up/page.tsx
(root)/
layout.tsx
page.tsx
help/page.tsx
stocks/[symbol]/page.tsx
api/inngest/route.ts
globals.css
layout.tsx
components/
ui/… # shadcn/radix primitives (button, dialog, command, input, etc.)
forms/… # InputField, SelectField, CountrySelectField, FooterLink
Header.tsx, Footer.tsx, SearchCommand.tsx, WatchlistButton.tsx, …
database/
models/watchlist.model.ts
mongoose.ts
lib/
actions/… # server actions (auth, finnhub, user, watchlist)
better-auth/…
inngest/… # client, functions, prompts
nodemailer/… # transporter, email templates
constants.ts, utils.ts
scripts/
test-db.mjs
types/
global.d.ts
next.config.ts # i.ibb.co image domain allowlist
postcss.config.mjs # Tailwind v4 postcss setup
components.json # shadcn config
public/assets/images/ # logos and screenshots
-
Finnhub
- Stock search, company profiles, and market news.
- Set
NEXT_PUBLIC_FINNHUB_API_KEYandFINNHUB_BASE_URL(default: https://finnhub.io/api/v1). - Free tiers may return delayed quotes; respect rate limits and terms.
-
Adanos sentiment insights (optional)
- Structured stock sentiment snapshots across Reddit, X.com, news, and Polymarket.
- Set
ADANOS_API_KEY; optionally override the API host withADANOS_API_BASE_URL. - Used only for the stock detail sentiment card and does not replace Finnhub or TradingView.
-
TradingView
- Embeddable widgets used for charts, heatmap, quotes, and timelines.
- External images from
i.ibb.coare allowlisted innext.config.ts.
-
Better Auth + MongoDB
- Email/password with MongoDB adapter.
- Session validation via middleware; most routes are protected, with public exceptions for
sign-in,sign-up, assets and Next internals.
-
Inngest
- Workflows:
app/user.created→ AI-personalized Welcome Email- Cron
0 9 * * 1→ Weekly News Summary (every Monday at 9 AM, Kit broadcast)
- Local dev:
npx inngest-cli@latest dev.
- Workflows:
-
Email (Nodemailer)
- Gmail transport. Update credentials or switch to your SMTP provider.
- Templates for welcome and news summary emails.
OpenStock supports 30+ international stock exchanges including NSE, LSE, TSX, and more. However, please be aware of important limitations based on our data providers.
Quick Facts:
- ✅ Finnhub supports most global exchanges
⚠️ TradingView free tier has restrictions on emerging markets (India NSE, Vietnam, etc.)- 📊 Real-time data for non-US stocks is delayed by 15+ minutes on free tier
See MARKET_SUPPORT.md for:
- Complete list of supported exchanges
- Known limitations and workarounds
- Why "This symbol is only available on TradingView" appears
- How to upgrade for broader market coverage
- Future improvements planned
For the latest supported symbols and exchanges, see Finnhub's exchange list.
Package scripts
dev: Next.js dev server with Turbopackbuild: Production build (Turbopack)start: Run production serverlint: ESLinttest:db: Validate DB connectivity
Developer experience
- TypeScript strict mode
- Tailwind CSS v4 (no separate tailwind.config needed)
- shadcn/ui components with Radix primitives
- cmdk command palette, next-themes, lucide-react icons
You belong here. Whether you’re a student, a self-taught dev, or a seasoned engineer — contributions are welcome.
- Open an issue to discuss ideas and bugs
- Look for “good first issue” or “help wanted”
- Keep PRs focused; add screenshots for UI changes
- Be kind, guide beginners, no gatekeeping — that’s the ODS way
If you discover a vulnerability:
- Do not open a public issue
- Email: opendevsociety@cc.cc
- We'll coordinate responsible disclosure and patch swiftly
OpenStock is and will remain free and open for everyone. This project is licensed under the AGPL-3.0 License - see the LICENSE file for details.
- Finnhub for accessible market data
- TradingView for embeddable market widgets
- shadcn/ui, Radix UI, Tailwind CSS, Next.js community
- Inngest for dependable background jobs and workflows
- Better Auth for simple and secure authentication
- All contributors who make open tools possible
— Built openly, for everyone, forever free. Open Dev Society.
© 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.
- ravixalgorithm - Developed the entire application from the ground up, including authentication, UI design, API and AI integration, and deployment.
- Priyanshuu00007 - Created the official OpenStock logo and contributed to the project’s visual identity.
- chinnsenn - Set up Docker configuration for the repository, ensuring a smooth development and deployment process.
- koevoet1221 - Resolved MongoDB Docker build issues, improving the project’s overall stability and reliability.
- ettoreciolli1 - updated Readme
OpenStock is free, open source and used by 13,000+ registered people. Keeping it that way costs money every month: hosting, the database, market data keys, AI and email, and the hours that go into reviewing pull requests and shipping fixes.
How OpenStock is funded
- OpenStock Cloud will pay for hosting. Cloud ($5 a month, coming soon) adds live quotes and email price alerts. Its subscribers will cover the servers, database and market data the hosted app needs, so the free site stays online without depending on donations.
- Sponsors keep the community moving. Sponsorships pay for the time behind OpenStock: reviewing community pull requests, fixing bugs and shipping features at the pace 13,000+ people expect, with the core free for everyone. Self-hosting stays free, with every feature.
Pick a tier. Each link opens GitHub Sponsors with the amount already selected. Cancel any time.
| Tier | Monthly | What you get |
|---|---|---|
| Backer | $5 | Your name in this README |
| Supporter | $25 | Name and avatar on the sponsor wall and the sponsor page |
| Company | $100 | Your logo in the footer of every public page, in this README and on the sponsor page |
| Partner | $500 | One of three sponsor slots in the app sidebar, seen by 13,000+ registered users, plus your logo on the landing page |
Rather give once? Make a one-time gift. Want an invoice or a custom partnership? Talk with us. Everything, including where the money goes, is on the sponsor page.
Sponsorships are paid through GitHub Sponsors to @ravixalgorithm (Ravi Pratap Singh, founder of Open Dev Society).
Can't sponsor right now? Pick a good first issue, star the repo, or share OpenStock with someone who pays too much for a terminal.
Current sponsors: your logo here. Previously backed by: Siray.ai (2026)
Huge thanks to Adrian Hajdin (JavaScript Mastery) — his excellent Stock Market App tutorial was instrumental in building OpenStock for the open-source community under the Open Dev Society.
GitHub: adrianhajdin YouTube tutorial: Stock Market App Tutorial YouTube channel: JavaScript Mastery