How subkash2206/flowmint works
Project Type and Purpose
• This is a full-stack Web3 application (“FlowMint MVP”) that lets creators tokenize future revenue as NFTs and investors buy fractions of that revenue.
• It consists of three main codebases:
• A Next.js/TypeScript/Tailwind CSS frontend ("flowmint-frontend")
• A FastAPI/Python backend with SQLAlchemy and SQLite ("flowmint-backend")
• A Solidity smart-contract layer with Hardhat/OpenZeppelin ("flowmint-contracts")
File-Structure Analysis
• Top-level folders:
• flowmint-frontend: Next.js “App Router,” React components, contexts, hooks, ABI JSONs for on-chain calls.
• flowmint-backend: main.py, database.py, models.py, route modules (users, projects), requirements.txt.
• flowmint-contracts: Hardhat config, contracts/, deploy & test scripts.
• Patterns:
• Frontend uses Context API for auth and notifications, Wagmi+Viem libraries for blockchain.
• Backend follows MVC-style: Pydantic models, SQLAlchemy ORM, FastAPI route modules.
• Smart contracts are modular, tested with Hardhat.
README Insights
• Frontend Tech: Next.js15, TypeScript, Tailwind, Wagmi, Viem.
• Backend Tech: FastAPI, SQLAlchemy, SQLite (PostgreSQL in prod), JWT, Pydantic.
• Smart Contracts: Solidity, OpenZeppelin, Hardhat, deployed on Polygon.
• External dependencies: MetaMask, CORS, demo data fixtures, CI/CD targets (Vercel, Heroku).
Main Components
a. Client Layer (Browser)
• Next.js React App
• MetaMask wallet extension
• Wagmi/Viem hooks for blockchain calls
b. API Layer
• FastAPI server
• JWT auth & CORS middleware
• Route modules: /api/users, /api/projects, /api/investments, /api/creator/dashboard, /api/investor/dashboard
c. Data Layer
• SQLite (dev) / PostgreSQL (prod)
• SQLAlchemy ORM & Pydantic models (Users, Projects, Investments)
d. Smart-Contract Layer
• Deployed Solidity contracts (RevenueDistributor, FlowMintNFT, IERC20) on Polygon testnet
• Hardhat scripts (deploy.js) and tests
e. External Services
• MetaMask/Ethereum RPC (e.g., Infura or Alchemy endpoint)
• Vercel/Netlify (frontend hosting)
• Railway/Heroku (backend hosting)
Component Relationships & Data Flow
• Browser ←HTTP→ FastAPI (user management, project data, dashboards)
• Browser ←Web3 RPC→ Polygon node via MetaMask (mint NFTs, invest, revenue distribution)
• FastAPI ←DB queries→ SQLite/PostgreSQL
• CI/CD pipelines push frontend to Vercel, backend to Railway, contracts via Hardhat to Polygon
Architectural Patterns & Design Principles
• Clear separation of concerns: UI vs. business logic vs. persistence vs. blockchain
• Layered architecture: Presentation → API → Data
• Component-based UI, RESTful API, ORM abstraction
• Contract abstraction with ABIs, Dev/Prod environment parity via Hardhat/Infura