Skip to content

danilobatson/crypto-rankings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

24 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ High-Performance Crypto Rankings Dashboard

A production-ready social analytics API built with Go + Inngest + Redis Cloud + React. Real-time cryptocurrency sentiment analysis with enterprise-grade architecture.

Crypto Rankings Dashboard Go Version React TypeScript

🎯 Live Demo

🌐 Frontend Dashboard: View Live Demo

πŸ”§ API Health Check: Backend Status

πŸ“Š Real-time Metrics: 11 cryptocurrency social sentiment indicators

⚠️ Note: Backend uses Render's free tier - first request may take 30-60 seconds to wake up from sleep after 15 minutes of inactivity.


πŸ—οΈ Architecture Overview

graph TD
    A[LunarCrush API] --> B[Inngest Background Jobs]
    B --> C[Redis Cloud Cache]
    C --> D[React Dashboard]
Loading

πŸ”₯ Key Features

  • ⚑ High Performance: Go backend with Redis Cloud caching (3-5 second response times)
  • πŸ€– AI-Ready: LunarCrush API integration for seamless AI assistant access
  • πŸ”„ Background Processing: Inngest workflows with error recovery and retries
  • πŸ“Š Real-time Analytics: 11 cryptocurrency social sentiment metrics
  • πŸ›‘οΈ Production Ready: Comprehensive error handling and graceful degradation

πŸ› οΈ Technology Stack

Backend Architecture

  • 🏎️ Go 1.24 - High-performance API server with Gin framework
  • πŸ”΄ Redis Cloud - Cloud-hosted Redis with 15-minute TTL caching
  • βš™οΈ Inngest - Background job processing with error recovery
  • πŸ”— LunarCrush API - For latest cryptocurrency social analytics
  • ☁️ Render - Backend deployment platform (free tier with cold starts)

Frontend Stack

  • βš›οΈ Next.js 14 - React framework with TypeScript
  • 🎨 Tailwind CSS - Utility-first styling with custom color palette
  • 🧩 Radix UI - Accessible component primitives
  • πŸ“‘ TanStack Query - Server state management with caching
  • 🎯 TypeScript - Full type safety across the application
  • ☁️ Vercel - Frontend deployment platform

Cloud Services

  • Redis Cloud - Managed Redis hosting (30MB free tier)
  • Render - Go backend hosting (free tier with sleep mode)
  • Vercel - React frontend hosting (permanent free tier)
  • Inngest - Background job orchestration (free tier)

⚑ Quick Start

Prerequisites

πŸš€ 1-Minute Setup

# Clone the repository
git clone https://github.com/danilobatson/crypto-rankings.git
cd crypto-rankings

# Setup environment variables
cp .env.example .env
# Edit .env with your API keys (see setup guide below)

# Terminal 1: Start Go Backend
cd server
go mod tidy
go run main.go

# Terminal 2: Start React Frontend
cd frontend
npm install
npm run dev

🌐 Access Dashboard: http://localhost:3001 πŸ”§ API Health: http://localhost:8080/health


πŸ”§ Environment Setup

Required API Keys

LunarCrush API Setup

  1. Sign up: LunarCrush Developers
  2. Subscribe: Choose any plan to generate API keys
  3. Generate Key: Visit API Authentication

Redis Cloud Setup

  1. Sign up: Redis Cloud
  2. Create Database: Choose free 30MB tier
  3. Get Connection: Copy host, port, and password

Inngest Setup

  1. Sign up: Inngest Cloud
  2. Create App: Get your Event Key and Signing Key
  3. Development: Use Inngest Dev Server for local development

Environment Configuration

# .env file
# Redis Cloud
REDIS_URL=redis://default:password@your-redis-host:port

# LunarCrush API
LUNARCRUSH_API_KEY=lc_your_api_key_here

# Inngest Configuration
INNGEST_EVENT_KEY=your_inngest_event_key
INNGEST_SIGNING_KEY=your_inngest_signing_key
INNGEST_DEV_URL=http://localhost:8080/api/inngest

# Application
PORT=8080
NODE_ENV=development

πŸ“Š API Documentation

Core Endpoints

Endpoint Method Description Response Time
/health GET System health check ~50ms
/api/crypto/data GET Complete analytics data ~3-5s
/dev/trigger POST Manual data refresh ~5-10s
/api/crypto/info GET Available metrics info ~50ms

Sample API Response

{
  "timestamp": "2025-06-26T15:30:00Z",
  "total_metrics": 11,
  "all_metrics": {
    "market_cap": {
      "name": "Market Cap",
      "success": true,
      "data_count": 10,
      "all_data": [
        {
          "name": "Bitcoin",
          "symbol": "BTC",
          "value": "$1,981,409,972,282"
        }
      ],
      "fetch_time_ms": 3247
    }
  },
  "fetch_stats": {
    "successful_fetches": 10,
    "failed_fetches": 1,
    "total_duration_ms": 12453
  }
}

πŸ—οΈ Project Structure

crypto-rankings/
β”œβ”€β”€ server/                      # Go Backend
β”‚   β”œβ”€β”€ main.go                 # API server with 11 metrics
β”‚   β”œβ”€β”€ go.mod                  # Go dependencies
β”‚   β”œβ”€β”€ go.sum                  # Dependency checksums
β”‚   └── .env                    # Environment variables
β”œβ”€β”€ frontend/                    # React Frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ app/                # Next.js app directory
β”‚   β”‚   β”‚   β”œβ”€β”€ page.tsx        # Main dashboard component
β”‚   β”‚   β”‚   β”œβ”€β”€ globals.css     # Soft, eye-friendly styling
β”‚   β”‚   β”‚   └── layout.tsx      # App layout
β”‚   β”‚   └── components/         # Reusable UI components
β”‚   β”œβ”€β”€ package.json            # Frontend dependencies
β”‚   └── tailwind.config.js      # Styling configuration
β”œβ”€β”€ .env.example               # Environment template
└── README.md                  # This file

πŸš€ Deployment Guide

Production Environment

Backend Deployment (Render)

The backend is deployed on Render's free tier:

  • URL: https://crypto-rankings.onrender.com
  • Cold Start: ~30-60 seconds after 15 minutes of inactivity
  • Performance: Fast once warmed up (3-5 second API responses)

Deployment Steps:

  1. Connect GitHub repository to Render
  2. Configure build settings:
    • Root Directory: server
    • Build Command: go build -o main ./main.go
    • Start Command: ./main
  3. Add environment variables in Render dashboard
  4. Deploy automatically on git push

Frontend Deployment (Vercel)

The frontend is deployed on Vercel:

  • URL: https://crypto-rankings.vercel.app/
  • Performance: Fast global CDN delivery
  • Auto-deploy: On git push to main branch

Deployment Steps:

  1. Connect GitHub repository to Vercel

  2. Configure build settings:

    • Framework: Next.js
    • Root Directory: frontend
    • Build Command: npm run build
  3. Add environment variables:

    NEXT_PUBLIC_API_URL=https://crypto-rankings.onrender.com
  4. Deploy automatically on git push


πŸ“ˆ Performance Metrics

Backend Performance

  • API Response Time: 3-5 seconds (with Redis cache hits: <100ms)
  • Memory Usage: ~50MB base + 10MB per 1000 requests
  • Throughput: 1000+ requests/second on modest hardware
  • Cold Start: 30-60 seconds (Render free tier limitation)

Cache Strategy

  • Redis TTL: 15 minutes for crypto data
  • Background Jobs: Inngest updates data every 5 minutes
  • Browser Cache: 5 minutes for API responses

πŸ§ͺ Testing & Quality Assurance

API Testing

# Health check
curl https://crypto-rankings.onrender.com/health

# Data endpoint (may take 30-60s on first request if sleeping)
curl https://crypto-rankings.onrender.com/api/crypto/data

# Manual trigger
curl -X POST https://crypto-rankings.onrender.com/dev/trigger

Local Development Testing

# Backend testing
cd server
go run main.go

# Frontend testing
cd frontend
npm run dev

# Test API endpoints
curl http://localhost:8080/health
curl http://localhost:8080/api/crypto/data

πŸ”§ Development Workflow

Local Development

# Start Redis (if running locally)
redis-server

# Backend development (with hot reload using Air)
cd server && air
# or server/main.go

# Frontend development
cd frontend && npm run dev

Code Quality

  • Go: gofmt, go vet, proper error handling
  • TypeScript: ESLint, Prettier, strict mode
  • Commit Hooks: Pre-commit formatting and linting

🌐 Deployment URLs

Live Application

GitHub Repository


πŸ“š Learning Resources

Technologies Used

Cloud Platforms

API References


⚠️ Production Notes

Render Free Tier Limitations

  • Sleep Mode: Service sleeps after 15 minutes of inactivity
  • Wake Time: 30-60 seconds to respond to first request
  • Bandwidth: 100GB/month
  • Build Time: 500 build minutes/month

For Production Use

Consider upgrading to:

  • Render Starter Plan: $7/month for always-on service
  • Alternative Platforms: Google Cloud Run, AWS Lambda, Fly.io

🀝 Contributing

Development Setup

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes and test thoroughly
  4. Commit with conventional commits: feat: add real-time updates
  5. Push and create a Pull Request

Code Standards

  • Go: Follow effective Go guidelines
  • TypeScript: Strict mode, explicit return types
  • Commits: Conventional commits format
  • Documentation: Update README for new features

πŸ™ Acknowledgments

  • LunarCrush - Real-time crypto social sentiment data
  • Inngest - Background job processing platform
  • Vercel - Frontend deployment and hosting
  • Render - Backend deployment platform
  • Redis Cloud - Managed Redis hosting

πŸ“„ License

MIT License - see LICENSE file for details.


πŸš€ Built with ❀️ for the modern web

⭐ Star this repo β€’ πŸ› Report Bug β€’ ✨ Request Feature


Demonstrates full-stack development, cloud architecture, real-time data processing, and modern UI/UX design.

About

πŸš€ High-performance cryptocurrency rankings dashboard with real-time social sentiment analysis. Built with Go + Inngest + Redis Cloud + React. Features background job processing, enterprise-grade caching, and professional UI.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors