How axyl1410/generative-hub-app works
Main Components
• Frontend (Client)
• Built with Next.js using the new App router and written in TypeScript.
• Integrates Thirdweb for wallet connection, uses Tailwind CSS, Shadcn for UI, and Framer Motion for animations.
• Contains pages for creating, minting, exploring, buying, selling NFTs as well as i18n support.
• Backend (Server)
• Built in TypeScript with Node.js.
• Uses Express-style API routing and controllers, middleware, models, and services to handle business logic.
• Manages endpoints for NFT operations including collection management, user authentication (using JWT), smart contract deployment, etc.
• Smart Contracts & Blockchain Integration
• The backend includes a "contracts" directory and uses Hardhat (as seen in hardhat.config.js) to compile and deploy smart contracts.
• Artifacts and deployment scripts indicate integration with Ethereum-based systems and the Forma NFTs Protocol.
• Databases & External Services
• Two databases are used: MongoDB (for likely document storage) and MySQL (for structured data).
• External integration with Forma technology to optimize smart contract interactions (lower gas fees, improved security).
Relationships and Interactions
• The Frontend communicates with the Backend via API routes (REST/Next.js API routes, as seen in both frontend and backend “api” directories).
• The Backend API uses controllers (e.g., collectionController.js, nftController.js, userController.js) and services to handle business logic.
• The Backend interacts with multiple databases for persisting NFT collections, user data, transactions, etc.
• The Backend also orchestrates blockchain operations via scripts (deploy.js, deployCollection.js) and smart contract integration facilitated by Hardhat and contract artifacts.
• Thirdweb integration in the frontend handles wallet connections, while onchain operations (and possibly zero-knowledge proofs as mentioned in the README) provide secure and decentralized processing of NFT metadata.
Architectural Patterns and Principles
• MVC Pattern: Notice the separation into controllers, routes, and models on the backend.
• Layered Architecture: Clear separation between the presentation layer (frontend), business logic (backend services/controllers), and data layer (databases + smart contracts).
• API-driven Development: Both frontend and backend use API routes for communication.
• Integration with external services: Thirdweb for blockchain wallet connectivity and Forma for smart contract optimization.
Relevant Technologies and Libraries
• Frontend: Next.js, React, TypeScript, Tailwind CSS, Shadcn UI, Framer Motion, Thirdweb.
• Backend: Node.js, Express-like API router, JWT authentication, MongoDB, MySQL.
• Blockchain Tools: Hardhat, OpenZeppelin contracts (as seen in the artifacts), deployed contract details.
• Others: Axios (for HTTP requests), utility libraries and custom hooks in the frontend, and various configuration files to manage different environments.
Instructing Details
• From the Frontend to the Backend to represent API calls.
• From the Backend to the Databases indicating data persistence.
• From the Backend to the Smart Contract layer (and vice versa for blockchain events/transactions).
• API/backend services (rectangles),