How meanmachine889/memora works
Project type and purpose
• This is a full-stack Web3 application (“Memora”) that lets content creators mint their courses as NFT-based memberships.
• Frontend: Next.js + React + TailwindCSS + Wagmi for wallet integration.
• Backend: Vercel Serverless Functions (Next API routes) + Prisma ORM + PostgreSQL (NeonDB).
• Blockchain layer: Solidity smart contracts (ERC-721) on Ethereum, interfaced via ethers.js.
• Off-chain storage: IPFS (via Pinata) for images and metadata.
Key components from the file structure
• /src/app – Next.js 13+ app directory with pages, layouts, global styles.
• /src/app/api – Serverless API routes for CRUD actions (add-address, add-ipfs, create-course, etc.).
• /src/components – UI primitives and composite React components (CourseCard, NFT dialogs, sidebar, forms).
• /ethereum/abi – ABI JSON files for MemNft and MemNftFactory contracts.
• prisma/ – Database schema and migration history.
• public/ – Static assets.
• config.ts, next.config.ts – Build/runtime configuration.
• package.json, tsconfig.json – Dependencies and TypeScript config.
Insights from README
• Users connect wallets via MetaMask → authenticate & sign transactions (wagmi).
• Courses minted: course metadata pushed to IPFS; smart contract minted on Ethereum; membership details persisted in PostgreSQL.
• Membership transfers preserve remaining duration and update on-chain & off-chain state.
• Deployment target: Vercel (serverless), NeonDB for Postgres, Pinata for IPFS.
Relationships and data flows
• User → Frontend: connect wallet, fill course info →
1. → API /create-course → off-chain DB record + deploys new MemNftFactory →
2. → Ethereum network: deploy contract
• User → Frontend: mint NFT →
1. → API /add-ipfs (upload images & metadata) → IPFS
2. → Frontend triggers ethers.js contract call → mint on-chain
3. → API /add-address (record recipient, expiration) → DB
• Transfer flow: user initiates from UI → smart contract transfer → webhook/event listener (could be polled by serverless) → update DB membership expiry
Architectural patterns & principles
• Separation of concerns: UI vs API vs blockchain vs storage
• Event-driven updates: on-chain events update off-chain DB
• Stateless serverless functions for scalability
• ORM (Prisma) for schema-first DB migrations
• Modular UI components for reusability
Detailed but not overly granular
• Aggregate internal React components under “Frontend UI” with a note on “CourseCard, Sidebar, Wallet Dialog, etc.”
• API routes under “Serverless Functions (Next.js API Routes)” listing key endpoints.
• Ethers.js inside frontend & serverless functions interacting with contract ABIs.
• Captures every major piece of the Memora platform
• Clearly shows on-chain vs off-chain boundaries
• Illustrates how user actions flow through the system
• Helps stakeholders and new engineers quickly comprehend the architecture