Complete Linea AI Backend - Crypto Investment Analysis Platform
A comprehensive AI-powered system for analyzing cryptocurrency investment opportunities on the Linea ecosystem, supporting stablecoins, meme coins, and major cryptocurrencies.
- Stablecoins: USDC, USDT, DAI, FRAX, USDB analysis
- Meme Coins: PEPE, DOGE, SHIB, FLOKI, WOJAK, BONK analysis
- Major Coins: BTC, ETH, SOL, AVAX, ADA, DOT, LINK, UNI analysis
- OpenAI GPT-4o-mini integration for intelligent ranking
- Real-time market data from CoinGecko API
- RAG (Retrieval-Augmented Generation) knowledge base
- Fallback ranking system for reliability
GET /api/market-data- Real-time crypto market dataPOST /api/stablecoin-analysis- Stablecoin opportunitiesPOST /api/meme-coin-analysis- Meme coin opportunitiesPOST /api/major-coin-analysis- Major coin opportunitiesPOST /api/rank-opportunities- General analysis (all types)
- Node.js 18+
- OpenAI API key
- CoinGecko API key (optional)
# Clone the repository
git clone https://github.com/YOUR_USERNAME/linea-crypto-ai-platform.git
cd linea-crypto-ai-platform
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env
# Edit .env with your API keysPORT=3000
NODE_ENV=development
OPENAI_API_KEY=your_openai_key_here
OPENAI_MODEL=gpt-4o-mini
LANGFUSE_PUBLIC_KEY=your_langfuse_public_key
LANGFUSE_SECRET_KEY=your_langfuse_secret_key
COINGECKO_API_KEY=your_coingecko_key_here# Install dependencies
npm install
# Copy env template and fill keys
cp env.example .env
# edit .env to set OPENAI_API_KEY (optional), COINGECKO_API_KEY (optional)
# Development mode (serves frontend at /app)
npm run dev
# Open the app UI
open http://localhost:3000/app
# Production mode
npm start
# Health check
curl http://localhost:3000/api/healthlinea-crypto-ai-platform/
βββ services/
β βββ openai-service.js # AI ranking engine
β βββ market-data-service.js # Real-time market data
β βββ rag-service.js # Knowledge base
β βββ fallback-ranking.js # Backup system
βββ routes/
β βββ ai-routes.js # API endpoints
βββ prompts/
β βββ system-prompt.js # AI instructions
β βββ user-prompt.js # Dynamic prompts
βββ knowledge/ # RAG knowledge base
βββ data/
β βββ opps.json # Test opportunities
βββ tests/ # Test suites
# Test complete system
npm run test-complete-crypto
# Test specific components
npm run test-stablecoin
npm run test-meme-coins
npm run test-ragcurl -X POST http://localhost:3000/api/stablecoin-analysis \
-H "Content-Type: application/json" \
-d '{"opportunities": [...]}'curl http://localhost:3000/api/market-data- Update
prompts/system-prompt.jswith new scoring methodology - Add test data to
data/opps.json - Create new API endpoint in
routes/ai-routes.js - Update market data service for new asset prices
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
The system includes comprehensive knowledge about:
- DeFi protocols on Linea
- Stablecoin mechanisms and risks
- Meme coin market dynamics
- Major cryptocurrency fundamentals
- Market trends and analysis
- API keys stored in
.env(not committed) - Input validation on all endpoints
- Rate limiting and error handling
- Conservative AI analysis to prevent hallucination
For questions or issues:
- Check the test suites for examples
- Review the API documentation
- Open an issue on GitHub
Built for the Linea hackathon with love for the crypto community!
Ready to analyze crypto opportunities like a pro! ππ°ππ¦