This project demonstrates how to build a decentralized social media dApp using Hardhat for smart contract development, React for the frontend, and TailwindCSS for styling. The dApp leverages blockchain technology to ensure the authenticity and immutability of user posts.
- Node.js and npm (or yarn) installed
- A Metamask wallet or similar Ethereum wallet
- An Ethereum network provider (e.g., Infura, Alchemy)
Demo: DSocial Website
-
Clone the repository:
git clone https://github.com/mishraji874/DSocial.git
-
Navigate to the project directory:
cd DSocial
-
Install dependencies:
yarn
-
Install all the dependencies in the client folder:
yarn
- Create a
.env
file at the root of the project. - Add your Ethereum network provider URL and other necessary environment variables:
RPC_URL=<YOUR-SEPOLIA-RPC-URL> PRIVATE_KEY=<YOUR-PRIVATE-KEY> ETHERSCAN_API_KEY=<YOUR-ETHERSCAN-API-KEY>
-
Deploy the contract on the Sepolia Chain:
npx hardhat ignition deploy ./ignition/modules/deploy.js --network sepolia
-
Start the development server:
cd client yarn start
The dApp will be accessible at http://localhost:3000.
- Smart Contract: The smart contract deployed on the blockchain handles user registration, post creation, and interactions (likes, comments).
- Frontend (React): The React frontend interacts with the smart contract using Ethers.js to create and manage user accounts, post content, and view the feed.
- Data Storage: User data and post content can be stored on-chain or off-chain (e.g., IPFS) depending on your requirements.
- TailwindCSS: Provides a utility-first CSS framework for styling the user interface.
- Customize the frontend and backend to suit your specific requirements.
- Consider implementing additional features like user profiles, private messaging, or content moderation.
- Ensure proper error handling and user experience throughout the application.