A complete vendor management system built on the Internet Computer Protocol (ICP) with a Next.js frontend and Motoko backend.
- Frontend: Next.js application with ICP integration
- Backend: Motoko canister with complete business logic
- Deployment: Unified DFX configuration for seamless deployment
-
DFX CLI (DFINITY SDK)
curl -fsSL https://internetcomputer.org/install.sh | sh -
Node.js (v18 or higher)
# Download from https://nodejs.org/ -
Git (for cloning the repository)
-
Clone and setup
git clone <repository-url> cd Vendor
-
Run development setup
./dev-setup.sh
-
Start frontend development
cd frontend npm run dev -
Access the application
- Frontend: http://localhost:3000
- Backend Candid UI: http://127.0.0.1:4943/?canisterId=
./deploy.sh local./deploy.sh icVendor/
βββ dfx.json # Unified DFX configuration
βββ deploy.sh # Production deployment script
βββ dev-setup.sh # Development setup script
βββ frontend/ # Next.js frontend application
β βββ app/ # Next.js app router pages
β βββ components/ # React components
β βββ utils/ # ICP integration utilities
β β βββ icp-api.ts # ICP service layer
β β βββ icp-auth.ts # ICP authentication
β β βββ icp-config.ts # ICP configuration
β β βββ icp-service.ts # ICP canister interface
β βββ package.json # Frontend dependencies
β βββ next.config.ts # Next.js configuration
βββ backend/ # Motoko backend
βββ main.mo # Main canister actor
βββ models/ # Data models
βββ utils/ # Utility modules
βββ Documentation.md # Backend API documentation
The application automatically configures itself based on the deployment environment:
- Local Development: Uses local DFX replica
- Mainnet: Uses Internet Computer mainnet
Key environment variables (auto-generated):
NEXT_PUBLIC_DFX_NETWORK=local|ic
NEXT_PUBLIC_VENDOR_BACKEND_CANISTER_ID=<canister-id>
CANISTER_ID_VENDOR_BACKEND=<canister-id>The dfx.json file configures both frontend and backend canisters:
- vendor_backend: Motoko canister with business logic
- vendor_frontend: Asset canister hosting the Next.js app
- Complete ICP Integration: No Django API dependencies
- Web3 Authentication: Principal-based user authentication
- Real-time Updates: Direct canister communication
- Responsive Design: Mobile-friendly interface
- Modern UI: Built with React and Tailwind CSS
- Complete Business Logic: Full vendor management system
- User Management: Registration, authentication, roles
- Company Management: Multi-tenant architecture
- Product Catalog: Inventory with tax compliance
- Order Processing: Complete order lifecycle
- Financial Management: Invoicing and payments
- Analytics: Dashboard statistics and reports
Detailed backend API documentation is available in backend/Documentation.md.
- Authentication:
register(),login(),logout() - Company Management:
createCompany(),getCompanies() - Product Management:
createProduct(),getProducts() - Order Management:
createOrder(),getOrders() - Invoice Management:
createInvoice(),getInvoices()
- Run
./dev-setup.shto initialize the local environment - Start frontend development with
cd frontend && npm run dev - Backend changes require
dfx deploy vendor_backend - Frontend automatically connects to local canister
# Test backend canister
dfx canister call vendor_backend health '()'
# View canister logs
dfx canister logs vendor_backend
# Check canister status
dfx canister status vendor_backend# Deploy to local replica (testing)
./deploy.sh local
# Deploy to mainnet (production)
./deploy.sh ic-
DFX replica not starting
dfx killall dfx start --clean --background
-
Frontend build errors
cd frontend npm run clean npm ci npm run export
-
Canister deployment fails
dfx canister stop --all dfx start --clean --background dfx deploy
- Use
dfx generateto update Candid types after backend changes - Check
.envfile for correct canister IDs - Use browser developer tools to debug ICP calls
- Monitor cycles balance for mainnet deployments
- Complete conversion from Django API to ICP services
- Profile management via ICP
- Accounting dashboard with ICP backend
- Customer/retailer management
- Invoice creation and viewing
- Stock management system
- Complete Django model migration
- Full API endpoint coverage
- Authentication and authorization
- Business logic preservation
- Tax compliance features
- Multi-tenant architecture
- Unified DFX configuration
- Automated deployment scripts
- Environment auto-configuration
- Production optimizations
After deployment, your application will be available at:
- Frontend:
http://<frontend-canister-id>.localhost:4943 - Backend:
http://127.0.0.1:4943/?canisterId=<backend-canister-id>
- Frontend:
https://<frontend-canister-id>.icp0.io - Backend:
https://<backend-canister-id>.ic0.app
For deployment issues or questions:
- Check the troubleshooting section above
- Review the backend documentation
- Use
dfx --helpfor DFX CLI assistance - Check ICP documentation at https://internetcomputer.org/docs
π Your Vendor application is now fully ICP-enabled and ready for Web3 deployment!