A simple full-stack demo showing how to implement MetaMask authentication in a web application. This project demonstrates how to connect a dApp to the Ethereum blockchain, verify wallet ownership, and log users in securely without traditional credentials.
The repository has two main parts:
From the root of the repo:
yarn install # Install root dependencies
cd backend && yarn install # Install backend dependencies
cd ../frontend && yarn install # Install frontend dependencies
cd .. # Return to rootRun both frontend and backend together:
yarn start-
Backend → runs at http://localhost:8000
-
Frontend → runs at http://localhost:3000
You can also start each service individually:
# Start backend
cd backend
yarn start
# Start frontend
cd frontend
yarn start-
🔒 Secure wallet-based authentication using MetaMask
-
🌐 Full-stack setup with Next.js and Express.js
-
🛠️ Easy to run locally with yarn start
sequenceDiagram
participant U as User (Browser + MetaMask)
participant F as Frontend (Next.js)
participant B as Backend (Express API)
U->>F: Open dApp (login page)
F->>U: Request wallet connection
U->>MetaMask: Sign message with private key
MetaMask->>F: Return signed message
F->>B: Send signed message + wallet address
B->>B: Verify signature & generate auth token
B->>F: Return success + session token
F->>U: User logged in (authenticated)
-
Ensure you have MetaMask installed in your browser before testing.
-
This project is intended as a learning/demo app and can be extended into production-ready Web3 applications.
