How streamfi-x/streamfi-community works
Project type and purpose
• This is a decentralized Web3 “community layer” frontend built in Next.js (React), focused on enabling social interactions, DAO governance, user forums, leaderboards, billing/rewards, and profile/settings pages.
• It has no custom backend; instead it leverages client-side calls (via Wagmi/RainbowKit) to smart contracts on Ethereum/Polygon (or other EVM chains).
File structure
• Top-level:
• next.config.mjs, tsconfig.json, ESLint/Tailwind configs – Next.js+TypeScript setup
• public/fonts + global CSS → static assets
• src/app/… → Next.js 13 App Router pages (billing, forums, leaderboard, profile, settings, weekly-highlights)
• src/components/ui → ShadCN UI primitives (button, input, dialog, dropdown, etc.)
• src/components/navbar.tsx → main navigation
• src/lib/utils.ts → shared helper functions
• No /api directory or backend code—app is purely frontend + on-chain interactions.
Key architectural patterns & technologies (from README)
• Next.js 13 App Router → server components + client components
• Tailwind CSS + ShadCN UI for styling & reusable UI primitives
• Wagmi + Zustand for on-chain state management
• RainbowKit/Web3Modal for wallet connection
• Solidity smart contracts deployed to Ethereum/Polygon (interfaced via RPC providers like Infura/Alchemy)
Main components
a. Users & Browsers
b. Next.js Application (hosted on Vercel/Netlify or similar)
• Server-Side Rendering layer (App Router server components)
• Client components (React + Zustand state)
• UI Component Library (ShadCN primitives + Tailwind)
• Page modules: Billing, Forums, Leaderboard, Profile, Settings, Weekly Highlights
c. Wallet Connector (RainbowKit/Web3Modal)
d. On-chain Integration (Wagmi hooks → RPC Provider)
e. Blockchain Networks (Ethereum, Polygon, other EVM)
f. Smart Contracts (DAO voting, rewards, forums storage)
g. External RPC Providers (Infura, Alchemy)
Relationships and data flow
• Browsers load pages from Next.js server (SSR or static).
• Client-side React code initializes wallet connection via RainbowKit → user wallet.
• Wagmi/Zustand manage user session and on-chain state.
• When user interacts (vote, post, claim reward), Wagmi sends transactions to RPC provider → blockchain → smart contracts.
• Smart contracts emit events; front-end can listen (via Wagmi/Providers).
Architectural patterns & design principles
• Separation of concerns: Server Components vs. Client Components
• UI primitives encapsulated in a design system (ShadCN + Tailwind)
• Unidirectional data flow: React state → Wagmi calls → blockchain → event listeners → update state
• Stateless server hosting; state lives in wallets, contracts, and client stores