Skip to content

anand-106/Exness-clone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Exness Trading Platform Clone

React TypeScript Node.js Express.js PostgreSQL Redis

Introduction

This project is a cryptocurrency trading platform clone inspired by Exness. It allows users to simulate trading SOL, BTC, and ETH with real-time price updates, order management features, and candlestick charts. This platform is designed for educational purposes, strategy testing, and portfolio building.

Table of Contents

  1. Key Features
  2. Installation Guide
  3. Usage
  4. Environment Variables
  5. Project Structure
  6. Technologies Used
  7. License

Key Features

  • Real-time Price Updates: Uses WebSockets to receive live trade data for SOL, BTC, and ETH.
  • Order Management: Allows users to create, manage, and close buy/sell orders with configurable margin, leverage, stop loss, and take profit.
  • Candlestick Charts: Displays historical price data using candlestick charts with selectable time intervals (1m, 5m, 15m).
  • User Authentication: Implements JWT-based authentication for user signup and signin.
  • Asynchronous Order Processing: Uses Bull queue to process order-related events asynchronously.
  • Email Notifications: Sends email notifications for order events (open, close, liquidate).
  • Redis Integration: Uses Redis for real-time data distribution and caching.
  • Data Persistence: Trade data is stored in a PostgreSQL database.
  • Server-Sent Events: Order updates pushed to the client with Server-Sent Events (SSE).
  • Zustand State Management: Uses Zustand for a simple frontend state management.

Installation Guide

  1. Clone the repository:

    git clone <repository_url>
    cd <repository_directory>
  2. Install backend dependencies:

    cd backend
    npm install
    cd ../httpServer
    npm install
    cd ../Price-Websocket
    npm install
  3. Install frontend dependencies:

    cd frontend
    npm install
  4. Configure environment variables:

    Create .env files in the backend, httpServer, Price-Websocket and frontend directories based on the .env.example or similar files (if present). Set the following environment variables:

    • Backend/httpServer:
      • DATABASE_URL: PostgreSQL database connection URI.
      • REDIS_URL: Redis connection URI.
      • JWT_SECRET: Secret key for JWT authentication.
      • SENDGRID_API_KEY: API key for SendGrid email service.
      • FRONTEND_URL: The URL for the frontend, in order to allow CORS.
    • Price-Websocket:
      • No specific env vars.
    • Frontend:
      • VITE_BACKEND_URL: The URL for the backend api.
      • VITE_WEBSOCKET_URL: The URL for the price-websocket server.
  5. Run the PostgreSQL database:

    Ensure you have PostgreSQL installed and running. Create a database and configure the DATABASE_URL environment variable accordingly.

  6. Run Redis server:

    Ensure you have Redis installed and running. Configure the REDIS_URL environment variable.

  7. Run the backend servers:

    cd backend
    npm run dev # or npm start
    cd ../httpServer
    npm run dev # or npm start
    cd ../Price-Websocket
    npm run dev # or npm start
  8. Run the frontend:

    cd frontend
    npm run dev

Usage

  1. Access the platform: Open your browser and navigate to the address where the frontend is running (typically http://localhost:5173).

  2. Sign up/Sign in: Create a new user account or sign in with existing credentials.

  3. View real-time prices: The main trading interface displays real-time prices for SOL, BTC, and ETH.

  4. Place orders: Use the buy/sell order form to create new orders, specifying margin, leverage, stop loss, and take profit values.

  5. Manage orders: View and close open orders in the order management section.

  6. View candlestick charts: Analyze historical price data using the candlestick charts with selectable time intervals.

Environment Variables

  • DATABASE_URL: PostgreSQL database connection URI.
  • REDIS_URL: Redis connection URI.
  • JWT_SECRET: Secret key for JWT authentication.
  • SENDGRID_API_KEY: API key for SendGrid email service.
  • FRONTEND_URL: The URL for the frontend, in order to allow CORS.
  • VITE_BACKEND_URL: The URL for the backend API.
  • VITE_WEBSOCKET_URL: The URL for the price-websocket server.

Project Structure

/
├── Readme.md                 # This file
├── backend/                 # Backend server (Node.js/TypeScript)
│   ├── src/                # Backend source code
│   │   ├── index.ts           # Backend entry point
│   ├── package.json         # Backend dependencies and scripts
│   ├── tsconfig.json        # TypeScript configuration
│   └── nodemon.json         # Nodemon configuration
├── httpServer/              # HTTP server for API endpoints (Node.js/TypeScript)
│   ├── src/                # HttpServer source code
│   │   ├── server.ts          # HttpServer entry point
│   │   ├── jwt.ts             # JWT related code
│   │   ├── models/           # Data models
│   │   ├── utils/            # Utility functions
│   │   ├── services/          # Business Logic services
│   ├── package.json         # HttpServer dependencies and scripts
│   ├── tsconfig.json        # TypeScript configuration
├── Price-Websocket/           # Price WebSocket Server
│   ├── src/                # Price WebSocket source code
│   │   ├── server.ts          # Price WebSocket entry point
│   ├── package.json         # Price WebSocket dependencies and scripts
│   ├── tsconfig.json        # TypeScript configuration
├── frontend/                # Frontend application (React)
│   ├── src/                # Frontend source code
│   │   ├── components/       # React components
│   │   ├── assets/           # Static assets (images, etc.)
│   │   ├── App.jsx            # Main App Component
│   │   ├── main.jsx           # React entry point
│   │   ├── index.css          # Global CSS styles
│   │   ├── stores/          # Zustand stores
│   ├── package.json         # Frontend dependencies and scripts
│   ├── vite.config.js       # Vite configuration
│   ├── index.html           # HTML entry point

Technologies Used

React TypeScript Node.js Express.js PostgreSQL Redis JSON Web Tokens Axios Vite Zustand

License

MIT License License: MIT

About

Cryptocurrency trading platform clone inspired by Exness

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published