Skip to content

deriv-com/derivatives-trader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Derivatives Trader

A modern platform for derivatives trading with a modular, component-based architecture.

Prerequisite Prerequisite Coverage Status

Table of Contents

Getting Started

Prerequisites

Before working with this repository, ensure you have the following installed:

  • Node.js 18.x
  • npm 9.x
  • git (for contribution)

Installation

  1. Fork the project

    Fork the project to your own GitHub account to work on your own version.

  2. Clone the repository

    git clone git@github.com:deriv-com/deriv-app.git
    cd deriv-app
  3. Install dependencies

    npm run bootstrap
  4. Build all packages

    npm run build:all

Repository Structure

This project uses a monorepo structure managed with npm workspaces. All individual packages are located in the packages/ directory.

Packages

Package Description Documentation
Api API client for backend services Docs
Api-v2 Next generation API client Docs
Components Shared UI component library Docs
Core Core application framework Docs
Hooks Shared React hooks Docs
Reports Transaction and trading reports Docs
Shared Shared utilities and helpers Docs
Stores State management stores Docs
Trader Trading platform interface Docs
Translations Localization and translations Docs
Utils Utility functions Docs

Development Workflow

Package Names and Structure

Each package follows a consistent naming convention with the @deriv/ prefix. For example, the Components package is named @deriv/components.

When using scripts from the root directory, you don't need to include the @deriv/ prefix:

# This works:
npm run serve components

# Instead of:
npm run serve @deriv/components

Starting Development Servers

The Core package must be running to develop any other package:

Option 1: Working on Core only

npm run serve core

Option 2: Working on other packages

# Terminal 1 - Start the package you're working on
npm run serve api

# Terminal 2 - Start the core
npm run serve core

Specifying a page to open:

npm run serve core --open=trader

Common Development Tasks

Cleaning node_modules:

npm run clean

Clearing npm cache:

npm cache clean -f

Regenerating package-lock.json:

npm run bootstrap:dev

Building and Testing

All packages support these common scripts:

Command Description
start Runs tests, builds, and starts the dev server
serve Builds and starts the dev server
build:one <pkg> Builds a single package
build:all Builds all packages
test Runs eslint, stylelint and jest tests
test:jest Runs only jest tests
test:qa Runs e2e tests
test:performance Runs performance tests

Examples:

# Build a specific package
npm run build:one api

# Run tests for a specific package
npm run test:jest trader

Deployment

Test Deployments

Automatic Deployment (Recommended)

When creating a PR, Vercel automatically generates a preview link.

Manual Deployment

For manual deployments using GitHub Pages:

# Deploy to root of gh-pages branch
npm run deploy

# Clean and deploy to root
npm run deploy:clean

# Deploy to a subfolder
npm run deploy:folder br_test_folder

Release Process

There are three types of releases:

  1. Staging Release

    git tag staging_v20230723 -m 'release staging'
    git push origin staging_v20230723
  2. Production Release

    git tag production_v20230723 -m 'release production'
    git push origin production_v20230723
  3. NPM Package Release

    # First, ensure you have membership to @deriv npm organization
    # Bump package versions as needed
    npm run publish:p2p

Troubleshooting

Common Issues

  1. Installing packages

    # In package directory:
    cd packages/trader
    npm i package-name
    
    # Or with npm workspaces:
    npm i package-name --workspace=@deriv/trader
  2. Uninstalling packages

    npm uninstall package-name --workspace=@deriv/translations
  3. Using package-lock.json

    # Option 1:
    npm ci --workspace=@deriv/trader
    
    # Option 2:
    cd packages/trader && npm ci
  4. Node Sass issues

    # Try these in order:
    npm rebuild node-sass --workspaces
    
    # If that doesn't work:
    npm cache clean --force
    npm run clean
    npm run bootstrap

Additional Documentation

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 56