ENSNode Development and Contributions
This guide covers running ENSNode locally for development and contributions.
Prerequisites
Section titled “Prerequisites”- Git
- Postgres 17
- Node.js
- pnpm
- Run
npm install -g pnpm
or see other installation options.
- Run
Prepare Workspace
Section titled “Prepare Workspace”Clone this repository:
git clone git@github.com:namehash/ensnode.gitcd ensnode
Install Dependencies
Section titled “Install Dependencies”pnpm install
Running ENSNode
Section titled “Running ENSNode”ENSNode is a suite of services, and some depend on others. Refer to the docker-compose.yml
at the root of the monorepo for a full spec on the relationship between services.
1. Running Postgres
Section titled “1. Running Postgres”Ensure Postgres in the background, providing its connection details to ENSIndexer via DATABASE_URL
.
2. Running ENSRainbow
Section titled “2. Running ENSRainbow”To run ENSRainbow in development, the rainbow table data dir must be available. Follow instructions in the ENSRainbow Contribution Guide to set up your local environment.
# from monorepo rootpnpm run -F @ensnode/ensrainbow serve
# or from apps/ensrainbowpnpm run serve
3. Running ENSIndexer
Section titled “3. Running ENSIndexer”Follow instructions in the ENSIndexer Contribution Guide to set up your local environment.
# from monorepo rootpnpm run -F ensindexer dev
# or from apps/ensindexerpnpm run dev
4. Running ENSAdmin
Section titled “4. Running ENSAdmin”cd apps/ensadmincp .env.local.example .env.local
# from monorepo rootpnpm run -F ensadmin dev
# or from apps/ensadminpnpm run dev
ENSAdmins’s .env.local
should be placed at apps/ensadmin/.env.local
, not at the monorepo root.
Using Docker Compose
Section titled “Using Docker Compose”You can use Docker Compose to set up the ENSNode suite, along with its dependencies.
Re-building Docker containers is slow and inefficient, and doesn’t lend itself to rapid development. The first half of this guide showed how to run ENSNode on your host machine, for faster iteration and maximum control. The Docker Compose spec is helpful for describing the suite of services and running them in a structured way, which we’ll discuss below.
Prerequisites
Section titled “Prerequisites”Before you can use Docker Compose, ensure you have the following installed on your machine:
Building the Docker Images
Section titled “Building the Docker Images”Before running docker compose
the images must be build with the latest changes: see the Building Docker Images guide.
If you make changes in the application code and wish to run those updates, you must build the relevant Docker container again.
Running the Applications
Section titled “Running the Applications”Run the built images with:
docker compose up -d
- ENSIndexer: Available at http://localhost:42069
- ENSRainbow: Available at http://localhost:3223
- ENSAdmin: Available at http://localhost:4173
- PostgreSQL: Available on port
5432
Stopping the Applications
Section titled “Stopping the Applications”To stop the running applications, you can press Ctrl + C
in the terminal where Docker Compose is running. If you want to remove the containers and networks created by Docker Compose, you can run:
docker compose down
docker compoe down
will not delete the Postgres data volume defined here, as it is a named volume. To fully delete the Postgres data volume and start from scratch, use docker compose down -v
.