Skip to content

Repository files navigation

πŸ”₯ PulseAPI - The Ultimate x402 Data Hub

Railway Deploy License: MIT Bun

Real-time cryptocurrency prices, news, weather, and multi-source data aggregation for AI agents.

PulseAPI is a premium data aggregation service built for the x402 ecosystem. Get instant access to crypto prices, market sentiment, news with AI sentiment analysis, weather data, and more - all through simple API calls with USDC micropayments.

πŸš€ Why PulseAPI?

  • 7 Powerful Entrypoints - Crypto prices, news, weather, market sentiment, analytics, historical data, and multi-data combos
  • Pay Per Query - Only pay for what you use with USDC micropayments (starting at 0.005 USDC)
  • Multi-Source Aggregation - Combines data from CoinGecko, CoinCap, CryptoCompare, Open-Meteo, and more
  • Built for AI Agents - Perfect for trading bots, market intelligence, and autonomous decision-making
  • Type-Safe - Full TypeScript with Zod schemas for bulletproof integrations
  • Instant Deployment - One-click Railway deployment with auto-scaling

πŸ“Š Available Entrypoints

Entrypoint Description Price (USDC) Use Case
crypto-price Real-time crypto prices for 1000+ coins 0.02 Trading bots, price alerts
news Crypto news with AI sentiment analysis 0.03 Market intelligence
weather Global weather data + 5-day forecast 0.01 Location-based agents
multi-data πŸ”₯ COMBO - All data in one call (29% savings!) 0.05 Comprehensive context
market-sentiment Advanced AI sentiment analysis 0.06 Trading signals
analytics 🎯 OBSERVABILITY - Track your usage 0.01 Cost monitoring
historical-data πŸ“Š TIME SERIES - Historical prices + AI insights 0.04 Backtesting

⚑ Quick Start

Prerequisites

  • Bun runtime (NOT Node.js)
  • Railway account (for deployment)
  • Wallet with USDC on Base network

Local Development

# Clone the repository
git clone https://github.com/YOUR_USERNAME/pulseapi.git
cd pulseapi

# Install dependencies
bun install

# Start development server
bun run dev

The server will start on http://localhost:3000

Test an Entrypoint

# Get crypto prices
curl -X POST http://localhost:3000/entrypoints/crypto-price/invoke \
  -H "Content-Type: application/json" \
  -d '{"symbols": ["bitcoin", "ethereum"], "include24hChange": true}'

# Get weather
curl -X POST http://localhost:3000/entrypoints/weather/invoke \
  -H "Content-Type: application/json" \
  -d '{"location": "New York", "forecast": true}'

🌐 Deployment

Deploy to Railway (Recommended)

  1. Push to GitHub

    git init
    git add .
    git commit -m "Initial commit"
    git remote add origin https://github.com/YOUR_USERNAME/pulseapi.git
    git push -u origin main
  2. Deploy on Railway

    • Go to railway.app
    • Click "New Project" β†’ "Deploy from GitHub repo"
    • Select your pulseapi repository
    • Railway auto-deploys from railway.toml
  3. Set Environment Variables (in Railway dashboard)

    PORT=3000
    NODE_ENV=production
    FACILITATOR_URL=https://facilitator.daydreams.systems
    ADDRESS=0xYOUR_WALLET_ADDRESS_HERE
    NETWORK=base
    DEFAULT_PRICE=10000
    
  4. Get Your URL

    • Railway provides: https://your-app.up.railway.app
    • Test: https://your-app.up.railway.app/.well-known/agent.json

See DEPLOYMENT.md for detailed deployment instructions.

πŸ“‘ Register on x402scan

After deployment, register your entrypoints on x402scan.org:

  1. Navigate to "Register Agent"
  2. Enter your Railway URL: your-app.up.railway.app
  3. Register each entrypoint:
    • crypto-price (0.02 USDC)
    • news (0.03 USDC)
    • weather (0.01 USDC)
    • multi-data (0.05 USDC)
    • market-sentiment (0.06 USDC)
    • analytics (0.01 USDC)
    • historical-data (0.04 USDC)

πŸ’‘ Usage Examples

Get Crypto Prices

// Request
{
  "symbols": ["bitcoin", "ethereum", "solana"],
  "vsCurrency": "usd",
  "includeMarketCap": true,
  "include24hChange": true
}

// Response
{
  "data": [
    {
      "symbol": "BTC",
      "name": "bitcoin",
      "price": 43250.50,
      "marketCap": 847500000000,
      "change24h": 2.5,
      "lastUpdated": "2025-01-15T10:30:00Z"
    }
  ],
  "timestamp": "2025-01-15T10:30:00Z",
  "source": "CoinGecko + CoinCap"
}

Get Market Sentiment

// Request
{
  "asset": "bitcoin",
  "timeframe": "24h"
}

// Response
{
  "asset": "bitcoin",
  "sentiment": {
    "score": 0.65,
    "label": "bullish",
    "confidence": 85
  },
  "indicators": {
    "socialVolume": 12500,
    "newsCount": 45,
    "priceAction": "+2.5%"
  },
  "signals": [
    {
      "type": "price_volatility",
      "description": "Strong upward price movement",
      "strength": "moderate"
    }
  ]
}

Multi-Data Combo (πŸ”₯ BEST VALUE)

// Request - Get everything in one call!
{
  "crypto": {
    "symbols": ["bitcoin", "ethereum"],
    "vsCurrency": "usd"
  },
  "news": {
    "topics": ["bitcoin"],
    "limit": 5
  },
  "weather": {
    "location": "New York",
    "units": "imperial"
  }
}

// Response includes crypto prices, news, AND weather
// Saves 40% vs calling each endpoint separately!

See API_DOCS.md for complete API documentation.

πŸ—οΈ Architecture

pulseapi/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ index.ts              # Main agent setup & entrypoint registration
β”‚   β”œβ”€β”€ entrypoints/          # 7 entrypoint handlers
β”‚   β”‚   β”œβ”€β”€ crypto-price.ts
β”‚   β”‚   β”œβ”€β”€ news.ts
β”‚   β”‚   β”œβ”€β”€ weather.ts
β”‚   β”‚   β”œβ”€β”€ multi-data.ts
β”‚   β”‚   β”œβ”€β”€ market-sentiment.ts
β”‚   β”‚   β”œβ”€β”€ analytics.ts
β”‚   β”‚   └── historical-data.ts
β”‚   └── lib/
β”‚       └── data-sources.ts   # External API integrations
β”œβ”€β”€ tests/                    # Test suite
β”œβ”€β”€ package.json
β”œβ”€β”€ tsconfig.json
└── railway.toml

πŸ”§ Technology Stack

  • Runtime: Bun (ultra-fast JavaScript runtime)
  • Framework: Daydreams x402 Agent Kit
  • Language: TypeScript with strict type checking
  • Validation: Zod schemas for all inputs/outputs
  • Deployment: Railway (auto-scaling, zero-config)
  • Payment: USDC on Base network via x402 protocol

🎯 Data Sources

All APIs used are FREE (no API keys required!):

  • Crypto Prices: CoinGecko API (primary) + CoinCap API (fallback)
  • News: CryptoCompare News API
  • Weather: Open-Meteo API (completely free, unlimited)
  • Market Data: Aggregated from multiple sources

πŸ§ͺ Testing

# Run all tests
bun test

# Run tests in watch mode
bun test --watch

# Type checking
bun run type-check

🀝 Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

Development Workflow

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes
  4. Run tests: bun test
  5. Commit: git commit -m "Add amazing feature"
  6. Push: git push origin feature/amazing-feature
  7. Open a Pull Request

πŸ“ License

MIT License - see LICENSE for details.

🌟 Roadmap

  • WebSocket support for real-time streaming
  • Advanced caching layer for cost optimization
  • Social media sentiment integration (Twitter, Reddit)
  • DeFi metrics (TVL, yields, liquidity)
  • Premium tier with higher rate limits
  • Custom data endpoints for enterprise
  • API dashboard for usage analytics

πŸ†˜ Support


Built by DegenLlama.net

Made with πŸ”₯ for the x402 ecosystem

About

No description, website, or topics provided.

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages