Skip to content

DesmondJS/Stocks_Market_App

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

28 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“ˆ AI Stock Analytics Platform

Next.js React TailwindCSS shadcn/ui MongoDB Mongoose Better Auth Gemini AI Finnhub Inngest Nodemailer Vercel

An AI-powered stock dashboard that allows users to search, track, and analyze stocks with real-time market data, personalized watchlists, and automated AI-driven insights.

Built with a modern full-stack architecture using Next.js 15, Typescript, MongoDB, Gemini AI, and Inngest workflows, the application provides a seamless experience for monitoring stocks and receiving automated financial insights.

๐ŸŒ Live Demo

https://stocks-market-app-livid.vercel.app/


๐Ÿš€ Features

๐Ÿ” Authentication

  • Secure user authentication powered by Better Auth
  • MongoDB session storage
  • Protected routes via middleware and root layout

๐Ÿ“Š Stock Dashboard

  • Interactive TradingView widgets
  • Market overview and stock visualizations
  • Real-time financial charts

๐Ÿ”Ž Smart Stock Search

  • Cmd/Ctrl + K command palette
  • Debounced search requests
  • Powered by Finnhub API
  • Default fallback for popular stocks

โญ Watchlist Management

Users can:

  • Add stocks to watchlist
  • Edit company category
  • Sort and filter watchlist entries
  • Navigate directly to stock pages
  • Watchlist data is persisted in MongoDB Atlas

๐Ÿค– AI Features

The platform integrates Google Gemini AI for intelligent automation.
Capabilities:

  • Personalized welcome emails
  • AI-generated stock summaries
  • Automated daily news digests

โš™๏ธ Automation Workflows

Powered by Inngest:

  • Event-driven workflows
  • Scheduled cron jobs
  • AI processing pipelines
    Automations include:
  • Welcome email generation
  • Daily financial news summaries

๐Ÿ–ผ Screenshots

Dashboard

Dashboard Pic

Stock Search

Stock Search Pic

Stock Details Page

Details Pic

Watchlist

Watchlist Pic


๐Ÿง  System Architecture

User
 โ”‚
 โ–ผ
Next.js 15 (App Router)
 โ”‚
 โ”œโ”€โ”€ Authentication (Better Auth)
 โ”‚
 โ”œโ”€โ”€ API Routes
 โ”‚     โ”œโ”€โ”€ Finnhub API
 โ”‚     โ”œโ”€โ”€ Gemini AI
 โ”‚     โ””โ”€โ”€ Watchlist CRUD
 โ”‚
 โ”œโ”€โ”€ MongoDB Atlas
 โ”‚
 โ””โ”€โ”€ Inngest Workflows
       โ”œโ”€โ”€ AI Email Generation
       โ””โ”€โ”€ Daily News Automation
              โ”‚
              โ–ผ
           Nodemailer
              โ”‚
              โ–ผ
            Gmail

๐Ÿ›  Tech Stack

Frontend:

  • Next.js 15 (App Router + Turbopack)
  • React 19
  • Tailwind CSS V4
  • Shadcn/ui

Backend:

  • Next.js API Routes
  • Typescript
  • MongoDB Atlas
  • Mongoose
  • Better-Auth

Market Data:

  • Finnhub API: stock search and company data
  • TradingView Widgets: financial charts and analytics

AI Integration:

  • Google Gemini API
  • AI-powered summaries and email content generation

Automation & Workflows

  • Inngest
  • Event-driven background tasks
  • Cron-based automation

Email Service

  • NodeMailer
  • Gmail SMTP transport

Deployment

  • Vercel

๐Ÿ”„ Implemented Workflows

User Authentication

  1. User signs up / signs in
  2. Server actions in auth.action.ts process credentials
  3. Better-Auth manages sessions with MongoDB
  4. Middleware protects authenticated routes

Session Protected App Shell

The root layout verifies the user session.
If no session exists:

redirect โ†’ /login

Authenticated users gain access to:

  • Dashboard
  • Stock pages
  • Watchlist
  • Search

Stock Search Flow

Cmd/Ctrl + K
      โ”‚
      โ–ผ
Debounced query
      โ”‚
      โ–ผ
Finnhub API
      โ”‚
      โ–ผ
Stock result list
      โ”‚
      โ–ผ
Navigate โ†’ /stocks/[symbol]

AI Email Automation

Event Trigger

On Sign Up:

app/user.created

Inngest Workflow

1๏ธโƒฃ Event emitted after signup
2๏ธโƒฃ Inngest function triggers
3๏ธโƒฃ Gemini generates personalized email content
4๏ธโƒฃ Nodemailer sends welcome email

Daily AI News Summary

A scheduled Inngest cron job runs daily.

CRON: 0 12 * * *
Timezone: Asia/Kuala_Lumpur

Workflow:

Fetch stock-related news
        โ”‚
        โ–ผ
Gemini generates summaries
        โ”‚
        โ–ผ
Email digest sent to users

โš™๏ธ Running the Project Locally

1๏ธโƒฃ Clone the Repository

git clone https://github.com/DesmondJS/Stocks_Market_App.git
cd stocks-app

2๏ธโƒฃ Install Dependencies

npm install

3๏ธโƒฃ Configure Environment Variables

Create a .env file.

NODE_ENV="development"

NEXT_PUBLIC_BASE_URL=http://localhost:3000

MONGODB_URI=

BETTER_AUTH_SECRET=
BETTER_AUTH_URL=http://localhost:3000

GEMINI_API_KEY=

#NODEMAILER
NODEMAILER_EMAIL=
NODEMAILER_PASSWORD=

#FINNHUB
NEXT_PUBLIC_FINNHUB_API_KEY=

4๏ธโƒฃ Run the Development Server

npm run dev

App runs on:

http://localhost:3000

5๏ธโƒฃ Start Inngest Dev Server

In another terminal run:

npx inngest-cli@latest dev

This enables:

  • Event workflows
  • AI automation
  • Cron jobs

๐Ÿš€ Deployment

The app is deployed using Vercel.
Deployment includes:

  • Environment-based secrets
  • Serverless API routes
  • Inngest webhook integration
  • MongoDB Atlas cloud database

Live Site:
https://stocks-market-app-livid.vercel.app/


๐Ÿ”ฎ Future Improvements

Potential enhancements:

  • ๐Ÿ“Š Portfolio tracking
  • ๐Ÿ”” Price alerts & notifications
  • ๐Ÿง  AI-powered investment insights

About

A Next.js + Typescript + MongoDB AI stocks market app | Track real-time stock market data and explore detailed company insights

Topics

Resources

Stars

Watchers

Forks

Contributors