A production-ready, full-stack stock market dashboard built with Next.js 15, React 19, TypeScript, and Tailwind CSS. Track stocks, build personalized watchlists, and get real-time market insights with a lightning-fast, optimized UI.
Built for traders and investors who demand speed, precision, and an exceptional user experience.
- Add/remove stocks with instant optimistic UI updates
- Persistent MongoDB storage with one-click access
- Real-time watchlist sync across all pages & components
- Lightweight sparklines for instant visual feedback
- Lazy-loaded TradingView embeds on hover (faster initial load)
- Batch quote endpoint reduces API calls and improves response time
- Debounced stock search with real-time autocomplete
- Watchlist membership status enriched inline
- Server-side and client-side optimizations for responsiveness
- Real-time quotes and price movements (Finnhub)
- Market overview, heatmaps, and company profiles (TradingView)
- Intraday candlestick charts and technical analysis widgets
- Daily AI summaries generated via Inngest background jobs
- Personalized email digests with watchlist performance & market news
- Scheduled jobs run reliably at scale without manual intervention
- Secure session-based auth with better-auth v1
- Email verification & profile management
- Protected API routes and server actions
- Beautiful gradient hero with animated CTA buttons
- Interactive feature cards and testimonial sections
- Smooth hover effects, transitions, and responsive design
- Mobile-first approach with adaptive layouts
- TypeScript strict mode for type safety
- Turbopack for blazing-fast builds
- Server components for optimal performance
- Comprehensive error handling & logging
| Layer | Technologies |
|---|---|
| Frontend | Next.js 15 (App Router), React 19, TypeScript, Tailwind CSS 4 |
| Backend | Next.js API Routes, Server Actions, Middleware |
| Database | MongoDB, Mongoose (v8) |
| Authentication | better-auth v1 (session-based) |
| UI Components | Radix UI, Lucide Icons, cmdk (command palette) |
| External APIs | Finnhub (quotes, profiles), TradingView (charts), Inngest (background jobs) |
| Nodemailer with custom HTML templates | |
| DevOps | Vercel deployment |
| Dev Tools | ESLint, TypeScript, Turbopack |
stoxy/
βββ app/
β βββ (auth)/ # Auth layout (sign-in, sign-up)
β βββ (root)/ # Main app layout
β β βββ page.tsx # Landing page / Dashboard
β β βββ stocks/[symbol]/page.tsx # Stock detail page
β β βββ watchlist/page.tsx # Watchlist table & management
β βββ api/
β βββ watchlist/route.ts # Watchlist CRUD operations
β βββ finnhub/
β β βββ quote/route.ts # Single quote proxy
β β βββ quotes/route.ts # Batch quotes endpoint (optimized)
β βββ inngest/route.ts # Background job handler
βββ components/
β βββ Header.tsx # Sticky header with logo & nav
β βββ SearchCommand.tsx # Command palette (client-enriched watchlist)
β βββ WatchlistButton.tsx # Optimistic add/remove toggle
β βββ StockWatchlistButton.tsx # Client-side membership checker
β βββ WatchlistTable.tsx # Watchlist UI with sparklines & lazy charts
β βββ LazyTradingView.tsx # Lazy-load strategy for TradingView
β βββ Sparkline.tsx # Lightweight SVG sparkline
β βββ ui/ # Radix UI components (dialog, dropdown, etc.)
βββ lib/
β βββ actions/ # Server actions (search, auth, watchlist)
β βββ better-auth/ # Auth configuration
β βββ inngest/ # Background job definitions
β βββ nodemailer/ # Email templates & transport
β βββ utils/ # Helpers & utilities
βββ database/
β βββ mongoose.ts # MongoDB connection pool
β βββ models/watchlist.model.ts # Mongoose schema
βββ types/global.d.ts # Global TypeScript definitions
βββ middleware/index.ts # Auth & request middleware
- Server Components + Client Islands β Maximize performance, use client components only when interactivity is needed
- Optimistic UI Updates β Instant feedback on actions; rollback on error
- Batch API Requests β Reduce network overhead with single multi-stock quote fetch
- Lazy Loading β Defer heavy embeds (TradingView) until user interaction
- State Synchronization β Client-side Set ensures consistent watchlist membership across UI
- Node.js 18.17+ (LTS recommended)
- npm 9+ or yarn 4+
- MongoDB Atlas account (free tier available)
- Finnhub API Key (free tier at finnhub.io)
1. Clone and setup
git clone https://github.com/Crazyhaller/stoxy.git
cd stoxy
npm install2. Configure environment
Create .env.local:
# Database
MONGODB_URI=mongodb+srv://<user>:<password>@cluster.mongodb.net/stoxy
# Authentication
BETTER_AUTH_SECRET=your-random-secret-key-here
BETTER_AUTH_URL=http://localhost:3000
# APIs
FINNHUB_API_KEY=your-finnhub-api-key
NEXT_PUBLIC_TRADINGVIEW_KEY=your-tradingview-key
# Email (optional)
EMAIL_USER=your-email@gmail.com
EMAIL_PASSWORD=your-app-specific-password
EMAIL_FROM=noreply@stoxy.com
# Inngest (optional, for background jobs)
INNGEST_EVENT_KEY=your-event-key
INNGEST_API_KEY=your-api-key3. Run development server
npm run devVisit http://localhost:3000
4. Build for production
npm run build
npm startGET /api/watchlist β Fetch user's watchlist
{
"items": [
{ "symbol": "AAPL", "company": "Apple Inc." },
{ "symbol": "TSLA", "company": "Tesla Inc." }
]
}POST /api/watchlist β Add stock
{ "symbol": "AAPL", "company": "Apple Inc." }DELETE /api/watchlist β Remove stock
{ "symbol": "AAPL" }GET /api/finnhub/quote?symbol=AAPL β Single quote (cached 60s)
POST /api/finnhub/quotes β Batch quotes (optimized)
{
"symbols": ["AAPL", "TSLA", "MSFT"]
}Response:
{
"quotes": [
{ "symbol": "AAPL", "price": 150.25, "changePercent": 1.23 },
{ "symbol": "TSLA", "price": 242.5, "changePercent": -0.45 }
]
}Reduces N API calls to 1, significantly improving watchlist load time.
Sparklines render instantly; TradingView embeds load on hover.
Watchlist page fetches data server-side for faster first paint.
Single /api/watchlist fetch per session; O(1) lookups via Set<string>.
Next.js Turbopack engine for 10x faster dev builds & HMR.
Finnhub endpoints cached with s-maxage=60, stale-while-revalidate=3600.
Stoxy leverages Inngest for reliable, scalable background job processing:
- Scheduled job runs daily at 9:00 AM ET
- Fetches market data, watchlist stocks, and top news
- Generates personalized AI-powered summaries via Gemini API
- Sends rich HTML email with market insights & watchlist updates
- Real-time price alerts for watchlist stocks
- Market trend digests with key movers
- Portfolio performance updates
- News headlines relevant to user's holdings
// lib/inngest/functions.ts
export const dailySummary = inngest.createFunction(
{ id: 'daily-market-summary' },
{ cron: '0 9 * * *' }, // 9 AM daily
async ({ step }) => {
const users = await step.run('fetch-users', async () => {
return db.collection('user').find().toArray()
})
for (const user of users) {
await step.run(`summary-${user.id}`, async () => {
const watchlist = await getWatchlistByUserId(user.id)
const quotes = await fetchBatchQuotes(watchlist.map((w) => w.symbol))
const summary = await generateSummary(quotes, user.preferences)
await sendEmail(user.email, summary)
})
}
}
)- β Reliability β Guaranteed execution with automatic retries
- β Scalability β Handle millions of jobs without infrastructure overhead
- β Visibility β Real-time job monitoring & logs in Inngest dashboard
- β Flexibility β Cron jobs, event-driven, or manual triggers
- β Error Handling β Automatic backoff & dead-letter queues
# .env.local
INNGEST_EVENT_KEY=your-event-key
INNGEST_API_KEY=your-api-keyVisit Inngest Dashboard to monitor job runs and performance.
β
Session-based Auth β Secure HTTP-only cookies via better-auth
β
Environment Variables β All secrets stored in .env.local (never committed)
β
TypeScript Strict Mode β Compile-time type checking
β
Input Validation β Server actions validate all incoming data
β
Protected API Routes β Middleware ensures session authentication
β
CORS Headers β Configured for secure cross-origin requests
{
userId: string; // Mongoose user ID
symbol: string; // Stock symbol (uppercase)
company?: string; // Company name
createdAt: Date;
updatedAt: Date;
// Unique compound index: [userId, symbol]
}{
id: string;
email: string;
name?: string;
image?: string;
emailVerified: boolean;
createdAt: Date;
}- Modern Hero Section β Eye-catching headline, CTA buttons, live demo preview
- Feature Cards Grid β Watchlists, Sparklines, Alerts showcase
- Interactive Testimonials β Real user feedback & 5-star rating
- Smooth Animations β Hover scales (1.01), shadow lift, color transitions
- Responsive Design β Desktop-first with mobile optimizations
- Accessible β ARIA labels, semantic HTML, focus states
-
Push to GitHub
git push origin main
-
Connect to Vercel
- Visit vercel.com
- Import your GitHub repository
- Add environment variables from
.env.local - Deploy
-
Custom Domain (optional)
- Go to project settings β Domains
- Add your custom domain
npx tsc --noEmitnpm run lint- Components are in
components/with clear responsibility - Server Actions handle data fetching in
lib/actions/ - API Routes in
app/api/for REST endpoints - Database models in
database/models/
We welcome contributions! Here's how:
- Fork the repo on GitHub
- Create a feature branch
git checkout -b feature/awesome-feature
- Make changes and test locally
npm run dev
- Commit with a clear message
git commit -m "feat: add awesome feature" - Push and create a Pull Request
- Follow existing code style (TypeScript strict, Tailwind classes)
- Write clear commit messages (feat:, fix:, refactor:, etc.)
- Test changes locally before submitting PR
- Update README if adding major features
- Real-time Price Alerts (email/SMS on thresholds)
- Advanced Charting (custom indicators, annotations)
- Social Features (share watchlists, follow traders)
- Portfolio Tracking (holdings & P&L calculation)
- Mobile App (iOS/Android with React Native)
- AI Stock Recommendations (ML-powered insights)
- Dark Mode Toggle (theme persistence)
- Watchlist Collaboration (invite friends to shared lists)
- Next.js Documentation
- TypeScript Handbook
- Tailwind CSS Docs
- MongoDB Atlas
- Finnhub API
- TradingView Widgets
- π Found a bug? Open an Issue
- π‘ Have an idea? Start a Discussion
- π§ Questions? Reach out via email or GitHub
Developed by: Crazyhaller
Full-Stack Developer | Next.js, React, TypeScript Enthusiast
Special thanks to:
- Next.js β Amazing React framework
- Radix UI β Unstyled, accessible components
- Tailwind CSS β Utility-first CSS
- Finnhub β Free stock market data
- TradingView β Professional charting widgets
- better-auth β Simple, modern auth
- Inngest β Reliable background job processing
- MongoDB β Flexible NoSQL database
- Nodemailer β Email delivery service
Made with β€οΈ | Stoxy v1.0.0
β Star us on GitHub if you find this project useful!
