Skip to content

RitualChain/oracast-markets

Repository files navigation

Oracast Markets

MIT License Next.js Hono TypeScript

A modern cryptocurrency market data platform built with Hono.js and Next.js. Provides real-time price, volume, and volatility data through an intuitive UI and RESTful API endpoints optimized for blockchain integration.

Oracast Markets Screenshot

✨ Features

  • Real-time Market Data β€” Live cryptocurrency prices, volumes, and volatility from CoinGecko
  • Blockchain-Ready API β€” uint256-encoded values scaled to 1e18 for direct smart contract consumption
  • Fallback Resilience β€” Automatic failover to Coinbase API with intelligent caching
  • NaΓ―ve Forecasting β€” Trend-based price predictions with 60-day backtested confidence scores
  • Modern UI β€” Responsive, branded interface with per-token theming

πŸš€ Quick Start

Prerequisites

Installation

# Clone the repository
git clone https://github.com/RitualChain/oracast-markets.git
cd oracast-markets

# Install dependencies
bun install
# or: npm install

# Start development server
bun dev
# or: npm run dev

Open http://localhost:3000 in your browser.

πŸ“– API Reference

Smart Contract Endpoint

GET /api/features/:id

Returns uint256-encoded values optimized for on-chain consumption:

{
  "price": "97382000000000000000000",
  "volume": "110903448964000000000000000000",
  "volatility": "6173220000000000000",
  "direction": 1,
  "forecast": {
    "mean": "103555220000000000000000",
    "low": "97159526340000000000000",
    "high": "109950913660000000000000"
  },
  "fitness": "854200000000000000000"
}

Display Endpoint

GET /api/features/all/:id

Returns human-readable values with additional metadata:

{
  "price": 97382.0,
  "volume": 110903448964,
  "volatility": 6.17,
  "direction": 1,
  "forecast": { "mean": 103555.22, "low": 97159.53, "high": 109950.91 },
  "fitness": 85.42,
  "name": "Bitcoin",
  "symbol": "BTC",
  "lastUpdated": "2026-01-15T12:00:00.000Z",
  "source": "coingecko"
}

Other Endpoints

Endpoint Description
GET /api/health Health check
GET /api/coins/list Top 25 cryptocurrencies
GET /api/price/:id Price only (uint256)

See docs/integration.md for detailed API documentation.

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   User/Client   │────▢│   Next.js API    │────▢│  CoinGecko API  β”‚
β”‚                 β”‚     β”‚   (Hono Routes)  β”‚     β”‚   (Primary)     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                               β”‚                         β”‚
                               β–Ό                         β–Ό
                        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                        β”‚  In-Memory Cache β”‚     β”‚  Coinbase API   β”‚
                        β”‚   (TTL-based)    β”‚     β”‚   (Fallback)    β”‚
                        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Tech Stack

  • Framework: Next.js 16 (App Router)
  • API: Hono.js 4.10
  • Frontend: React 19, TypeScript
  • Styling: Tailwind CSS, Radix UI

Project Structure

oracast-markets/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ api/[...route]/     # Hono API routes
β”‚   β”œβ”€β”€ features/           # Main data display component
β”‚   └── [..id]/             # Dynamic coin routes
β”œβ”€β”€ components/ui/          # Reusable UI components
β”œβ”€β”€ lib/                    # Utilities and constants
β”œβ”€β”€ docs/                   # API documentation
└── public/                 # Static assets

⛓️ Smart Contract Integration

The API provides uint256-encoded values for direct blockchain consumption:

contract PriceOracle {
    uint256 public price;
    uint256 public volume;
    uint256 public volatility;
    uint256 public direction;

    function updateFeatures(
        uint256 _price,
        uint256 _volume,
        uint256 _volatility,
        uint256 _direction
    ) external onlyOwner {
        price = _price;
        volume = _volume;
        volatility = _volatility;
        direction = _direction;
    }
}

See docs/a2a.md for the complete AI agent integration guide.

πŸ”§ Configuration

Adding Tokens

Edit lib/constants.ts to add new cryptocurrencies:

export const TOKEN_LIST_DEFAULT: Token[] = [
  {
    id: 'bitcoin',        // CoinGecko ID
    name: 'Bitcoin',
    symbol: 'BTC',
    logo: 'https://assets.coingecko.com/...',
    brandColor: '#F7931A',
    brandBgColor: '#FFF4E6',
  },
  // Add more tokens...
];

Environment Variables

Copy .env.example to .env.local for custom configuration. See the file for available options.

πŸ“š Documentation

🚒 Deployment

Vercel (Recommended)

Deploy with Vercel

  1. Push your code to GitHub
  2. Import your repository in Vercel
  3. Deploy automatically

Other Platforms

# Build for production
bun run build

# Start production server
bun run start

🀝 Contributing

Contributions are welcome! Please read CONTRIBUTING.md for guidelines.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'feat: add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ”’ Security

πŸ“„ License

This project is licensed under the MIT License β€” see the LICENSE file for details.

πŸ‘€ Author

Val Alexander β€” bunsdev.com


Built with ❖ for Ritual Devs

About

Modern crypto market data platform built with Hono.js and Next.js. Provides real-time price, volume, and volatility data through an intuitive UI and RESTful API endpoints optimized for blockchain integration.

Topics

Resources

License

Contributing

Security policy

Stars

3 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors