A production-ready financial analysis platform with AI-powered insights, real-time market data, portfolio management, and advanced search capabilities.
FinanceAI is a comprehensive financial analysis platform that combines real-time market data with AI-powered insights to help users make informed investment decisions. Built with modern web technologies and optimized for performance, accessibility, and user experience.
- Stocks: Real-time stock data with technical indicators
- Forex: Currency pair analysis and trends
- Crypto: Cryptocurrency market tracking
- Create and manage multiple portfolios
- Track holdings with real-time P&L calculations
- Portfolio analytics dashboard with interactive charts
- Export portfolio data (CSV/PDF)
- Track favorite assets across all markets
- Quick access to watched assets
- Statistics and performance tracking
- Export watchlist data
- Command palette (βK / Ctrl+K)
- Real-time fuzzy search across all markets
- Recent items tracking
- Keyboard-first navigation
- Portfolio value over time (area charts)
- Asset allocation (pie charts)
- P&L breakdown (bar charts)
- Market heatmap (sector performance)
- Correlation matrix (diversification analysis)
- OHLC price charts with time ranges
- LLaMA 3 integration via Groq
- Market intelligence analysis
- Reddit sentiment analysis (15+ subreddits)
- News aggregation and analysis
- Beautiful, responsive design
- Dark/Light theme support
- Smooth animations with Framer Motion
- Accessible (WCAG AA compliant)
- Progressive Web App (PWA)
- Framework: Next.js 15 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS
- UI Components: shadcn/ui
- Animations: Framer Motion
- Charts: Recharts, D3.js
- State Management: React Hooks, SWR
- Runtime: Node.js
- API: Next.js API Routes
- Database: MongoDB Atlas
- Authentication: NextAuth.js
- AI: Groq (LLaMA 3), LangChain
- Search: Tavily API
- Market Data: Twelve Data API
- News: NewsAPI
- Community: Reddit API
- Search: Tavily Search API
- Testing: Jest, React Testing Library, Playwright
- E2E Testing: Playwright (multi-browser + mobile)
- Linting: ESLint, Prettier
- Accessibility: axe-core, eslint-plugin-jsx-a11y
- Bundle Analysis: @next/bundle-analyzer
- CI/CD: GitHub Actions
- Security: DOMPurify (XSS prevention)
- Unit Tests: 28 tests with Jest & React Testing Library
- Rate limiter tests
- API client tests
- Utility function tests
- E2E Tests: 25+ tests with Playwright
- Homepage & navigation
- Search functionality (Command Palette)
- Portfolio management
- Watchlist operations
- Market data pages
- Multi-browser testing (Chrome, Firefox, Safari)
- Mobile testing (Pixel 5, iPhone 12)
- CI/CD: Automated testing on every push/PR
- Code Coverage: Codecov integration
- Security Headers: 8 comprehensive headers
- HSTS (Strict Transport Security)
- CSP (Content Security Policy)
- X-Frame-Options (Clickjacking prevention)
- X-XSS-Protection
- And more...
- Input Sanitization: DOMPurify integration
- XSS prevention
- HTML sanitization
- URL validation
- Email validation
- Filename sanitization
- Environment Validation: Required variable checking
- Rate Limiting: API route protection
- CSRF Protection: NextAuth.js integration
- Node.js 18+ and npm
- MongoDB Atlas account (free tier)
- API keys (see Environment Variables)
# Clone the repository
git clone https://github.com/RobinMillford/Ai-Finance.git
cd Ai-Finance
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env.local
# Edit .env.local with your API keys
# Run development server
npm run devOpen http://localhost:3000 to see the application.
# Create optimized production build
npm run build
# Start production server
npm start
# Analyze bundle size
ANALYZE=true npm run buildCreate a .env.local file in the root directory:
# Database
MONGODB_URI=your_mongodb_connection_string
# Authentication
NEXTAUTH_SECRET=your_nextauth_secret
NEXTAUTH_URL=http://localhost:3000
# Market Data
TWELVE_DATA_API_KEY=your_twelve_data_key
# News
NEWS_API_KEY=your_news_api_key
# AI
GROQ_API_KEY=your_groq_api_key
# Search
TAVILY_API_KEY=your_tavily_api_key
# Reddit (Optional)
REDDIT_CLIENT_ID=your_reddit_client_id
REDDIT_CLIENT_SECRET=your_reddit_client_secret- MongoDB: MongoDB Atlas
- Twelve Data: Twelve Data
- NewsAPI: NewsAPI
- Groq: Groq Cloud
- Tavily: Tavily
- Reddit: Reddit Apps
financeai/
βββ app/ # Next.js app directory
β βββ api/ # API routes
β β βββ portfolio/ # Portfolio endpoints
β β βββ watchlist/ # Watchlist endpoints
β β βββ stocks/ # Stock data
β β βββ forex/ # Forex data
β β βββ cryptos/ # Crypto data
β βββ portfolio/ # Portfolio pages
β βββ watchlist/ # Watchlist pages
β βββ stocks/ # Stock analysis
β βββ forexs/ # Forex analysis
β βββ cryptos/ # Crypto analysis
β βββ layout.tsx # Root layout
βββ components/ # React components
β βββ ui/ # UI components (shadcn)
β βββ charts/ # Chart components
β βββ CommandPalette.tsx # Search command palette
β βββ ExportButton.tsx # Export functionality
β βββ ...
βββ lib/ # Utility functions
β βββ export-utils.ts # CSV/PDF export
β βββ mongodb.ts # Database connection
β βββ ...
βββ models/ # MongoDB models
β βββ Portfolio.ts
β βββ Watchlist.ts
β βββ User.ts
βββ contexts/ # React contexts
β βββ AuthContext.tsx
βββ public/ # Static assets
βββ next.config.js # Next.js configuration
Create and manage investment portfolios with:
- Add/remove holdings
- Real-time P&L tracking
- Performance analytics
- Asset allocation visualization
- Export to CSV/PDF
Track your favorite assets:
- Multi-market support (stocks, forex, crypto)
- Quick access from any page
- Performance statistics
- Export capabilities
Powerful search with:
- Keyboard shortcuts (βK / Ctrl+K)
- Fuzzy matching
- Recent searches
- Cross-market search
Professional charts:
- Portfolio analytics dashboard
- Market heatmap
- Correlation matrix
- OHLC price charts
- Interactive tooltips
# Run unit tests
npm test
# Run tests in watch mode
npm test -- --watch
# Run tests with coverage
npm test -- --coverage
# Run E2E tests
npx playwright test
# Run E2E tests in UI mode
npx playwright test --ui
# Run E2E tests on specific browser
npx playwright test --project=chromium
# View E2E test report
npx playwright show-report- Unit Tests: 28 tests (Jest + React Testing Library)
- E2E Tests: 25+ tests (Playwright)
- Total: 53+ automated tests
- Coverage: 85%+ on tested modules
- Lighthouse Score: 90+ (Production)
- First Contentful Paint: <0.5s
- Largest Contentful Paint: <2.5s
- Time to Interactive: <3s
- Cumulative Layout Shift: <0.1
- Code splitting and lazy loading
- React.memo and useMemo for expensive operations
- Image optimization (WebP/AVIF)
- Bundle size optimization
- Server-side rendering where appropriate
- Edge caching for static assets
- WCAG AA compliant
- Keyboard navigation support
- Screen reader compatible
- ARIA labels and roles
- Semantic HTML
- Color contrast compliance
- Secure authentication with NextAuth.js
- Environment variable validation
- Rate limiting on API routes
- Input sanitization
- CSRF protection
- Security headers (HSTS, XFO, CSP)
- Installable on desktop and mobile
- Offline support (coming soon)
- App-like experience
- Fast loading times
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please ensure:
- Code follows TypeScript and ESLint standards
- Tests pass (
npm test) - Accessibility guidelines are followed
- Documentation is updated
Yamin Hossain
- LinkedIn: Yamin Hossain
- GitHub: @RobinMillford
- Next.js - React framework
- shadcn/ui - UI components
- Recharts - Chart library
- Twelve Data - Market data
- Groq - AI inference
- Portfolio management system
- Watchlist functionality
- Advanced search (Command Palette)
- Data visualizations (5 chart types)
- Export functionality (CSV/PDF)
- E2E testing with Playwright
- Security hardening
- Performance optimization
- CI/CD pipeline
- Real-time price updates via WebSocket
- Advanced technical indicators
- Price alerts and notifications
- Social trading features
- Mobile app (React Native)
- Advanced portfolio analytics
- Backtesting capabilities
- Multi-language support
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
- β Freedom to use - Use the software for any purpose
- β Freedom to study - Study how the program works and modify it
- β Freedom to share - Redistribute copies to help others
- β Freedom to improve - Distribute modified versions
Note: Any derivative work must also be licensed under GPL-3.0 and source code must be made available.
Built with β€οΈ using Next.js and TypeScript

