AI Saham is a comprehensive stock market analysis platform that combines real-time market data, AI-powered insights, and virtual trading capabilities. The platform is designed to provide investors with tools for informed decision-making through advanced charting, technical analysis, and AI-driven stock predictions.
AI Saham is a full-stack web application built with modern technologies to deliver a professional stock market analysis experience. Key features include:
- Real-time stock price tracking with WebSocket updates
- Advanced charting with technical indicators (SMA, RSI, candlestick patterns)
- AI-powered stock analysis and predictions
- Virtual trading simulation
- Portfolio management
- Market news and sentiment analysis
- Affiliate program management
- Admin dashboard with user management
- React 18 - Modern UI library
- Vite - Fast build tool and dev server
- React Router v6 - Client-side routing
- Tailwind CSS - Utility-first CSS framework
- Radix UI - Accessible UI components
- Chart.js & Recharts - Data visualization
- Lightweight Charts - Interactive financial charts
- Plotly.js - Advanced data visualization
- Socket.IO Client - Real-time communication
- React Query - Server state management
- i18next - Internationalization support
- Playwright - E2E testing
- Node.js - JavaScript runtime
- Express.js - Web framework
- PostgreSQL - Relational database
- Redis - Caching and session management
- Socket.IO - Real-time communication
- JWT - Authentication and authorization
- bcrypt - Password hashing
- OpenAI API - AI analysis capabilities
- OpenBB API - Financial data integration
- yfinance - Yahoo Finance integration
- Winston - Logging
- Cron - Scheduled tasks
- PostgreSQL - Primary database
- Redis - Caching layer
- Migrations - Database version control
┌─────────────────────────────────────────────────────────┐
│ Frontend (React) │
│ ┌─────────────────────────────────────────────────────┐│
│ │ Pages: ││
│ │ - Landing, Login/Register, Plans ││
│ │ - Dashboard, Portfolio, Charting ││
│ │ - Virtual Trading, AI Analysis ││
│ │ - Admin Dashboard, User Management ││
│ └─────────────────────────────────────────────────────┘│
│ State Management: React Context, React Query │
│ UI Components: Tailwind CSS, Radix UI │
└─────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ API Gateway │
│ CORS, Rate Limiting, Authentication │
└─────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ Backend (Express) │
│ ┌─────────────────────────────────────────────────────┐│
│ │ Routes: ││
│ │ - /api/auth (Authentication) ││
│ │ - /api/stocks (Market Data) ││
│ │ - /api/ai (AI Analysis) ││
│ │ - /api/portfolio (Portfolio Management) ││
│ │ - /api/virtual-trading (Simulation) ││
│ │ - /api/admin (Admin Operations) ││
│ │ - /api/affiliate (Affiliate Program) ││
│ └─────────────────────────────────────────────────────┘│
│ Services: │
│ - AuthService (JWT, bcrypt) │
│ - OpenBBService (Financial Data) │
│ - AIService (AI Analysis) │
│ - PriceSimulator (WebSocket Updates) │
└─────────────────────────────────────────────────────────┘
│
┌───────────────┴───────────────┐
▼ ▼
┌──────────────────────┐ ┌──────────────────────┐
│ PostgreSQL DB │ │ Redis │
│ - User Data │ │ - Caching │
│ - Stock Data │ │ - Sessions │
│ - Portfolio Data │ │ - Rate Limiting │
│ - Payment Records │ │ │
└──────────────────────┘ └──────────────────────┘
- JWT-based authentication
- Role-based access control (user, admin)
- Password hashing with bcrypt
- Token refresh mechanism
- Session management
- User profile management
- Real-time stock prices via WebSocket
- Historical price data (1D, 1W, 1M, 3M, 6M, 1Y, ALL)
- Technical indicators: SMA, RSI, candlestick patterns
- Market indices (IHSG, LQ45, JII)
- Top gainers/losers tracking
- Stock search functionality
- AI-powered stock analysis
- Price prediction models
- Sentiment analysis
- Risk assessment
- AI quota management
- Paper trading simulation
- Portfolio tracking
- Trade history
- Virtual balance management
- Performance analytics
- Interactive candlestick charts
- Technical indicators overlays
- Multiple timeframes
- Chart comparison
- Export functionality (PDF, PNG)
- User management
- Payment verification
- System analytics
- Role management
- Quota allocation
- Referral system
- Commission tracking
- Performance analytics
- Payout management
1. Frontend requests stock data
2. Backend fetches from OpenBB API or PostgreSQL
3. Data cached in Redis for performance
4. Response returned to frontend with metadata
5. Real-time updates via WebSocket connections
1. User requests AI analysis for stock
2. Backend verifies AI quota
3. Stock data retrieved from database
4. AI model processes data (technical indicators + machine learning)
5. Analysis result returned with visualizations
6. Quota usage updated
1. User places virtual trade
2. Order validated against virtual balance
3. Transaction recorded in database
4. Portfolio updated
5. Real-time WebSocket update sent to frontend
6. Performance metrics recalculated
- JWT tokens with short expiration
- Refresh token mechanism
- Token blacklisting for logout
- Password hashing with bcrypt (10 rounds)
- Rate limiting on login attempts
- Role-based access control (RBAC)
- Admin-only routes validation
- API key validation for sensitive operations
- Input validation and sanitization
- SQL injection protection (parameterized queries)
- XSS protection (React built-in)
- CORS configuration with allowed origins
- Data encryption in transit (HTTPS)
- Rate limiting (express-rate-limit)
- API key authentication
- Request validation middleware
- Error handling with proper status codes
- users - User profiles and authentication
- user_sessions - Session management
- saham_data - Stock price and volume data
- fundamental_data - Financial statements and ratios
- portfolio - User's holdings and transactions
- virtual_trading - Paper trading records
- payments - Subscription and payment history
- affiliate - Referral and commission tracking
- audit_logs - System activity logging
- ai_quota_audit - AI usage tracking
idx_users_email- For fast user lookupidx_users_role- For role-based queriesidx_audit_logs_actor- For audit log filteringidx_payments_user_id- For payment trackingidx_payments_status- For status-based queries
┌─────────────────────────────────────────────────┐
│ Nginx Reverse Proxy │
│ - SSL Termination │
│ - Load Balancing │
│ - Static File Serving │
└─────────────────────────────────────────────────┘
│
┌───────────────┴───────────────┐
▼ ▼
┌──────────────────────┐ ┌──────────────────────┐
│ Frontend (Vite) │ │ Backend (Node.js) │
│ - Build: npm run build│ │ - PM2 Process Mgmt │
└──────────────────────┘ └──────────────────────┘
│
┌───────────────┴───────────────┐
▼ ▼
┌──────────────────────┐ ┌──────────────────────┐
│ PostgreSQL 12+ │ │ Redis 6+ │
└──────────────────────┘ └──────────────────────┘
NODE_ENV- Environment (development/production)PORT- Server portDATABASE_URL- PostgreSQL connectionREDIS_URL- Redis connectionJWT_SECRET- Token signing secretOPENAI_API_KEY- OpenAI integrationOPENBB_API_KEY- Financial data APICORS_ORIGIN- Allowed frontend origins
- Node.js 18+
- PostgreSQL 12+
- Redis 6+
- npm or yarn
cd client
npm install
cp .env.example .env
npm run devcd server
npm install
cp .env.example .env
npm run migrate
npm run devcd server
npm run migrate
npm run seedPOST /api/auth/register- Register new userPOST /api/auth/login- User loginPOST /api/auth/refresh- Refresh tokenPOST /api/auth/revoke- Revoke token
GET /api/stocks/price/:symbol- Current priceGET /api/stocks/openbb/price/:symbol- OpenBB price dataGET /api/stocks/candlestick- Historical dataGET /api/stocks/top-gainers- Top gainersGET /api/stocks/top-losers- Top losers
GET /api/stocks/openbb/forecast/:symbol- ML forecastGET /api/stocks/ai/quota- AI quota infoPOST /api/stocks/ai/consume- Consume quota
GET /api/portfolio- Get portfolioPOST /api/portfolio- Add holdingPUT /api/portfolio/:id- Update holdingDELETE /api/portfolio/:id- Remove holding
cd client
npm run test
npm run test:watchcd server
npm run test
npm run test:watchcd client
npm run test:e2e- Code splitting with React.lazy
- Image optimization
- Memoization for expensive calculations
- Debouncing and throttling
- Service worker for PWA
- Redis caching
- Connection pooling
- Query optimization
- Compression middleware
- Load balancing
- Indexing strategy
- Query optimization
- Connection pooling
- Caching layers
- Feature branch creation
- Code linting and testing
- Pull request review
- Automated testing
- Production deployment
- GitHub Actions for CI
- PM2 for process management
- Nginx for load balancing
- Let's Encrypt for SSL
- Mobile: < 640px
- Tablet: 640px - 1024px
- Desktop: > 1024px
- Mobile-first approach
- Progressive enhancement
- Accessibility (WCAG 2.0 AA)
- Consistent spacing and typography
- English (en)
- Indonesian (id)
client/src/locales/en.jsonclient/src/locales/id.json
- Winston logger with file and console transports
- Error tracking with stack traces
- Performance monitoring
- React DevTools
- Redux DevTools
- Browser DevTools
- Sentry error tracking
- Fork the repository
- Create a feature branch
- Make changes with tests
- Submit pull request
- Review and merge
MIT License - See LICENSE file for details.
For support, please:
- Check the FAQ
- Review the documentation
- Create an issue on GitHub
- Contact support via email
- Frontend Components: 50+
- Backend Routes: 20+
- Database Tables: 15+
- Tests: 100+
- Languages: 2 (English, Indonesian)
- Advanced AI Models - More sophisticated prediction algorithms
- Social Features - Community, forums, and shared portfolios
- Mobile Apps - iOS and Android applications
- Advanced Charting - More technical indicators
- Real Trading Integration - Broker API connections
- Portfolio Analytics - Advanced performance metrics
- Notification System - Price alerts and market updates
- Machine Learning Models - Custom ML models for prediction
- Daily active users (DAU)
- Monthly active users (MAU)
- Session duration
- Bounce rate
- Conversion rate
- Churn rate
- Average revenue per user (ARPU)
- Customer lifetime value (CLV)
- Page load time
- API response time
- Error rates
- Server uptime
AI Saham is built with modern web technologies to provide a comprehensive stock market analysis platform. The architecture is designed for scalability, security, and performance, making it suitable for both individual investors and professional traders.