Before you begin, you need to install the following tools:
- Node (>= v18.17)
- Yarn (v1 or v2+)
- Git
- Docker Engine
- Install dependencies
yarn install
- 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
- Run a local network in the first terminal:
yarn chain
- On a second terminal, deploy the contract:
yarn deploy
- On a third terminal, start your NextJS app:
yarn start
Visit your app on: http://localhost:3000
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 + runyarn 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
)
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