Introduction
This is the RFQ API codebase. Today, it powers:
- Gasless Products:
- Tx Relay
- Zero/g
- RFQm
- RFQt
Services
There are a number of services that can be run from this folder:
# run tx-relay and zero/g API
yarn dev:service:gasless_swap
# run our workers - shared across all of our gasless services
yarn dev:service:rfqm_workers
Getting started
Pre-requirements
Developing
-
Clone the repo.
-
Create an
.envfile and copy the content from the.env_examplefile. Defaults are defined inconfig.ts/config.js. The bash environment takes precedence over the.envfile. If you runsource .env, changes to the.envfile will have no effect until you unset the colliding variables. -
Install the dependencies:
yarn -
Build the project:
yarn build -
Run
docker compose upto run the other dependencies required for the API. This uses the localdocker-compose.ymlfile. -
Run the database migrations:
yarn db:migrate
-
Start the API
yarn startFor development:
yarn dev
Architecture
Our infrastructure relies on the following:
- An EVM based chain with 0x v4 deployed, preferably fully-featured
- Postgres
- SQS
- Redis
All of these infrastructural dependencies can be run locally and will be spun up via docker compose up
For a more detailed overview of our architecture, refer to: https://www.notion.so/zeroex/Tx-Relay-Architecture-51fb5b7f21b9435694de7b37e82cbe08?pvs=4
Deployment
Use the GitHub Action
Database
This project uses TypeORM. It makes it easier for anyone to switch out the backing database used by this project. By default, this project uses a PostgreSQL database.
To add a migration, you may use the following command (prefer PascalCase):
yarn db:migration:create -n MyMigration