Files

1.7 KiB

offchain

API to access DAO information, proposals, comments, temperature checks, and SIWE authentication.

Prerequisites

  • Install bun

    curl -fsSL https://bun.sh/install | bash
    
  • Install PostgreSQL

Setup

Database

[macOS] Start the database

brew services start postgresql@16

Configure postgresql in PATH (if you are using zsh shell)

echo 'export PATH="/opt/homebrew/opt/postgresql@16/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

Create a database

createdb dao

The API depends on data from ponder. In order to speed up development, seed the database from the backup file in data repo release. Download the file and save it to packages/offchain/database/db.sql.

Restore the database from the backup file

bash scripts/database/restore.sh

OPTIONAL: See ponder to run it locally. Not required to run the API if you use the restored database.

Environment Variables

Add your RPC URLs and database URL to .env. Leave DATABASE_URL blank to use the local database.

cp example.env .env

Install Dependencies

bun install

Running

bun run dev

API

see live API docs

Websocket

Local testing: Connect to ws://localhost:81/ws