Plan complete decentralized application architectures covering frontend frameworks, wallet integration, smart contract interaction, indexing, and backend infrastructure.
You are a Web3 full-stack architect who has built production dApps serving millions of users. Design a complete dApp architecture for the following application. Application Details: App Type: [DEFI DASHBOARD/NFT MARKETPLACE/DAO TOOL/SOCIAL PLATFORM/GAMING] Target Chains: [ETHEREUM/POLYGON/ARBITRUM/MULTI-CHAIN] Expected Users: [DAILY ACTIVE USERS TARGET] Real-Time Requirements: [YES/NO - SPECIFY FEATURES] Mobile Support: [WEB ONLY/RESPONSIVE/NATIVE MOBILE] Team Size: [NUMBER OF DEVELOPERS] Section 1 - Frontend Architecture and Framework Selection: Recommend the frontend framework and justify the choice between React with Next.js, Vue with Nuxt, or other options for Web3 applications. Define the state management strategy for handling both on-chain and off-chain state. Specify the component architecture including reusable Web3 components for wallet connection, transaction status, token approvals, and network switching. Design the data fetching layer that combines blockchain reads, subgraph queries, and API calls efficiently. Address server-side rendering considerations for SEO and initial load performance. Section 2 - Wallet Integration and Authentication: Design the wallet connection flow supporting major wallets including MetaMask, WalletConnect, Coinbase Wallet, and hardware wallets. Implement Sign-In with Ethereum for authenticated sessions that bridge Web3 identity with traditional backend auth. Define the multi-chain wallet experience including network detection, automatic switching prompts, and chain-specific feature gating. Create the transaction signing UX including clear transaction previews, gas estimation display, and error handling for rejected or failed transactions. Address mobile wallet deep linking and WalletConnect v2 integration. Section 3 - Smart Contract Interaction Layer: Define the contract interaction architecture using libraries such as ethers.js, viem, or wagmi. Implement type-safe contract calls with auto-generated TypeScript types from ABIs. Design the transaction lifecycle management including pending state tracking, confirmation waiting, receipt parsing, and event monitoring. Create a batching strategy for read calls using multicall contracts. Specify the error handling approach for contract reverts with user-friendly error message mapping. Section 4 - Data Indexing and Query Strategy: Design the indexing architecture using The Graph subgraphs, custom indexers, or hybrid approaches. Define the subgraph schema for the primary entities and relationships. Specify real-time data strategies including WebSocket subscriptions, polling intervals, and optimistic UI updates. Plan for indexer latency by showing pending states and providing manual refresh options. Address cross-chain data aggregation if the application operates on multiple networks. Section 5 - Backend Infrastructure and Off-Chain Services: Define the backend services needed beyond smart contracts including user profiles, notifications, analytics, and metadata storage. Design the API layer that combines on-chain and off-chain data for frontend consumption. Specify the caching strategy for blockchain data including block-based invalidation. Plan the infrastructure for IPFS or Arweave content pinning if the application uses decentralized storage. Define the monitoring and alerting stack for tracking contract events, gas prices, and service health. Section 6 - Testing, Deployment, and DevOps: Create the testing strategy covering unit tests for contract interactions, integration tests with forked mainnets, and end-to-end tests with wallet simulation. Define the deployment pipeline for both smart contracts and frontend applications. Specify environment management for local development, testnet staging, and production. Design the feature flag system for gradual rollouts of new contract integrations. Include the monitoring dashboard requirements for tracking user transactions, error rates, and protocol metrics.
Or press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[DAILY ACTIVE USERS TARGET][NUMBER OF DEVELOPERS]