Build & Deploy Decentralized (Web3) Social Media DApp | Solidity, Next.js, Hardhat, Wagmi Tutorial (Full Stack Web3 Project)
A beautiful, feature-rich decentralized social media platform built with Next.js, Tailwind CSS, and integrated with your Solidity smart contract. Users can create profiles, share posts with media, follow each other, join groups, and send messages - all stored on the blockchain.
Kindly follow the following Instructions to run the project in your system and install the necessary requirements
Learn how to build and deploy a fully functional Blockchain Social Media DApp using Solidity, Next.js, Hardhat, and Wagmi! In this complete Web3 full-stack tutorial, you'll create a decentralized platform where users can create posts, like, comment, and connect their walletsβall on-chain.
π§ What You'll Learn:
- Smart contract development with Solidity & Hardhat
- Connecting your DApp with Wagmi hooks and Ethers.js
- Building a modern React/Next.js frontend
- Storing posts on the blockchain
- Connecting and authenticating with MetaMask
- Deploying your smart contracts to Ethereum testnets
- Hosting your Web3 app on Vercel or Netlify
π Whether you're a beginner or intermediate blockchain developer, this project will level up your skills in decentralized social apps and Web3 UI/UX design.
#Web3 #BlockchainDapp #Solidity #Nextjs #Wagmi #Hardhat #Crypto #SocialMediaDapp #Ethereum #BuildInPublic #DecentralizedApps
- User Profiles: Create and manage blockchain-based user profiles
- Posts & Media: Share text, images, and videos via IPFS
- Social Interactions: Like, comment, follow/unfollow users
- Groups: Create and join community groups (admin only)
- Direct Messaging: Send private messages between users
- Admin Panel: Complete contract management for administrators
- Responsive Design: Beautiful Facebook-like UI that works on all devices
- IPFS Integration: Decentralized media storage via Pinata
- Frontend: Next.js 13, React 18, Tailwind CSS
- Blockchain: Ethereum/Holesky Testnet, Ethers.js
- Wallet Integration: RainbowKit, Wagmi
- Storage: Pinata IPFS
- Styling: Tailwind CSS with custom components
- Icons: React Icons
- Notifications: React Hot Toast
Before you begin, ensure you have:
- A wallet (MetaMask recommended)
- Pinata account for IPFS storage
- WalletConnect Project ID
- Your deployed smart contract address
PROJECT: ADVANCE SOCIAL MEDIA DAPP
Code: https://www.theblockchaincoders.com/sourceCode/build-social-media-website-using-html-css-javascript
VIDEO: https://youtu.be/U2tFXrwHDQ0?si=nlo7CpbbFidFzce4
WATCH: Hostinger
Get : Discount 75%
URL: https://www.hostg.xyz/aff_c?offer_id=6&aff_id=139422
PROJECT: MULTI-CURRENCY ICO DAPP
Code: https://www.theblockchaincoders.com/sourceCode/multi-currency-ico-dapp-using-next.js-solidity-and-wagmi
VIDEO: https://youtu.be/j8NO8ea5zVo?si=jCmvfXmpmefwjhO5
GET: VsCode Editor
URL: https://code.visualstudio.com/download
NodeJs: v18.17.1 / LATEST
NPM: 8.19.2
URL: https://nodejs.org/en/download
Video: https://youtu.be/PIR0oBVowXU?si=9eNdR29u37F2ujJJ
SETUP VIDEO: https://youtu.be/2MZZ4MDlKh8?si=s037n78lvBXAYVvs
URL: https://www.theblockchaincoders.com/sourceCode/build-and-deploy-decentralized-(web3)-social-media-dapp-or-solidity-next.js-hardhat-wagmi-tutorial-(full-stack-web3-project)
All you need to follow the complete project and follow the instructions which are explained in the tutorial by Daulat
If you download the final source code then you can follow the following instructions to run the Dapp successfully
OPEN: PINATA.CLOUD
URL:https://pinata.cloud/
OPEN: WALLET CONNECT
URL: https://docs.reown.com/cloud/relay
OPEN: GOOGLE API KEY
URL: ## GOOGLE API KEY: https://aistudio.google.com/app/apikey
OPEN: FORMSPREE
URL: https://formspree.io/
OPEN: ALCHEMY.COM
URL: https://www.alchemy.com/
# Install dependencies
npm install
# or
yarn install
Create a .env.local
file in the root directory:
# Wallet Connect & Blockchain Configuration
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=your_wallet_connect_project_id
NEXT_PUBLIC_RPC_URL=https://ethereum-holesky-rpc.publicnode.com
NEXT_PUBLIC_CHAIN_ID=17000
NEXT_PUBLIC_CHAIN_NAME=Holesky Testnet
NEXT_PUBLIC_CHAIN_SYMBOL=ETH
NEXT_PUBLIC_BLOCK_EXPLORER=https://holesky.etherscan.io
NEXT_PUBLIC_PLATFORM_NAME=SocialDApp
# Smart Contract Configuration
NEXT_PUBLIC_CONTRACT_ADDRESS=your_deployed_contract_address
# Pinata IPFS Configuration
NEXT_PUBLIC_PINATA_API_KEY=your_pinata_api_key
NEXT_PUBLIC_PINATA_SECRET_API_KEY=your_pinata_secret_api_key
NEXT_PUBLIC_PINATA_JWT=your_pinata_jwt_token
NEXT_PUBLIC_PINATA_GATEWAY=https://gateway.pinata.cloud
- Visit WalletConnect Cloud
- Create a new project
- Copy your Project ID
- Visit Pinata
- Create an account and navigate to API Keys
- Generate new API keys
- Copy API Key, Secret, and JWT token
- Replace
your_deployed_contract_address
with your actual contract address - Ensure the ABI in
lib/contractABI.js
matches your deployed contract - Update chain configuration if using a different network
npm run dev
# or
yarn dev
Visit http://localhost:3000
to see your application.
npm run build
npm start
# or
yarn build
yarn start
βββ components/
β βββ Layout/
β β βββ Layout.js # Main layout wrapper
β β βββ Header.js # Navigation header
β β βββ Sidebar.js # Sidebar navigation
β βββ Posts/
β β βββ CreatePost.js # Post creation component
β β βββ PostCard.js # Individual post display
β βββ Groups/
β β βββ CreateGroupModal.js # Group creation modal
β βββ UI/
β βββ LoadingSpinner.js # Reusable loading component
βββ contexts/
β βββ UserProfileContext.js # User profile context
βββ lib/
β βββ config.js # Wagmi configuration
β βββ constants.js # App constants
β βββ contractABI.js # Smart contract ABI
β βββ contract.js # Contract service layer
β βββ pinata.js # IPFS service layer
βββ pages/
β βββ _app.js # Next.js app wrapper
β βββ index.js # Home page
β βββ users.js # Users discovery page
β βββ groups.js # Groups page
β βββ admin.js # Admin panel
β βββ profile/
β βββ setup.js # Profile setup page
βββ styles/
βββ globals.css # Global styles
- Connect Wallet - Use the connect button in the header
- Setup Profile - Create your username (one-time setup)
- Create Posts - Share text, images, or videos
- Social Features - Like, comment, follow other users
- Join Groups - Participate in community groups
- Direct Messages - Send private messages
- Access Admin Panel - Available at
/admin
for contract owner - Monitor Stats - View total users, posts, groups
- Contract Controls - Pause/unpause contract functionality
- Emergency Functions - Withdraw funds, deactivate groups
- Modify
tailwind.config.js
for theme customization - Update
styles/globals.css
for global style changes - Component-specific styles are in individual component files
- Add new pages in the
pages/
directory - Extend contract service in
lib/contract.js
- Add new UI components in
components/
- All sensitive data is stored on-chain or IPFS
- Private keys never leave the user's wallet
- Admin functions are restricted to contract owner
- Input validation on all user interactions
-
Wallet Connection Issues
- Ensure correct network is selected
- Check RPC URL in environment variables
-
IPFS Upload Failures
- Verify Pinata API keys
- Check file size limits (10MB default)
-
Transaction Failures
- Ensure sufficient gas fees
- Check if contract is paused
-
Profile Not Loading
- Confirm contract address is correct
- Verify user has created a profile
The frontend integrates with all major contract functions:
- Profile Management:
createProfile
,getProfile
- Posts:
createPost
,likePost
,addComment
,editPost
,deletePost
- Social:
followUser
,unfollowUser
,checkIsFollowing
- Groups:
createGroup
,joinGroup
,sendGroupMessage
- Messaging:
sendDirectMessage
,getDirectMessages
- Admin:
pause
,unpause
,emergencyWithdraw
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues:
- Check this README for common solutions
- Ensure all environment variables are set correctly
- Verify your smart contract is deployed and accessible
- Check browser console for error messages
- Connect your GitHub repository to Vercel
- Add environment variables in Vercel dashboard
- Deploy automatically on every push
The app can be deployed on any platform that supports Next.js:
- Netlify
- AWS Amplify
- Heroku
- DigitalOcean App Platform
Happy Building! π
Your decentralized social media platform is ready to launch. Users can now create profiles, share content, and build communities entirely on the blockchain!