WebNest
Team/Md Arif Hossain/crypto-monitoring

Repository

crypto-monitoring

View on GitHub ↗
TypeScript0 stars0 forksmytrade-alert.vercel.app

README

💰 Crypto Monitoring System

A comprehensive real-time cryptocurrency monitoring platform with AI-powered analysis, social monitoring, portfolio tracking, and advanced technical analysis.

🎯 Features

📊 Price Monitoring Dashboard

  • Real-time price updates for 7 major cryptocurrencies (BTC, ETH, SOL, SUI, UNI, LINK, BNB)
  • Market overview with total cap, volume, BTC dominance
  • Top movers and gainers sections
  • Beautiful market heatmap with color-coded performance
  • 5-minute auto-refresh with manual refresh button
  • Bilingual interface (English/Bengali)

🤖 AI-Powered Analysis

  • Natural language question answering about crypto market (paid; disabled in Free Mode)
  • Daily market summaries (AI via OpenRouter; disabled in Free Mode with local fallback)
  • Quick question templates for common queries
  • Context-aware responses using current price and news data
  • Multi-language support (English/Bengali)

📰 News & Social Monitoring

  • Real-time crypto news aggregation
  • Sentiment analysis (bullish/bearish/neutral)
  • News impact scoring (1-10 scale)
  • Twitter/X mention monitoring (paid API; disabled in Free Mode)
  • Trading signal detection from tweets (requires Twitter API)
  • Organized tabs for tweets and news

💼 Portfolio Management

  • Add and track cryptocurrency holdings
  • Cost basis tracking
  • Portfolio value calculation
  • Easy entry/removal of assets
  • Local browser storage for privacy

📈 Advanced Technical Analysis

  • Multiple technical indicators:
    • SMA: Simple Moving Averages
    • RSI: Relative Strength Index (14)
    • MACD: Moving Average Convergence Divergence
    • Bollinger Bands: Price volatility bands
    • Support & Resistance: Automated level detection
    • Breakout Detection: Pattern recognition
    • Trend Analysis: Market direction identification
  • 30-day price history analysis
  • Real-time calculations with detailed metrics

⚙️ Settings & Customization

  • Language preference (English/Bengali)
  • Notification settings
  • Price change alerts configuration
  • News impact threshold adjustment
  • Coin selection for monitoring
  • Dark mode (default)

🚀 Quick Start (Detailed)

Prerequisites

  • Node.js 18+
  • pnpm (or npm/yarn)

Installation

# Clone the repository
git clone <repo-url>
cd crypto-monitoring

# Install dependencies
pnpm install

# Create environment file
cp .env.local.example .env.local

# Add your API keys to .env.local

API Keys Required

  1. CoinGecko (Free) - https://www.coingecko.com/en/api

    • NEXT_PUBLIC_COINGECKO_API_KEY - Get free API key
    • Optional Pro: COINGECKO_PRO_API_KEY (uses header x-cg-pro-api-key)
  2. OpenRouter - https://openrouter.ai

  • OPENROUTER_API_KEY - Optional (paid). In Free Mode, AI is disabled with a local fallback summary.
  1. CryptoPanic (Optional) - https://cryptopanic.com/developers

    • NEXT_PUBLIC_CRYPTOPANIC_API_KEY - For news integration
  2. Twitter API v2 (Optional, paid) - https://developer.twitter.com

  • TWITTER_BEARER_TOKEN - Enables social monitoring and signals. Disabled in Free Mode.

Getting API Keys (Detailed)

1. CoinGecko API Key (FREE - ⭐ REQUIRED)

CoinGecko Demo vs Pro

  • Demo (Free): set NEXT_PUBLIC_COINGECKO_API_KEY or COINGECKO_DEMO_API_KEY. Client sends x_cg_demo_api_key as a query param automatically.
  • Pro: set COINGECKO_PRO_API_KEY. Client uses header x-cg-pro-api-key and skips demo param.
  • No changes needed in code; selection is automatic based on env.

2. OpenRouter API Key (PAID - ⭐ REQUIRED for AI)

  • Visit: https://openrouter.ai
  • Sign up and create account
  • Go to API Keys section
  • Add payment method ($5+ minimum)
  • Copy your API key
  • Cost: ~$0.01-0.05 per query

3. CryptoPanic API Key (FREE - Optional)

4. Twitter Bearer Token (PAID - Optional)

5. NewsAPI Key (FREE - Optional)

  • Visit: https://newsapi.org
  • Sign up for free
  • Copy API key immediately
  • Rate Limit: 100 requests/day

6. Telegram Bot Token (FREE - Optional)

  • Open Telegram, search "@BotFather"
  • Use /newbot command
  • Follow prompts to create bot
  • Copy the token provided

7. VAPID Keys for Push Notifications (FREE - Optional)

npm install -g web-push
web-push generate-vapid-keys

Running the Application

# Development server
pnpm dev

# Production build
pnpm build
pnpm start

# Visit http://localhost:3000

Minimum Setup (100% Free)

For a fully free setup, you only need:

  • CoinGecko API Key (free) - prices & market data
  • CryptoPanic API Key (free) - news
  • Optional: MongoDB + Telegram (free) - for alerts

Add these to .env.local:

FREE_MODE=true
NEXT_PUBLIC_FREE_MODE=true
NEXT_PUBLIC_COINGECKO_API_KEY=your_coingecko_api_key
NEXT_PUBLIC_CRYPTOPANIC_API_KEY=your_cryptopanic_api_key

This gives you full free-mode functionality (prices, news, analytics, Telegram alerts). Add paid APIs later if desired.

Free Mode Behavior

  • FREE_MODE=true disables paid providers by default:

    • AI (OpenRouter) endpoints return a local quick summary and a friendly message for Q&A.
    • Twitter endpoints return an empty list (UI remains functional).
    • All other features (CoinGecko, CryptoPanic, Telegram) work normally.
  • To enable OpenRouter while in Free Mode (e.g., using a free model):

    • Set OPENROUTER_ENABLE_IN_FREE=true and provide OPENROUTER_API_KEY.
    • Optionally set OPENROUTER_MODEL (and NEXT_PUBLIC_OPENROUTER_MODEL) to your chosen free model (e.g., amazon/nova-2-lite-v1:free).

📖 API Endpoints

Prices (Extended)

  • GET /api/prices - Current prices for selected coins
  • GET /api/prices/chart?coin=bitcoin&days=7 - Historical price data

Analysis

  • POST /api/analyze - Technical analysis calculations

    {
      "prices": [45000, 45100, 45200],
      "coin": "bitcoin",
      "type": "all"
    }
    

News (Extended)

  • GET /api/news?filter=hot - News with sentiment analysis
  • Optional query params:
    • regions: en,de,nl,es,fr,it,pt,ru,tr,ar,zh,ja,ko
    • public: true|false (default true)
    • currencies: CSV of tickers (e.g., BTC,ETH)
    • kind: news|media|all (default news)
    • search: keyword filter
    • coin: shortcut to filter by a single coin name (mapped to currencies)

AI

  • GET /api/ai/summary - Daily market summary

  • POST /api/ai/query - Question answering

    {
      "question": "What's happening with Bitcoin?",
      "language": "en"
    }
    

Social

  • GET /api/social/tweets - Latest mentions and trading signals
    • Returns an empty list when FREE_MODE=true or no Twitter token is provided

Telegram Alerts

  • POST /api/telegram/webhook - Telegram webhook endpoint
    • Set via BotFather (or programmatically) to receive updates
    • Optional header validation using TELEGRAM_WEBHOOK_SECRET
    • Commands supported: /start, /stop, /help

Cron

  • GET /api/cron/news-alerts - Sends recent top news to active Telegram subscribers
    • Optional Authorization: Bearer ${CRON_SECRET} header for protection
    • Optional query params (fallback to env if not provided):
      • regions: e.g., en
      • public: true|false (default true)
      • kind: news|media|all (default news)
      • size: integer (default 10)
      • currencies: CSV tickers (e.g., BTC,ETH)

🏗️ Project Structure

src/
├── app/                    # Next.js App Router
│   ├── page.tsx           # Dashboard
│   ├── analysis/          # AI Analysis page
│   ├── analytics/         # Technical Analysis page
│   ├── social/            # Social Monitoring page
│   ├── settings/          # Settings page
│   └── api/               # API routes
├── components/            # React components
│   ├── cards/            # PriceCard, NewsCard, TweetCard
│   ├── charts/           # PriceChart
│   ├── sidebar.tsx       # Navigation sidebar
│   ├── top-nav.tsx       # Top navigation bar
│   ├── portfolio-tracker.tsx
│   ├── market-overview.tsx
│   └── market-heatmap.tsx
├── lib/
│   ├── types.ts          # TypeScript interfaces
│   ├── store.ts          # Zustand state management
│   ├── api/              # API clients (CoinGecko, OpenRouter, etc.)
│   ├── db.ts             # MongoDB client + collections
│   └── telegram.ts       # Telegram Bot API helper
│   └── utils/            # Technical analysis utilities
└── public/               # Static assets

🎨 UI/UX Features

  • Dark Mode Default: Optimized for night trading
  • Responsive Design: Mobile, tablet, and desktop views
  • Bilingual Interface: English and Bengali support
  • Interactive Charts: Recharts for price visualization
  • Toast Notifications: Real-time feedback via Sonner
  • Smooth Animations: Hover effects and transitions
  • Accessible Colors: High contrast gradient backgrounds

🔧 Technology Stack

  • Framework: Next.js 16 (App Router, Turbopack)
  • Language: TypeScript 5
  • Styling: Tailwind CSS 4
  • State Management: Zustand 5.0.9
  • Charts: Recharts 2.15.4
  • HTTP Client: Axios 1.13.2
  • Validation: Zod 3.25.76
  • UI Components: Lucide React 0.263.1
  • Notifications: Sonner 1.7.4

📊 Analysis Features

Technical Indicators Included

  1. Simple Moving Average (SMA)

    • Configurable period (default: 20)
    • Smooth trend identification
  2. Relative Strength Index (RSI)

    • Overbought (>70) / Oversold (<30) detection
    • 14-period standard calculation
  3. MACD (Moving Average Convergence Divergence)

    • MACD line and signal line
    • Histogram for momentum
  4. Bollinger Bands

    • Upper, middle, lower bands
    • Volatility measurement
    • Configurable std dev multiplier
  5. Support & Resistance

    • Automated level detection
    • Confidence scoring
    • Historical price pattern recognition
  6. Breakout Detection

    • Bullish/bearish identification
    • Strength quantification
    • Period-based calculation

🔐 Security (Extended)

  • API keys stored in .env.local (not committed)
  • No sensitive data in frontend code
  • CORS-compatible for API routes
  • Rate limiting headers on API responses
  • Zustand store for secure state management

🚀 Deployment

Deploy to Vercel (Recommended)

# Install Vercel CLI
npm i -g vercel

# Deploy
vercel

# Set environment variables in Vercel dashboard

Environment Variables on Vercel

  1. Go to Project Settings → Environment Variables
  2. Add all variables from .env.local.example:
    • NEXT_PUBLIC_COINGECKO_API_KEY
    • OPENROUTER_API_KEY
    • NEXT_PUBLIC_CRYPTOPANIC_API_KEY
  • TWITTER_BEARER_TOKEN
  • etc.
  • For a free deployment, set FREE_MODE=true and omit paid keys (OPENROUTER_API_KEY, TWITTER_BEARER_TOKEN).

📱 Mobile Optimization

  • Responsive grid layouts
  • Touch-friendly buttons
  • Mobile sidebar with overlay
  • Optimized charts for small screens
  • Readable fonts and spacing

🔄 API Rate Limits

  • CoinGecko: 10-50 calls/minute (free tier)
  • OpenRouter: Depends on credit ($0.007-$0.02 per request)
  • Twitter API v2: 300-900 requests/15 min (tier dependent)
  • Internal API: Cached responses with 60-300s max-age

📈 Performance Metrics (Extended)

  • Build Time: ~1.3 seconds (Turbopack)
  • Page Load: <2 seconds
  • API Response: <500ms average
  • Bundle Size: ~200KB (gzipped)

🐛 Troubleshooting (Extended)

"API Key Invalid" Error

  • Verify key is copied correctly from provider
  • Check .env.local is in root directory
  • Restart dev server after adding keys

Charts Not Loading

  • Check browser console for fetch errors
  • Verify API endpoint is responding
  • Check CORS headers in API response

Slow Performance

  • Check network tab for slow API calls
  • Verify API keys are valid (invalid keys cause retries)
  • Clear browser cache and reload

Bilingual Text Issues

  • Ensure language is switched in top-right corner
  • Check localStorage for corruption: localStorage.clear()
  • Verify Bengali font rendering (uses system fonts)

🗺️ Future Roadmap

  • Trading signals with confidence scoring
  • Alert notifications (push/email/Telegram)
  • Portfolio P&L tracking
  • Advanced charting with TradingView widgets
  • Custom indicators and scripts
  • Historical data export (CSV/PDF)
  • Database integration for data persistence
  • User authentication and cloud sync
  • Mobile app (React Native)
  • Backtesting engine

📄 License (Extended)

MIT License - feel free to use for personal or commercial projects

🤝 Contributing (Extended)

Contributions are welcome! Feel free to submit issues and pull requests.

📞 Support (Extended)

For issues or questions:

  1. Check the troubleshooting section
  2. Review API documentation on provider websites
  3. Check browser console for error details
  4. Verify all environment variables are set

Made with ❤️ for crypto traders

Version 1.0.0 | Last Updated: 2024

  • CryptoPanic Integration: Real-time crypto news from multiple sources
  • AI-Powered Sentiment: OpenRouter-based analysis (bullish/bearish/neutral)
  • Impact Scoring: 1-10 impact scale for market relevance
  • Source Filtering: Prioritizes major crypto news outlets
  • Real-Time Updates: Fetches latest news every 15 minutes

Twitter/X Social Integration

  • Account Monitoring: Track specific crypto influencers and analysts
  • Sentiment Detection: Emoji and keyword-based tweet analysis
  • Trading Signals: Automatic detection of trading setups
  • Coin Mentions: Extract coin references from tweets
  • Engagement Metrics: Likes, retweets, and reach analysis

Intelligent Notification System

  • Price Alerts: Configurable thresholds (e.g., >5%, >10%)
  • News Alerts: Breaking news affecting tracked coins
  • Support/Resistance Breaks: Alert on level breaches
  • Trading Signals: Notifications from monitored accounts
  • Multi-Channel: Browser push, Telegram (optional), Email (optional)
  • Bilingual: English & Bengali support

AI Analysis Dashboard

  • Natural Language Queries: Ask questions in Bengali or English
  • Market Summaries: Daily AI-generated market analysis
  • "What-If" Analysis: "What happened to BTC today?"
  • Support Level Predictions: With confidence scores
  • Chat Interface: Interactive Q&A with crypto data context
  • Real-Time Integration: Responses based on current prices and news

User Settings

  • Language Toggle: English and Bengali UI
  • Notification Preferences: Customize alert types and channels
  • Coin Selection: Choose which coins to monitor
  • Theme: Dark mode (default) for better readability
  • Alert Thresholds: Personalized price movement triggers

🛠️ Tech Stack

Frontend

  • Next.js 16+ (App Router, Server Components)
  • React 19 with TypeScript
  • Tailwind CSS 4 for styling
  • Recharts for price charts
  • Zustand for state management
  • Sonner for toast notifications
  • Lucide React for icons

APIs & Services

  • CoinGecko API - Price data (free tier)
  • CryptoPanic API - Crypto news feeds
  • OpenRouter API - AI analysis (Claude, GPT-4)
  • Twitter API v2 - Social monitoring (optional)
  • News API - General financial news (optional)

Backend

  • Next.js API Routes for all backend operations
  • Serverless functions compatible with Vercel
  • CORS-friendly design for frontend requests
  • Caching: 1-min price data, 5-min news, 10-min summaries

📋 Environment Setup

  1. Clone and install:
git clone <repo-url>
cd crypto-monitoring
pnpm install
  1. Create .env.local:
cp .env.local.example .env.local
  1. Fill in API keys:
# Required
NEXT_PUBLIC_COINGECKO_API_KEY=your_key_here
NEXT_PUBLIC_CRYPTOPANIC_API_KEY=your_key_here
OPENROUTER_API_KEY=your_key_here

# Optional
TWITTER_BEARER_TOKEN=your_key_here
NEWS_API_KEY=your_key_here
TELEGRAM_BOT_TOKEN=your_key_here

Getting API Keys

CoinGecko (Free, no key needed):

CryptoPanic:

OpenRouter (AI Analysis):

Twitter API v2 (Optional):

🚀 Quick Start

# Install dependencies
pnpm install

# Run development server
pnpm dev

# Build for production
pnpm build
pnpm start

# Format code
pnpm format

# Lint code
pnpm lint

Visit http://localhost:3000 to see the dashboard.

📁 Project Structure

src/
├── app/
│   ├── page.tsx              # Main dashboard
│   ├── analysis/page.tsx     # AI analysis page
│   ├── api/
│   │   ├── prices/           # Price endpoints
│   │   ├── news/             # News endpoints
│   │   ├── ai/               # AI query & summary
│   │   └── notifications/    # Alert handlers
│   ├── layout.tsx            # Root layout
│   └── globals.css           # Global styles
├── components/
│   ├── cards/
│   │   └── price-card.tsx    # Individual coin card
│   ├── charts/
│   │   └── price-chart.tsx   # Price chart component
│   └── providers.tsx         # App providers
├── lib/
│   ├── api/
│   │   ├── coingecko.ts      # CoinGecko client
│   │   ├── news.ts           # News API client
│   │   ├── openrouter.ts     # AI API client
│   │   └── twitter.ts        # Twitter API client
│   ├── types.ts              # TypeScript types
│   ├── store.ts              # Zustand store
│   └── utils/
│       ├── analysis.ts       # Technical analysis
│       └── notifications.ts  # Notification utilities
└── public/                   # Static files

🔧 Configuration

Add New Coins

Edit src/lib/store.ts:

selectedCoins: [
  'bitcoin', 'ethereum', 'solana',
  'your-new-coin-id' // Add here
]

Adjust Alert Thresholds

In the store:

notificationPreferences: {
  priceChangeThreshold: 5, // Change from 5% to desired %
  // ...
}

Customize Timeframes

AI Model Selection (OpenRouter)

  • Set OPENROUTER_MODEL in .env.local to choose a model (default: amazon/nova-2-lite).
  • Examples: openai/gpt-4o-mini, anthropic/claude-3.5-sonnet (ensure it’s available in your OpenRouter account).
OPENROUTER_MODEL=amazon/nova-2-lite

VS Code MCP (CoinGecko)

  • This repo includes a Continue MCP config at .continue/continue.json.
  • Public server: uses https://mcp.api.coingecko.com/mcp (no key required).
  • Pro server: uses https://mcp.pro-api.coingecko.com/mcp (set COINGECKO_PRO_API_KEY).

Quick start in VS Code (with Continue extension):

  1. Install “Continue” extension
  2. Ensure .continue/continue.json exists
  3. Optionally export your pro key in terminal:
export COINGECKO_PRO_API_KEY=your_pro_key
  1. Use the MCP tools from Continue’s UI to query CoinGecko.

Modify API calls in src/app/api/prices/chart/route.ts:

const days = parseInt(searchParams.get('days') || '7'); // Change default

📊 API Endpoints (Extended)

Prices

  • GET /api/prices?coins=bitcoin,ethereum - Get current prices
  • GET /api/prices/chart?coin=bitcoin&days=7 - Get 7-day history

News

  • GET /api/news?filter=hot - Get hot news
  • GET /api/news?coin=bitcoin - Coin-specific news

AI Analysis

  • POST /api/ai/query - Ask questions
  • GET /api/ai/summary?language=en - Daily summary

Format

All endpoints return { success, data, error, timestamp }

🔔 Notification System

Browser Push Notifications

Requests user permission on first load. Triggered for:

  • Price movements >5%
  • Breaking news (impact >7)
  • Support/resistance breaches
  • New tweets from monitored accounts

Implementation

import { PushNotificationManager } from '@/lib/utils/notifications';

// Send notification
await PushNotificationManager.sendPriceAlert('BTC', 5.2);

Telegram Integration (Optional)

TELEGRAM_BOT_TOKEN=your_bot_token

🌐 Deployment

Vercel (Recommended)

pnpm build
# Push to GitHub
# Vercel auto-deploys on push

Set environment variables in Vercel dashboard.

Other Platforms

Works with any Node.js hosting (Netlify, Railway, etc.)

📱 Mobile Experience

  • Responsive Design: Works perfectly on mobile
  • Touch-Optimized: Larger tap targets
  • Hamburger Menu: Mobile navigation
  • Performance: Optimized for slower connections
  • Offline Support: Last prices cached in localStorage

🔐 Security

  • ✅ API keys stored in .env.local (not committed)
  • ✅ No sensitive data exposed to client
  • ✅ CORS headers properly configured
  • ✅ Rate limiting on API calls
  • ✅ Input validation on all endpoints

🧪 Testing

# Run tests (when added)
pnpm test

# Check types
pnpm type-check

🐛 Troubleshooting

"Failed to fetch prices"

  • Check internet connection
  • Verify CoinGecko API is accessible
  • Check environment variables

"Empty market summary"

  • Wait 10 seconds for initial load
  • Verify OPENROUTER_API_KEY is set
  • Check OpenRouter account has credits

"No notifications"

  • Allow notifications in browser settings
  • Check notification preferences in app
  • Verify price movements exceed threshold

📚 Advanced Features

Custom Analysis

Extend src/lib/utils/analysis.ts with:

  • Fibonacci levels
  • Volume profile
  • Market structure analysis
  • Correlation analysis

Multi-Account Monitoring

Add user accounts to track personalized alerts:

  • Saved watchlists
  • Custom alert preferences
  • Trading journal integration

Integration Examples

// Check if BTC broke support
const isBroken = detectBreakout(btcPrices, 20);
if (isBroken.isBreakout) {
  // Send notification
}

// Analyze news sentiment
const news = await newsAPI.getNews('hot');
const sentiment = analyzeSentiment(news[0].title);

📈 Performance Metrics

  • Dashboard Load: <2s
  • Price Update: 300-500ms
  • AI Query: 2-5s
  • News Fetch: 1-2s
  • Chart Render: <500ms

🗺️ Roadmap

  • Advanced charting (TradingView integration)
  • Portfolio tracking
  • Backtesting engine
  • Machine learning predictions
  • Discord/Slack integration
  • Mobile app (React Native)
  • Historical data export
  • Price alerts via SMS

📄 License

MIT - Feel free to use for personal or commercial projects.

🤝 Contributing

Contributions welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Submit a pull request

📞 Support

For issues or questions:

  • Open an issue on GitHub
  • Check existing issues first
  • Include environment details

🙏 Acknowledgments

Built with:

  • CoinGecko for reliable price data
  • CryptoPanic for crypto news
  • OpenRouter for AI capabilities
  • Next.js team for amazing framework

Made with ❤️ for crypto traders and enthusiasts

Last Updated: December 2025

← Back to profile