Page cover image

Run locally

How to locally run the frontend + backend

As the public website is limited in its ability to process all orderbook requests and update them dynamically, anyone can clone and launch the interface and adapt it to their needs.

By default, the orderbook.wtf user interface simulates between 20 and 40 points on each side. A real orderbook would require 10x or 100x more simulations. So let's deploy locally.

By customising the backend, you can run your own unlimited orderbook simulations and use your own solver to customise the algorithm behind it.

You can start by cloning the repository here.

The repository has a NextJS frontend and a Rust backend API.

The application is designed to be modular and can be launched effortlessly using docker compose.

The repo has the sdk and the frontend part as a submodule, so to clone it, do :

git clone --recurse-submodules https://github.com/0xMerso/tycho-orderbook-web web
cd web

It's important to have the following tree structure

tree -L 1
├── back
├── docker-compose.yaml
├── front
├── sdk
└── update.sh

If you prefer, step by step.

# Make sure you've cloned the 2 submodules
cd web
git pull --recurse-submodules
git submodule update --remote --recursive


# Optionally
cd sdk ; git pull origin main
cd front ; git pull origin main

Docker Setup Instructions

Make sure Docker is installed and active. You can launch the whole stack with one shell script.

sh launch.sh

Or, step by step.

cp -n back/.env.ex back/.env # Duplicate .env.ex to .env, if not already existing

docker network create tycho
# Start with UI
docker compose up --build -d --profiles ui
# Start without UI if you just need the API & Terminal logs
docker compose up --build -d

# Logs
docker compose logs -f
# Stop it
docker compose stop
# Remove it
docker compose down
# Restart it
docker compose restart

You can then access the UI at http://localhost:3000/

The swagger at http://localhost:42042/swagger

You can also use an SSH tunnel to view it from your local machine if you're running the docker compose on a remote server.

ssh -i ~/.ssh/id_rsa -L 3000:localhost:3000 user@ip

Local Setup Instructions

If you prefer to build and run the application directly, we provide shell scripts for simple startup. You will need to install Rust, Node, Redis.

git clone --recurse-submodules https://github.com/0xMerso/tycho-orderbook-web web
cd back
# Launch 'ethereum' Axum API + Redis. You can use 'base' instead
sh ops/local.api.start.sh ethereum
# Tests
sh ops/local.api.test.sh ethereum
cd front/front
pnpm install
pnpm dev

Last updated

Was this helpful?