How axyl1410/edunft-network works
Project Type and Purpose
• This is a full-stack, monorepo application for a blockchain-based education certification platform (EduNFT Network).
• It follows a microservices-style architecture within a single repo, with separate Next.js frontends for student, school, enterprise, and homepage, a NestJS REST+WebSocket API, a Hardhat smart-contract service, and shared component/config packages.
File Structure and Map to Logical Components
• apps/api → NestJS backend service
• Controllers (REST endpoints)
• Services (business logic, MongoDB via Mongoose, JWT auth, Socket.io gateways)
• Blockchain module (wraps ThirdWeb SDK or raw RPC calls)
• apps/student, apps/school, apps/enterprise, apps/homepage → Four Next.js frontends
• Each runs on its own port
• Uses shared UI components (packages/ui) and shared hooks/utilities
• Interacts with the backend via REST and WebSocket, and directly with Web3 (ThirdWeb SDK)
• apps/hardhat → Smart-contract compilation, testing, deployment to FORMASKETCHPAD
• packages/ui, packages/eslint-config, packages/typescript-config → Shared libraries and configs
README Insights
• Microservices architecture: distinct UI apps, a monolithic API, and a blockchain service
• Key technologies: Next.js, NestJS, MongoDB, Solidity (Hardhat), ThirdWeb, Socket.io
• System Architecture section already calls out: Frontends ↔ API ↔ Database & Blockchain
Main Components
• Student Portal (Next.js)
• School Portal (Next.js)
• Enterprise Portal (Next.js)
• Marketing/Landing Page (Next.js)
• NestJS REST controllers
• WebSocket Gateways (Socket.io)
• Authentication/Authorization module (JWT, role-based guards)
• Blockchain integration module (ThirdWeb SDK wrapper)
c. Data Layer:
• MongoDB (hosted instance)
• Mongoose ODM
d. Blockchain Layer:
• FORMA_SKETCHPAD network
• Smart Contracts (ERC-721 QuestionReward, certificate NFTs) deployed via Hardhat
e. Shared Packages:
• UI component library (packages/ui)
• ESLint & TypeScript config libraries
Relationships and Data Flows
• Browsers → Frontends: User interacts, submits forms, triggers wallet connections
• Frontends → API REST endpoints: HTTP POST/GET for user data, files, questions, events, collections
• Frontends ↔ API via WebSocket: Real-time updates (notifications, chat messages, event registration)
• Frontends → Blockchain: ThirdWeb client calls for minting, buying, selling NFTs
• API → Database: Read/write user profiles, metadata, events, question/Q&A histories
• API → Blockchain: Reads on-chain state, writes transactions via ThirdWeb or native RPC
• Hardhat scripts → Blockchain: Contract deployment, testing, migration
Architectural Patterns and Principles
• Separation of Concerns: Each portal is its own Next.js app; backend modules organize by feature
• Modularization: Shared packages for UI and config, promoting DRY across apps
• Layered Architecture: Presentation (Next.js) → API (NestJS controllers/services) → Persistence/Contract
• Event-Driven/Real-Time: Socket.io gateways for push updates
• Micro-Frontends within Monorepo: Logical isolation, independent deployment ports