A modern platform for derivatives trading with a modular, component-based architecture.
- Getting Started
- Repository Structure
- Development Workflow
- Building and Testing
- Deployment
- Troubleshooting
- Additional Documentation
Before working with this repository, ensure you have the following installed:
- Node.js 18.x
- npm 9.x
- git (for contribution)
-
Fork the project
Fork the project to your own GitHub account to work on your own version.
-
Clone the repository
git clone git@github.com:deriv-com/deriv-app.git cd deriv-app
-
Install dependencies
npm run bootstrap
-
Build all packages
npm run build:all
This project uses a monorepo structure managed with npm workspaces. All individual packages are located in the packages/
directory.
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
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
Cleaning node_modules:
npm run clean
Clearing npm cache:
npm cache clean -f
Regenerating package-lock.json:
npm run bootstrap:dev
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
When creating a PR, Vercel automatically generates a preview link.
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
There are three types of releases:
-
Staging Release
git tag staging_v20230723 -m 'release staging' git push origin staging_v20230723
-
Production Release
git tag production_v20230723 -m 'release production' git push origin production_v20230723
-
NPM Package Release
# First, ensure you have membership to @deriv npm organization # Bump package versions as needed npm run publish:p2p
-
Installing packages
# In package directory: cd packages/trader npm i package-name # Or with npm workspaces: npm i package-name --workspace=@deriv/trader
-
Uninstalling packages
npm uninstall package-name --workspace=@deriv/translations
-
Using package-lock.json
# Option 1: npm ci --workspace=@deriv/trader # Option 2: cd packages/trader && npm ci
-
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
- Stylesheet Guidelines - CSS/SASS code style
- JavaScript Guidelines - JS/JSX code style
- TypeScript Guidelines - TS/TSX code style
- Git Workflow - Git practices and processes
- Dependency Management - Working with dependencies