A production-grade, free-tier friendly, AI-powered real-time stocks web app built with Next.js 15, Neon Postgres, Finnhub, Groq AI, and Inngest.
- 📈 Real-Time Quotes: Live stock prices updated every 15 seconds
- 🤖 AI Insights: Powered by Groq's Llama-3 for market analysis
- 🔔 Smart Alerts: Price alerts and email notifications via Inngest
- 📊 Interactive Charts: Multiple timeframes (1D, 5D, 1M, 6M, 1Y)
- 📰 Company News: Latest news from Finnhub
- ⭐ Watchlists: Create and manage multiple watchlists
- 📧 Daily Summaries: Automated email digests
- Next.js 15 (App Router)
- TypeScript
- Tailwind CSS
- shadcn/ui components
- Tremor for charts
- SWR for client-side data fetching
- Prisma ORM
- Neon Postgres (serverless)
- Inngest (background jobs)
- Better Auth (authentication)
- Finnhub (stock data)
- Twelve Data (fallback data)
- Groq AI (Llama-3.1-70b)
- Resend (emails)
- Node.js 18+ and npm/pnpm
- Neon Postgres database (or use the provided connection string)
- API keys for services listed in
.env.example
-
Clone and install dependencies
npm install # or pnpm install -
Set up environment variables
cp .env.example .env # Edit .env with your API keys -
Set up the database
npm run db:generate npm run db:migrate npm run db:seed # Optional: creates demo data -
Run the development server
npm run dev
-
Run Inngest functions (in another terminal)
npm run inngest
Visit http://localhost:3000
See .env.example for all required environment variables:
DATABASE_URL- Neon Postgres connection stringBETTER_AUTH_SECRET- Auth signing keyINNGEST_EVENT_KEY- Inngest event keyFINNHUB_API_KEY- Finnhub API keyTWELVEDATA_API_KEY- Twelve Data API keyGROQ_API_KEY- Groq AI API keyRESEND_API_KEY- Resend API key
├── app/
│ ├── api/ # API routes
│ ├── dashboard/ # Dashboard pages
│ ├── auth/ # Auth pages
│ └── page.tsx # Landing page
├── components/ # React components
├── lib/ # Utilities
│ ├── db.ts # Prisma client
│ ├── finnhub.ts # Finnhub API
│ ├── twelvedata.ts # Twelve Data API
│ └── ai.ts # Groq AI
├── inngest/ # Background jobs
│ └── functions/ # Inngest functions
├── prisma/
│ └── schema.prisma # Database schema
└── public/ # Static assets
npm run dev- Start development servernpm run build- Build for productionnpm run start- Start production servernpm run lint- Run ESLintnpm run db:generate- Generate Prisma clientnpm run db:migrate- Run database migrationsnpm run db:seed- Seed demo datanpm run inngest- Start Inngest dev server
GET /api/quote?symbol=AAPL- Get stock quoteGET /api/chart?symbol=AAPL&range=1d- Get chart dataGET /api/news?symbol=AAPL- Get company newsGET /api/search?query=apple- Search for symbols
- Push to GitHub
- Import project in Vercel
- Add environment variables
- Deploy
Neon Postgres handles migrations automatically. For manual migration:
npm run db:migrate- Connect your GitHub repo in Inngest dashboard
- Add environment variables
- Deploy functions
MIT