|
1 |
| -# Template for Orderly SDK v2 based on Remix |
| 1 | +# Orderly Broker UI Template |
2 | 2 |
|
3 |
| -## Getting started |
| 3 | +This template provides a quick way to set up a customized trading UI for Orderly Network brokers, built with Remix and deployable on GitHub Pages. |
4 | 4 |
|
5 |
| -1. Clone the code: |
| 5 | +## Quick Start |
| 6 | + |
| 7 | +1. **Fork the Repository** |
| 8 | + |
| 9 | + Fork this repository to your GitHub account to create your broker's UI. |
| 10 | + |
| 11 | +2. **Clone Your Fork** |
6 | 12 |
|
7 | 13 | ```sh
|
8 |
| -git clone https://github.com/OrderlyNetwork/orderly-js-sdk-remix-template.git |
9 |
| -cd orderly-js-sdk-remix-template |
| 14 | +git clone https://github.com/YOUR_USERNAME/broker-template.git |
| 15 | +cd broker-template |
10 | 16 | ```
|
11 | 17 |
|
12 |
| -2. Install the dependencies |
| 18 | +3. **Install Dependencies** |
13 | 19 |
|
14 | 20 | ```sh
|
15 |
| -npm install |
| 21 | +yarn install |
16 | 22 | ```
|
17 | 23 |
|
18 |
| -3. Development |
| 24 | +## Configuration Steps |
| 25 | + |
| 26 | +### 1. Broker Configuration |
19 | 27 |
|
20 |
| -Run the dev server: |
| 28 | +Edit the `.env` file to set up your broker details: |
21 | 29 |
|
22 |
| -```shellscript |
23 |
| -npm run dev |
| 30 | +```env |
| 31 | +VITE_ORDERLY_BROKER_ID=your_broker_id |
| 32 | +VITE_ORDERLY_BROKER_NAME=Your Broker Name |
| 33 | +VITE_ORDERLY_NETWORK_ID=mainnet # or testnet for testing |
24 | 34 | ```
|
25 | 35 |
|
26 |
| -4. Deployment |
| 36 | +### 2. Theme Customization |
27 | 37 |
|
28 |
| -First, build your app for production: |
| 38 | +1. Visit the [Orderly Storybook Trading Page](https://storybook.orderly.network/?path=/story/package-trading-tradingpage--page) |
| 39 | +2. Customize your preferred theme using the controls |
| 40 | +3. Export the generated CSS |
| 41 | +4. Replace the contents of `app/styles/theme.css` with your exported CSS |
29 | 42 |
|
30 |
| -```sh |
31 |
| -npm run build |
32 |
| -``` |
| 43 | +### 3. UI Configuration |
33 | 44 |
|
34 |
| -Then run the app in production mode: |
| 45 | +Edit `app/utils/config.tsx` to customize your UI: |
35 | 46 |
|
36 |
| -```sh |
37 |
| -npm start |
38 |
| -``` |
| 47 | +- **Footer Links**: Update `footerProps` with your social media links |
| 48 | +- **Logos**: Replace the main and secondary logos in the `appIcons` section |
| 49 | +- **PnL Sharing**: Customize the PnL poster backgrounds and colors in `sharePnLConfig` |
| 50 | + |
| 51 | +Required assets: |
| 52 | +- Place your logos in the `public` directory: |
| 53 | + - Main logo: `public/orderly-logo.svg` |
| 54 | + - Secondary logo: `public/orderly-logo-secondary.svg` |
| 55 | + - Favicon: `public/favicon.png` |
| 56 | +- PnL sharing backgrounds: `public/pnl/poster_bg_[1-4].png` |
| 57 | + |
| 58 | +## Development |
39 | 59 |
|
40 |
| -5. Create docker image |
| 60 | +Run the development server: |
41 | 61 |
|
42 | 62 | ```sh
|
43 |
| -docker build -t orderly-js-sdk-remix-template . |
| 63 | +yarn dev |
44 | 64 | ```
|
45 | 65 |
|
46 |
| -## Docs |
| 66 | +## Deployment |
47 | 67 |
|
48 |
| -For more information, please visit the following link: |
| 68 | +1. Build the application: |
| 69 | + |
| 70 | +```sh |
| 71 | +yarn build |
| 72 | +``` |
49 | 73 |
|
50 |
| -- [Orderly JS SDK](https://github.com/OrderlyNetwork/js-sdk) |
51 |
| -- [SDK documentation](https://orderly.network/docs/sdks) |
| 74 | +2. Base URL Configuration: |
| 75 | + |
| 76 | +The base URL configuration depends on your deployment method: |
| 77 | + |
| 78 | +- **For GitHub Pages subdirectory deployment** (`https://your-username.github.io/broker-template/`): |
| 79 | + Keep the basename configuration in `vite.config.ts`: |
| 80 | + ```typescript |
| 81 | + // vite.config.ts |
| 82 | + remix({ |
| 83 | + basename: "/your-repo-name", // Change this to match your repository name |
| 84 | + // ... other options |
| 85 | + }) |
| 86 | + ``` |
| 87 | + |
| 88 | +- **For custom domain deployment** (`https://your-domain.com`): |
| 89 | + Remove the basename configuration in `vite.config.ts`: |
| 90 | + ```typescript |
| 91 | + // vite.config.ts |
| 92 | + remix({ |
| 93 | + // basename: "/your-repo-name", // Remove or comment out this line |
| 94 | + // ... other options |
| 95 | + }) |
| 96 | + ``` |
| 97 | + |
| 98 | +3. Deploy to GitHub Pages: |
| 99 | + - Enable GitHub Pages in your repository settings |
| 100 | + - Set the build and deployment source to branch (not GitHub Actions) |
| 101 | + - Select the branch you want to deploy (typically `gh-pages` or `main`) |
| 102 | + - For custom domain setup, follow the [GitHub Pages custom domain configuration guide](https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site) |
| 103 | + |
| 104 | +## Additional Resources |
| 105 | + |
| 106 | +- [Orderly JS SDK Documentation](https://github.com/OrderlyNetwork/js-sdk) |
| 107 | +- [Orderly Network Documentation](https://orderly.network/docs/sdks) |
| 108 | +- [Storybook Theme Editor](https://storybook.orderly.network/?path=/story/package-trading-tradingpage--page) |
52 | 109 |
|
0 commit comments