How viveksurti-dev/nft-marketplace works
Project type and purpose
• This is a full-stack web application: an NFT Marketplace built in PHP with a MySQL backend.
• It provides user account management, NFT minting and trading, wallet transactions, admin controls, and email notifications.
File structure
• Top-level directories indicate major components:
• Account/ – user profile, login, password reset
• Admin/ – admin panel, content and user management
• Collection/ – NFT collection creation and editing
• Trans/ – wallet and transaction flows (buy, sell, transfer, add/withdraw funds)
• Assets/ – static assets (images, videos, CSS, JS)
• ajaxValidation/ – server-side validation endpoints
• Functions/ – reusable PHP functions (CRUD, role updates)
• mailpage/ – email templates and sending logic via PHPMailer
• PhonePe/ – payment gateway integration scripts
• Database File/ – SQL schema and seed scripts
Other files like config.php, composer.json, and core pages (index.php, login.php, register.php) sit at the root.
README insights
• Confirms PHP + MySQL stack, Composer packages, PHPMailer, Bootstrap for frontend.
• Highlights feature modules: authentication, minting, marketplace, wallet, admin dashboard.
• Mentions email flows (password reset) and external SMTP.
Main components
a. Frontend (browser)
• Static assets: HTML/CSS/JS (Bootstrap), AJAX calls to validation endpoints.
• UI modules: landing page, account pages, collection pages, transaction pages, admin dashboard.
b. Backend (web server / PHP)
• Router/core pages: index.php, account controllers, collection controllers, transaction controllers, admin controllers.
• Reusable functions (Functions/), validation endpoints (ajaxValidation/), payment handlers (PhonePe/).
• Email service module (mailpage/) using PHPMailer.
c. Database (MySQL)
• Core tables: users, wallets, nft_collections, nfts, transactions, admin_logs, password_resets.
• SQL scripts under Database File/.
d. External services
• SMTP server (for email notifications).
• Payment gateway (PhonePe API).
• Composer-installed libraries.
Relationships and data flows
• User interacts with the browser → front-end pages → sends HTTP requests to PHP controllers.
• Controllers read/write from MySQL via config.php connection.
• AJAX validation → PHP scripts under ajaxValidation/.
• NFT minting → Inserts new records in nft_collections & nfts tables.
• Marketplace purchase → Transaction flow in Trans/ → updates wallet balance and transaction history.
• Admin actions → Admin/ pages → manipulate user, FAQs, ads, articles in the database.
• Email flows → Triggered within controllers → mailpage/ sends via SMTP.
• Payment gateway → PhonePe scripts call external API, then callback to paymentStatus.php.
Architectural patterns and principles
• Modular directory structure – loosely resembles MVC:
• “Views”: .php pages output HTML mixed with PHP includes (Navbar.php, footer.php).
• “Controllers”: core pages under Account/, Collection/, Trans/, Admin/.
• “Models”: implicit in reusable functions (Functions/) and direct DB access in controllers.
• Separation of concerns: assets, validation, mailing, payment, database schemas each in their own directory.
• Stateful session management for authentication.
• Composer for dependency management.