| name | web3-dapp-playbook |
| description | Playbook for building full-stack Web3 applications (Next.js, Solidity, Kubernetes). |
Web3 DApp Playbook
MẠNH. CONCISE. AUTHORITATIVE.
1. Architecture Map
flowchart TD
A["Next.js Frontend"] -->|RPC Call| B["Smart Contract (Solidity)"]
B -->|Emits Events| C["Indexer (The Graph/Squid)"]
C -->|GraphQL Query| A
D["Kubernetes"] -->|Deploys| A
D -->|Deploys| C
2. Core Directives
- Frontend: Next.js (App Router). Strict typing. Server components where possible.
- Contracts: Solidity. Foundry for testing. CI/CD requires 100% test coverage.
- Deployment: Kubernetes. Helm charts for deterministic state.
- Integration: No direct DB writes from frontend for on-chain state. Always read from indexer.
3. Unified Scaffold (Makefile)
.PHONY: build deploy-contracts deploy-k8s
build:
cd frontend && npm install && npm run build
cd contracts && forge build
cd indexer && npm install && npm run build
deploy-contracts:
cd contracts && forge script script/Deploy.s.sol --rpc-url $(RPC_URL) --broadcast
deploy-k8s:
kubectl apply -f k8s/namespace.yaml
kubectl apply -f k8s/frontend-deployment.yaml
kubectl apply -f k8s/indexer-deployment.yaml
kubectl rollout status deployment/frontend -n web3
Execute with precision. No deviations.