A Next.js starter kit with Sign-in With Ethereum + ethers.js + iron-session
Note: This is a barebones, fairly unopinionated implementation of Sign-in with Ethereum authentication that requires the MetaMask extension. It will not work without it. Additional wallets are not featured; however, you may use Web3Modal or other similar libraries to provide additional features.
First, install the dependencies:
npm i
# or
yarn add
Run the development server:
npm run dev
# or
yarn dev
Open http://localhost:3000 with your browser to see the result.
API routes can be accessed on:
- http://localhost:3000/api/nonce. This endpoint can be edited in
pages/api/nonce.js
. - http://localhost:3000/api/verify. This endpoint can be edited in
pages/api/verify.js
.
The pages/api
directory is mapped to /api/*
. Files in this directory are treated as API routes instead of React pages.
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.
To learn more about Sign-in with Ethereum take a look at the following resources:
- SIWE documentation - learn about SIWE implementation
- iron-session documentation - learn about iron-session
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.