Skip to main content

Don't have an API key yet?

Sign-up to Moralis to get your free API key and start building today.

Get Your Free API Key
Version: 2.2

Building a DexScreener Clone

Learn how to create a comprehensive cryptocurrency terminal application with React, featuring real-time token data, price charts, transaction history, and portfolio tracking. This tutorial demonstrates how to build a modern crypto dashboard similar to DexScreener using Moralis APIs.

Prerequisites

  • Basic knowledge of React
  • Familiarity with Web3 concepts
  • Moralis account
  • Node.js installed on your computer

Video Tutorial

📺 Watch the step-by-step tutorial on YouTube

Features

  • 📈 Trending Tokens - Track the most popular tokens across multiple blockchains
  • 🔍 Token Details - In-depth information about any token including price charts and transactions
  • 💼 Portfolio Tracking - Monitor your crypto holdings in one place
  • 🚀 Pump.fun Integration - Discover new tokens from the Pump.fun ecosystem with our Pump Fun API
  • 🔎 Advanced Search - Find tokens by name, symbol, or contract address
  • ⛓️ Multi-Chain Support - Data from Ethereum, BSC, Polygon, Solana, and more

Tech Stack

  • React - Frontend library
  • React Router - Navigation and routing
  • Tailwind CSS - Styling and UI components
  • Chart.js - Data visualization
  • Moralis API - Blockchain data provider

Project Structure

src/
├── components/ # Reusable UI components
│ ├── layout/ # Layout components (sidebar, topbar)
│ ├── token/ # Token-specific components
│ ├── trending/ # Trending page components
│ ├── portfolio/ # Portfolio tracking components
│ └── modals/ # Modal components (search, filters)
├── pages/ # Page components
├── services/ # API services and utilities
├── App.js # Main application component
└── index.js # Application entry point

Moralis APIs Used

This project leverages several Moralis APIs to fetch blockchain data:

Token Data APIs

FeatureAPI EndpointDescriptionMoralis Docs Link
Trending TokensGET /tokens/trendingGets trending tokens across all supported chainsAPI Docs
Token SearchGET /tokens/searchSearches for tokens based on user queriesAPI Docs
Token Metadata (EVM)GET /erc20/metadataFetches metadata for tokens (name, symbol, decimals)API Docs
Token Metadata (Solana)GET /token/mainnet/{tokenAddress}/metadataRetrieves token metadata on SolanaAPI Docs

Pair/Liquidity Pool APIs

FeatureAPI EndpointDescriptionMoralis Docs Link
Token Pairs (EVM)GET /erc20/{tokenAddress}/pairsGets trading pairs for a specific tokenAPI Docs
Token Pairs (Solana)GET /token/mainnet/{tokenAddress}/pairsGets trading pairs for a Solana tokenAPI Docs
Pair Stats (EVM)GET /pairs/{pairAddress}/statsRetrieves stats for a trading pair (price, volume)API Docs
Pair Stats (Solana)GET /token/mainnet/pairs/{pairAddress}/statsGets stats for a Solana trading pairAPI Docs
Pair Swaps (EVM)GET /pairs/{pairAddress}/swapsGets transaction history for a trading pairAPI Docs
Pair Swaps (Solana)GET /token/mainnet/pairs/{pairAddress}/swapsGets Solana pair transaction historyAPI Docs
Pair Snipers (EVM)GET /pairs/{pairAddress}/snipersIdentifies early buyers/snipers of a tokenAPI Docs
Pair Snipers (Solana)GET /token/mainnet/pairs/{pairAddress}/snipersIdentifies Solana token snipersAPI Docs

Token Holder APIs

FeatureAPI EndpointDescriptionMoralis Docs Link
Token HoldersGET /erc20/{tokenAddress}/holdersLists token holders and their balancesAPI Docs
Token Holder StatsGET /erc20/{tokenAddress}/holder-statsProvides analytics about token holdersAPI Docs

Wallet/Portfolio APIs

FeatureAPI EndpointDescriptionMoralis Docs Link
Wallet Net WorthGET /wallets/{address}/net-worthCalculates total value of a wallet across chainsEVM API
Wallet TokensGET /wallets/{address}/tokensLists all tokens held by a specific walletEVM API

Token Discovery/Filtering API

FeatureAPI EndpointDescriptionMoralis Docs Link
Token FilteringGET /filtered-tokensFinds tokens based on complex filtering criteriaAPI Docs

Pump.fun (Solana) APIs

FeatureAPI EndpointDescriptionMoralis Docs Link
Pump.fun New TokensGET /token/mainnet/exchange/pumpfun/newGets newly created tokens on Pump.funAPI Docs
Pump.fun Bonding TokensGET /token/mainnet/exchange/pumpfun/bondingGets tokens in the bonding phase on Pump.funAPI Docs
Pump.fun Graduated TokensGET /token/mainnet/exchange/pumpfun/graduatedGets tokens that have graduated on Pump.funAPI Docs

Chart Widget

FeatureSourceDescriptionMoralis Docs Link
Moralis Chart Widgethttps://moralis.com/static/embed/chart.jsEmbeds interactive price charts for tokensWidget Docs

Supported Blockchains

The application supports multiple blockchains with the following chain IDs:

ChainChain IDExplorer
Ethereum0x1Etherscan
BSC0x38BscScan
Polygon0x89PolygonScan
Arbitrum0xa4b1Arbiscan
Optimism0xaOptimistic Etherscan
Base0x2105BaseScan
Avalanche0xa86aSnowtrace
SolanasolanaSolscan
Fantom0xfaFTMScan
Pulse0x171PulseScan
Ronin0x7e4Ronin Explorer

Getting Started

Prerequisites

  • Node.js (v14 or later)
  • npm or yarn
  • Moralis API key (Get one here)

Installation

  1. Clone the repository:

    git clone https://github.com/bharathbabu-moralis/dexscreener-clone.git
    cd dexscreener-clone
  2. Install dependencies:

    npm install
  3. Create a .env file in the root directory and add your Moralis API key:

    REACT_APP_MORALIS_API_KEY=your_api_key_here
  4. Start the development server:

    npm start
  5. Open http://localhost:3000 to view the application in your browser.

Styling

The application uses Tailwind CSS with custom variables for consistent theming:

:root {
--color-bg-primary: #0e1118;
--color-bg-secondary: #141722;
--color-bg-tertiary: #1e2330;
--color-bg-highlight: #252b3b;
--color-text-primary: #fff;
--color-text-secondary: #8a94a8;
--color-text-tertiary: #636d83;
--color-border: #2c3344;
--color-green: #16c784;
--color-red: #ea3943;
--color-blue: #4878ff;
}