A comprehensive full-stack blockchain investment platform that bridges traditional finance with Web3 technology, featuring both traditional email/password and Web3 wallet authentication with real-time updates and advanced analytics.
- Dual Authentication: Traditional email/password + Web3 wallet authentication
- Company Registration: Blockchain-verified company profiles with NFT tokens
- Investment Tracking: Real-time portfolio management and analytics
- Funding Rounds: Milestone-based fundraising with smart contract automation
- Real-time Updates: WebSocket-powered live data synchronization
- Interactive Charts: Advanced portfolio analytics and performance visualization
- Live Portfolio Updates: WebSocket-powered real-time portfolio value changes
- Investment Notifications: Instant notifications for new opportunities
- Company Milestones: Real-time achievement tracking and notifications
- Price Updates: Live asset price monitoring and alerts
- Interactive Dashboards: Dynamic charts with hover effects and responsiveness
- Core: React.js with TypeScript, Tailwind CSS
- State Management: Zustand for global state, React Query for server state
- Real-time: Socket.io-client for WebSocket connections
- Charts: Chart.js and Recharts for data visualization
- Blockchain: Web3.js/Ethers.js, MetaMask integration
- HTTP Client: Axios with interceptors for API communication
- Server: Node.js with Express.js
- Database: Supabase for data storage and real-time features
- Authentication: JWT tokens + Web3 message signing
- Real-time: Socket.io for WebSocket server
- File Handling: Multer for uploads
- Security: bcrypt, CORS, rate limiting
- Smart Contracts: Solidity with OpenZeppelin libraries
- Development: Hardhat environment with testing
- Network Support: Ethereum, Polygon, local networks
- Security: Multi-signature patterns, reentrancy protection
vyaapar-ai/
βββ frontend/ # React frontend application
β βββ src/
β β βββ components/ # Reusable UI components
β β β βββ Charts/ # Chart.js & Recharts components
β β β βββ Dashboard/ # Dashboard-specific components
β β β βββ common/ # Shared components
β β βββ pages/ # Route pages (Dashboard, Login, etc.)
β β βββ hooks/ # Custom React hooks
β β β βββ useRealTime.js # WebSocket hooks
β β βββ store/ # Zustand stores
β β βββ services/ # API and WebSocket services
β β β βββ api.js # Enhanced API methods
β β β βββ socket.js # WebSocket service
β β βββ utils/ # Utility functions
β β βββ config/ # Configuration files
βββ backend/ # Node.js backend API
β βββ controllers/ # Route handlers
β βββ middleware/ # Authentication & validation
β βββ models/ # Database models
β βββ routes/ # API endpoints
β βββ services/ # Business logic
βββ smart-contracts/ # Solidity smart contracts
β βββ contracts/ # Smart contract files
β βββ scripts/ # Deployment scripts
β βββ test/ # Contract tests
βββ README.md
- Node.js v18+
- npm or yarn
- MetaMask browser extension (for Web3 features)
- Supabase account
- Git
For detailed blockchain integration setup and testing instructions, please refer to our dedicated BLOCKCHAIN_SETUP.md guide. This comprehensive document includes:
- Complete environment configuration for blockchain
- Step-by-step local blockchain setup
- Contract deployment instructions
- Testing scripts explanation
- Manual testing procedures
- Troubleshooting common blockchain issues
We highly recommend following this guide for proper blockchain functionality.
- Clone the repository
git clone <repository-url>
cd vyaapar-ai- Install all dependencies
# Frontend
cd frontend
npm install
# Backend
cd ../backend
npm install
# Smart Contracts
cd ../smart-contracts
npm install- Environment Configuration
Create .env files in each directory:
Backend .env:
# Database
SUPABASE_URL=your_supabase_url
SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_KEY=your_supabase_service_key
# Authentication
JWT_SECRET=your_jwt_secret_key
JWT_EXPIRES_IN=7d
# Server
PORT=5000
NODE_ENV=development
# Blockchain
PRIVATE_KEY=your_wallet_private_key
CONTRACT_ADDRESS=deployed_contract_address
RPC_URL=http://localhost:8545
# CORS
FRONTEND_URL=http://localhost:3000Frontend .env.local:
# API Configuration
REACT_APP_API_URL=http://localhost:5000/api
REACT_APP_SOCKET_URL=http://localhost:5000
# App Configuration
REACT_APP_NAME=Vyaapar.AI
REACT_APP_VERSION=1.0.0
# Blockchain Configuration
REACT_APP_CHAIN_ID=1337
REACT_APP_NETWORK_NAME=localhost
REACT_APP_CONTRACT_ADDRESS=your_deployed_contract_address- Start Development Servers
# Terminal 1: Smart Contracts
cd smart-contracts
npx hardhat node
# Terminal 2: Backend
cd backend
npm run dev
# Terminal 3: Frontend
cd frontend
npm start- Deploy Smart Contracts
cd smart-contracts
npx hardhat compile
npx hardhat run scripts/deploy.js --network localhost- Navigate to
/registeror/login - Create account with email/password
- Access full platform features
- Install MetaMask browser extension
- Click "Connect with Wallet" on login/register page
- Sign message to authenticate
- Access blockchain features
- Real-time Portfolio Value: Live updates via WebSocket
- Performance Analytics: Interactive charts showing returns
- Industry Allocation: Pie charts with investment distribution
- Recent Activity Feed: Live transaction and milestone updates
- Browse Opportunities: Filter by industry, stage, location
- Company Profiles: Detailed information and funding progress
- Investment Interface: Direct investment through the platform
- Real-time Updates: Live funding progress and milestones
- Portfolio Tracking: All investments in one dashboard
- Performance Monitoring: ROI calculations and trends
- Data Export: CSV/PDF reports for tax purposes
- Real-time Notifications: Investment updates and opportunities
The platform provides comprehensive real-time functionality:
- Portfolio Updates: Live portfolio value changes as market moves
- Investment Notifications: Instant alerts for new opportunities
- Company Milestones: Real-time achievement notifications
- Price Updates: Live asset price monitoring
- Funding Progress: Real-time funding round updates
- Blockchain Events: Smart contract event notifications
- Portfolio Performance: Line charts showing value over time
- Industry Allocation: Doughnut charts for sector distribution
- Investment Comparison: Bar charts comparing investments
- Risk Analysis: Scatter plots for risk vs return
- Trend Analysis: Multi-line charts for comparative performance
- Responsive design for all screen sizes
- Hover tooltips with detailed information
- Real-time data updates via WebSocket
- Export functionality for all charts
- Time period filtering (1D, 1W, 1M, 1Y, ALL)
The platform uses a comprehensive API structure:
// Authentication
apiMethods.auth.login(credentials)
apiMethods.auth.register(userData)
apiMethods.auth.walletAuth(signature)
apiMethods.auth.logout()
// Companies
apiMethods.companies.getAll(filters)
apiMethods.companies.getById(id)
apiMethods.companies.register(companyData)
apiMethods.companies.update(id, data)
// Investments
apiMethods.investments.create(investmentData)
apiMethods.investments.getUserInvestments()
apiMethods.investments.getCompanyInvestments(companyId)
// Portfolio
apiMethods.portfolio.getSummary()
apiMethods.portfolio.getPerformance()
apiMethods.portfolio.getAnalytics()// Portfolio Updates
socket.on('portfolio:updated', (data) => {
// Handle portfolio changes
});
// Investment Notifications
socket.on('investment:created', (investment) => {
// Handle new investment
});
// Company Updates
socket.on('company:milestone', (milestone) => {
// Handle milestone achievements
});
// Price Updates
socket.on('price:update', (priceData) => {
// Handle price changes
});import {
usePortfolioUpdates,
useInvestmentUpdates,
usePriceUpdates
} from './hooks/useRealTime';
// Usage in components
const MyComponent = () => {
usePortfolioUpdates((portfolioData) => {
console.log('Portfolio updated:', portfolioData);
});
return <div>Portfolio Dashboard</div>;
};import {
PortfolioChart,
IndustryAllocationChart,
InvestmentReturnsChart
} from './components/Charts';
// Portfolio Performance Chart
<PortfolioChart
data={portfolioData}
height={400}
showLegend={true}
responsive={true}
/>
// Industry Allocation Doughnut Chart
<IndustryAllocationChart
data={allocationData}
showPercentages={true}
animated={true}
/>
// Investment Returns Bar Chart
<InvestmentReturnsChart
data={returnsData}
compareMode={true}
timeframe="1Y"
/>import {
PortfolioTrendChart,
InvestmentComparisonChart
} from './components/Charts/RechartsComponents';
// Advanced Portfolio Trend Analysis
<PortfolioTrendChart
data={trendData}
metrics={['value', 'returns', 'risk']}
interactive={true}
/>
// Investment Performance Comparison
<InvestmentComparisonChart
investments={investmentData}
metric="returns"
groupBy="industry"
/>- JWT Authentication: Secure token-based authentication
- Web3 Message Signing: Cryptographic wallet verification
- Password Hashing: bcrypt for secure password storage
- CORS Protection: Cross-origin request filtering
- Rate Limiting: API endpoint protection
- Input Validation: Comprehensive request validation
- SQL Injection Prevention: Parameterized queries
- React Query: Intelligent data caching and synchronization
- Lazy Loading: Code splitting for faster initial loads
- WebSocket Connection Pooling: Efficient real-time connections
- Database Indexing: Optimized query performance
- Image Optimization: Compressed assets for faster loading
- Bundle Splitting: Optimized JavaScript delivery
npm start # Development server
npm run build # Production build
npm test # Run tests
npm run lint # Code linting
npm run analyze # Bundle analysisnpm start # Production server
npm run dev # Development with hot reload
npm test # Test suite
npm run lint # Code linting
npm run migrate # Database migrationsnpx hardhat compile # Compile contracts
npx hardhat test # Run contract tests
npx hardhat node # Local blockchain
npx hardhat run scripts/deploy.js --network localhost-
Feature Development
- Create feature branch from
main - Implement feature with tests
- Update documentation
- Submit pull request
- Create feature branch from
-
Testing Strategy
- Unit tests for components and utilities
- Integration tests for API endpoints
- Contract tests for smart contracts
- End-to-end tests for user flows
-
Code Quality
- ESLint for JavaScript/TypeScript
- Prettier for code formatting
- Husky for git hooks
- Conventional commits
npm run build
# Deploy dist/ folder to hosting service# Set production environment variables
# Deploy via Git or Dockernpx hardhat run scripts/deploy.js --network mainnet
# Update frontend with contract addressBackend Production:
NODE_ENV=production
DATABASE_URL=production_database_url
JWT_SECRET=secure_production_secret
CORS_ORIGIN=https://your-domain.comFrontend Production:
REACT_APP_API_URL=https://api.your-domain.com
REACT_APP_SOCKET_URL=https://api.your-domain.com
REACT_APP_CHAIN_ID=1
REACT_APP_NETWORK_NAME=mainnet// Check MetaMask availability
if (typeof window.ethereum === 'undefined') {
console.error('MetaMask not installed');
}
// Handle connection errors
try {
await window.ethereum.request({ method: 'eth_requestAccounts' });
} catch (error) {
console.error('User denied account access');
}// Check connection status
socket.on('connect', () => {
console.log('WebSocket connected');
});
socket.on('disconnect', () => {
console.log('WebSocket disconnected');
});
// Handle reconnection
socket.on('reconnect', () => {
console.log('WebSocket reconnected');
});- Verify backend server is running on correct port
- Check CORS configuration for frontend domain
- Ensure environment variables are correctly set
- Check network connectivity and firewall settings
- Verify WebSocket connection in browser dev tools
- Check Socket.io server configuration
- Ensure proper event listeners are attached
- Validate authentication tokens for protected events
- Use React DevTools Profiler for component performance
- Monitor WebSocket message frequency and size
- Check database query performance with logging
- Analyze bundle size with webpack-bundle-analyzer
The platform is fully responsive across all devices:
- Desktop: Full feature set with advanced charts
- Tablet: Touch-optimized interface with chart interactions
- Mobile: Streamlined UI with essential features
- PWA Support: Add to home screen capability
- Touch-friendly chart interactions
- Responsive navigation with hamburger menu
- Optimized form inputs for mobile keyboards
- Swipe gestures for chart navigation
- Error tracking with Sentry integration
- Performance monitoring for API endpoints
- WebSocket connection analytics
- User behavior tracking (privacy-compliant)
- Investment flow tracking
- User engagement metrics
- Portfolio performance analytics
- Company registration trends
POST /api/auth/login- Traditional email/password loginPOST /api/auth/register- User registration with emailPOST /api/auth/wallet-auth- Web3 wallet authenticationPOST /api/auth/logout- User session logoutGET /api/auth/me- Get current authenticated user
GET /api/companies- List companies with filteringGET /api/companies/:id- Get specific company detailsPOST /api/companies/register- Register new companyPUT /api/companies/:id- Update company informationGET /api/companies/:id/funding- Get company funding rounds
POST /api/investments- Create new investmentGET /api/investments/my-investments- Get user's investmentsGET /api/investments/company/:id- Get company investmentsPUT /api/investments/:id- Update investment detailsDELETE /api/investments/:id- Cancel investment (if allowed)
GET /api/portfolio- Portfolio summary with real-time dataGET /api/portfolio/performance- Historical performance dataGET /api/portfolio/analytics- Advanced portfolio analyticsGET /api/portfolio/allocation- Industry/sector allocationGET /api/portfolio/transactions- Transaction history
GET /api/real-time/portfolio- Live portfolio updatesGET /api/real-time/prices- Current asset pricesGET /api/real-time/market- Market data and trendsWebSocket /socket.io- Real-time event subscriptions
We welcome contributions to Vyaapar.AI! Here's how to get started:
- Fork the repository from GitHub
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes with proper testing
- Commit your changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request with detailed description
- Follow existing code style and conventions
- Add tests for new functionality
- Update documentation for API changes
- Ensure all tests pass before submitting
- Use conventional commit messages
# Fork and clone the repository
git clone https://github.com/your-username/vyaapar-ai.git
cd vyaapar-ai
# Install dependencies
npm run install:all
# Set up development environment
npm run setup:dev
# Run all services
npm run dev:allThis project is licensed under the MIT License - see the LICENSE file for complete details.
- React: MIT License
- Chart.js: MIT License
- Socket.io: MIT License
- OpenZeppelin: MIT License
- GitHub Issues: Report bugs and request features
- Documentation: docs.vyaapar.ai
- Email Support: support@vyaapar.ai
- Discord Community: Join our Discord
- Developer Blog: Latest updates and tutorials
- Video Tutorials: Step-by-step implementation guides
- API Reference: Complete endpoint documentation
- Best Practices: Security and performance guidelines
When reporting bugs, please include:
- Operating system and browser version
- Node.js version
- Steps to reproduce the issue
- Expected vs actual behavior
- Screenshots or error messages
- Mobile App: React Native mobile application
- Advanced Analytics: ML-powered investment insights
- DeFi Integration: Yield farming and liquidity pools
- Multi-chain Support: Polygon, BSC, Avalanche
- Social Features: Investment communities and discussions
- β Real-time WebSocket Integration: Live portfolio updates
- β Interactive Charts: Chart.js and Recharts implementation
- β Enhanced API: Comprehensive endpoint structure
- β Performance Optimization: React Query and caching
- β Mobile Responsiveness: Full mobile optimization
π Built with β€οΈ by the Vyaapar.AI Team
Bridging Traditional Finance with Web3 Technology