Proof of Drink Protocol Web Client
This is a Next.js project bootstrapped with create-next-app.
First, create a .env.local file and set the variables:
cp .env.local.example .env.localThen run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun devOpen http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.
This project uses next/font to automatically optimize and load Inter, a custom Google Font.
For testing locally, you can set up a local database instance with docker:
- Run docker
- Run
bun db:upto start the database - Run
bun generateto generate the schemas from drizzle ORM for migrations - Run
bun migrateto apply the migrations
Now you have a local postgres database instance running on localhost:5432. To use in the app, set the DATABASE_URL environment variable to postgresql://user:password@localhost:5432/pod?sslmode=disable.
The scripts/upload.ts file contains a script to upload claim codes to the database. It expects a merkle tree json file that is created by OpenZeppelin's @openzeppelin/merkle-tree package. These JSON files are stored in the /scripts/codes directory with the name format merkle-tree-{tokenId}.json. To run the script, use the following command:
bun uploadAnd then you can view the codes in the database with the following command:
bun view-codesOnce these are uploaded, you can start claiming in the app locally.
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.