Skip to content

BuidlGuidl/ens-pg

Repository files navigation

ENS PG

Requirements

Before you begin, you need to install the following tools:

Development Quickstart

  1. Install dependencies
yarn install
  1. Spin up the Postgres database service + create database + seed
docker-compose up -d
yarn drizzle-kit push
yarn seed

See more info about the database in the section below

  1. Run a local network in the first terminal:
yarn chain
  1. On a second terminal, deploy the contract:
yarn deploy
  1. On a third terminal, start your NextJS app:
yarn start

Visit your app on: http://localhost:3000

Database (dev info)

We are using Drizzle with Postgres. You can run drizzle-kit from the root with yarn drizzle-kit

To iterate on the database:

  • Tweak the schema in schema.ts
  • Run yarn drizzle-kit push to apply the changes.
  • Tweak seed.js if needed + run yarn seed (will delete existing data)
  • You can explore the database with yarn drizzle-kit studio

After the initial iterations, we can start using migrations (yarn drizzle-kit generate & yarn drizzle-kit migrate)

Ponder info

After deploying contract on testnet/mainnet update packages/ponder/ponder.config.ts with respective network, contract address and startBlock.

To run ponder dev server:

yarn ponder:dev