How xhakti/buymeabeer works
Main Components
• Frontend (buymebeerweb): This is the user interface built with Next.js. Include details such as:
• Pages (e.g., Home page, _app.jsx for global settings)
• Styling and static assets from /styles and /public directories.
• Configuration via next.config.js.
• Smart Contract / Blockchain Layer (buymeabeer):
• Solidity contracts found under the /contracts folder.
• Configuration and deployment scripts (hardhat.config.js) that govern the blockchain interactions.
• Blockchain Network: Represent the Ethereum (or similar) blockchain that hosts the deployed smart contract.
Relationships and Interactions
• Users interact with the Frontend (via a browser).
• The Frontend communicates with the smart contract by invoking functions through Thirdweb’s libraries.
• On executing a transaction (e.g., “buying a beer”), the request moves from the Next.js UI to the smart contract deployed on the blockchain.
• Wallet integration (signing transactions) should be noted under the Frontend component, showing users connect their crypto wallets (e.g., MetaMask).
Architectural Patterns and Design Principles
• Separation of Concerns: Clear boundary between UI (Next.js app) and business logic / transaction handling (smart contract).
• Decentralization: Highlight that the smart contract provides transparency and security as it runs on a decentralized blockchain.
• Integration Layer: The use of Thirdweb abstracts much of the complexity of interacting with the blockchain, so include that in the communication path between frontend and blockchain.
• Configuration Elements: Include notes on configuration files like hardhat.config.js (blockchain deployment) and next.config.js (frontend setup).