@ashqking/web3-avatar-forge
v0.1.0
Published
A developer-friendly playground for trait-based SVG avatars, AI-powered suggestions, and simulated NFT minting.
Maintainers
Readme
✨ Features
- 🎨 Avatar Builder UI: A clean, intuitive, and responsive interface for customizing avatars based on various traits.
- 🤖 AI-Powered Suggestions: Utilizes Genkit to connect to the Gemini API, providing creative avatar variations.
- 🔗 Web3 Integration: Seamless wallet connection using
wagmi, supporting MetaMask and other wallets. - 💾 Simulated Decentralized Storage: Includes a simulated flow to upload metadata to IPFS, preparing it for decentralized storage.
- 🖼️ Simulated NFT Minting: A complete, simulated end-to-end flow for minting the configured avatar as an ERC-721 NFT.
- 🚀 Developer Playground:
- Copy JSON: Instantly copy the avatar's trait configuration as a JSON object.
- Copy JSX: Copy a pre-formatted React
<AvatarViewer />component snippet to easily integrate the avatar.
🛠️ Tech Stack
🚀 Getting Started
Prerequisites
- Node.js (v18 or later)
- npm or yarn
- A Web3 wallet (e.g., MetaMask) configured for the Sepolia testnet.
Installation & Setup
Clone the repository:
git clone https://github.com/iamaanahmad/web3-avatar-forge.git cd web3-avatar-forgeInstall dependencies:
npm installRun the development server:
npm run devThe application will be available at
http://localhost:9002.Run the Genkit development server (in a separate terminal): This enables the AI suggestion functionality.
npm run genkit:watch
🧩 How to Integrate the Avatar into Your dApp
One of the key features of this project is the ability to easily reuse the generated avatars.
Using the "Copy JSX" Feature
- Customize your desired avatar in the Web3 Avatar Forge application.
- Click the "Copy JSX" button.
- This copies a React component snippet to your clipboard, which looks like this:
<AvatarViewer traits={{ "hair": "hair2", "eyes": "eyes3", "accessories": "acc1", "background": "bg4" }} /> - Paste this code into your React application. You will also need to copy over the
AvatarViewercomponent and its dependencies (/src/components/avatar-viewer.tsx,src/components/icons.tsx,/src/lib/constants.ts, and/src/lib/types.ts).
Example: Profile Card
Here's how you could use the copied JSX in a simple user profile card component:
// YourProfilePage.jsx
import { AvatarViewer } from './path/to/AvatarViewer';
const UserProfileCard = ({ userAddress, avatarTraits }) => {
return (
<div className="profile-card">
<div className="avatar-container">
{/* Paste the copied JSX here, using props */}
<AvatarViewer traits={avatarTraits} />
</div>
<h3>{userAddress}</h3>
{/* ...other profile info */}
</div>
);
};
export default UserProfileCard;🤝 Contributing
This project is open-source and we welcome contributions! Whether you're a developer, designer, or just have ideas, feel free to get involved.
- Report Bugs: If you find a bug, please open an issue.
- Suggest Features: Have an idea for a new feature or improvement? Open an issue to start a discussion.
- Submit Pull Requests: We're happy to review and merge pull requests that improve the project.
❤️ Contributors
A huge thanks to all the people who have contributed to this project.
