Skip to content

HyperSafeD/chilly

Repository files navigation

🌢️ Chilly - Decentralized Order Tracking DApp

License: MIT Next.js TypeScript Solidity

Chilly is a comprehensive decentralized application (dApp) with smart contracts for on-chain order tracking and a modern Next.js frontend. Built with transparency, immutability, and Web3 integration.

πŸ“ Project Structure

chilly/
β”œβ”€β”€ contracts/              # Smart Contract Layer (Hardhat)
β”‚   β”œβ”€β”€ contracts/          # Solidity contracts
β”‚   β”œβ”€β”€ scripts/            # Deployment scripts
β”‚   β”œβ”€β”€ test/               # Contract tests
β”‚   └── README.md           # Contract documentation
β”‚
└── frontend/               # Frontend Layer (Next.js)
    β”œβ”€β”€ app/                # Next.js App Router pages
    β”‚   β”œβ”€β”€ dashboard/      # Dashboard & order management
    β”‚   β”œβ”€β”€ analytics/      # Analytics page
    β”‚   └── ...
    β”œβ”€β”€ components/         # React components
    β”œβ”€β”€ lib/                # Utilities & Web3 config
    └── public/             # Static assets

✨ Features

Smart Contract Features

  • πŸ“¦ Order Creation - Create immutable order records on-chain
  • πŸ”„ Status Updates - Track order lifecycle (Pending β†’ Confirmed β†’ Processing β†’ Shipped β†’ Delivered)
  • πŸ”— Tracking Numbers - Add and update shipping tracking information
  • πŸ“ Order History - Complete audit trail with timestamps and actors
  • ❌ Order Cancellation - Cancel orders before delivery with reason tracking
  • πŸ” Access Control - Only order participants can update orders
  • πŸ“Š Batch Operations - Efficient queries for multiple orders
  • πŸ”” Events - Real-time blockchain events for all state changes

Frontend Features

  • πŸ”— Web3 Integration - Reown AppKit with 300+ wallet support (MetaMask, WalletConnect, etc.)
  • πŸ“§ Email Login - Passwordless authentication without a wallet
  • 🌐 Social Logins - Google, X, GitHub, Discord, Apple
  • πŸ“¦ Order Tracking - Create, update, and monitor orders with full transparency
  • πŸ“Š Interactive Dashboard - Comprehensive dashboard with order statistics, filtering, and real-time updates
  • 🌍 Multi-chain Support - Ethereum Mainnet, Sepolia, Polygon, Arbitrum
  • 🎨 Modern UI - Beautiful, responsive interface with Tailwind CSS and dark mode
  • πŸ” Advanced Filtering - Filter by status, network, search across all fields
  • πŸ“ˆ Order Analytics - Analytics dashboard with charts and insights
  • πŸ“„ Order Details - Detailed view for each order with blockchain information
  • πŸ“€ Data Export - Export orders to JSON or CSV format
  • πŸ”— Block Explorer Integration - Direct links to view transactions on Etherscan
  • ⛓️ Smart Contract Integration - Fully functional Solidity contract for on-chain order management
  • πŸ’° Escrow System - Secure payment handling with automatic release on delivery
  • πŸ” Dispute Resolution - Built-in dispute mechanism for order conflicts

πŸš€ Getting Started

Prerequisites

  • Node.js 18.x or higher
  • npm, yarn, or pnpm
  • A Web3 wallet (MetaMask recommended) or email for login
  • Reown Project ID from cloud.reown.com
  • Private key (for contract deployment to testnets/mainnet)

1. Smart Contracts Setup

cd contracts
npm install

# Compile contracts
npm run compile

# Run tests
npm test

# Deploy to testnet
npm run deploy:sepolia

Note: Smart contract tests are written in TypeScript and cover constructor, order creation, and order confirmation functionality. See contracts/test.md for a comprehensive list of test coverage.

See contracts/README.md for detailed documentation.

2. Frontend Setup

cd frontend
npm install

Create .env.local in the frontend folder:

# Get your Project ID from https://cloud.reown.com
NEXT_PUBLIC_PROJECT_ID=your_project_id_here

# Contract addresses (after deployment)
NEXT_PUBLIC_CONTRACT_ADDRESS_SEPOLIA=deployed_contract_address
NEXT_PUBLIC_CONTRACT_ADDRESS_POLYGON=deployed_contract_address
NEXT_PUBLIC_CONTRACT_ADDRESS_ARBITRUM=deployed_contract_address

# Optional: Configure default network
NEXT_PUBLIC_CHAIN_ID=1

Note: Create a free account at Reown Cloud to get your Project ID.

Run the development server:

npm run dev

Open http://localhost:3000 and connect your wallet!

npm run dev
  1. Open http://localhost:3000 in your browser

  2. Connect your wallet using the connect button in the header

  3. Navigate to the Dashboard to start creating and managing orders

πŸ“– Usage

Dashboard

The dashboard is the main interface for managing orders:

  • View Orders: See all your orders in a grid layout with key information
  • Filter Orders: Filter by status (pending, confirmed, processing, shipped, delivered, cancelled, disputed) or network
  • Search: Search across order numbers, product names, and addresses
  • Create Orders: Click "Create Order" to add new orders to the blockchain
  • View Statistics: See real-time statistics about your orders

Order Statuses

  • Pending: Order created but not yet confirmed
  • Confirmed: Order confirmed by seller
  • Processing: Order being prepared
  • Shipped: Order has been shipped
  • Delivered: Order successfully delivered
  • Cancelled: Order cancelled
  • Disputed: Order under dispute

πŸ”§ Development

Available Scripts

  • npm run dev - Start development server
  • npm run build - Build for production
  • npm run start - Start production server
  • npm run lint - Run ESLint

Environment Variables

Frontend (.env.local):

  • NEXT_PUBLIC_PROJECT_ID - Your Reown AppKit Project ID from cloud.reown.com (Required)
  • NEXT_PUBLIC_CHAIN_ID - Default chain ID (Optional, default: 1 for Ethereum Mainnet)
  • NEXT_PUBLIC_RPC_URL - Custom RPC URL for blockchain interactions (Optional)

Smart Contracts (contracts/.env):

  • PRIVATE_KEY - Deployer private key (Required for deployment)
  • SEPOLIA_RPC_URL - Sepolia testnet RPC URL
  • MAINNET_RPC_URL - Mainnet RPC URL
  • ETHERSCAN_API_KEY - Etherscan API key for contract verification
  • See contracts/README.md for full configuration

πŸ› οΈ Tech Stack

  • Framework: Next.js 16 - React framework with App Router
  • Language: TypeScript - Type-safe JavaScript
  • Styling: Tailwind CSS v4 - Utility-first CSS framework with dark mode
  • Web3:
  • Smart Contracts:
    • Solidity ^0.8.20 - Smart contract language
    • Hardhat - Development environment for Ethereum
  • Utilities:

πŸ“ Project Structure

chilly/
β”œβ”€β”€ app/                        # Next.js App Router pages
β”‚   β”œβ”€β”€ dashboard/              # Dashboard pages
β”‚   β”‚   β”œβ”€β”€ orders/            # Order detail pages
β”‚   β”‚   β”‚   └── [id]/          # Dynamic order detail route
β”‚   β”‚   └── page.tsx           # Dashboard with order management
β”‚   β”œβ”€β”€ analytics/              # Analytics page
β”‚   β”‚   └── page.tsx           # Analytics dashboard
β”‚   β”œβ”€β”€ layout.tsx             # Root layout with Web3 provider
β”‚   β”œβ”€β”€ page.tsx               # Home/landing page
β”‚   └── globals.css            # Global styles
β”œβ”€β”€ components/                 # React components
β”‚   β”œβ”€β”€ dashboard/             # Dashboard-specific components
β”‚   β”‚   β”œβ”€β”€ OrderCard.tsx     # Individual order card component
β”‚   β”‚   β”œβ”€β”€ OrderList.tsx      # List of orders with loading states
β”‚   β”‚   β”œβ”€β”€ OrderFilters.tsx   # Filtering and search components
β”‚   β”‚   β”œβ”€β”€ OrderStats.tsx     # Statistics display component
β”‚   β”‚   β”œβ”€β”€ OrderStatusUpdate.tsx # Status update component
β”‚   β”‚   └── CreateOrderModal.tsx # Modal for creating new orders
β”‚   β”œβ”€β”€ Header.tsx             # Navigation header
β”‚   β”œβ”€β”€ Hero.tsx               # Hero section
β”‚   β”œβ”€β”€ Features.tsx           # Features showcase
β”‚   β”œβ”€β”€ HowItWorks.tsx         # How it works section
β”‚   β”œβ”€β”€ CTA.tsx                # Call to action
β”‚   └── Footer.tsx             # Footer component
β”œβ”€β”€ lib/                        # Utilities and configurations
β”‚   β”œβ”€β”€ types.ts               # TypeScript type definitions
β”‚   β”œβ”€β”€ web3.ts                # Web3 configuration (wagmi, Reown)
β”‚   β”œβ”€β”€ Web3Provider.tsx       # Web3 context provider
β”‚   β”œβ”€β”€ mockData.ts            # Mock data for development
β”‚   └── exportUtils.ts         # Export utilities (JSON, CSV)
β”œβ”€β”€ public/                     # Static assets
└── contracts/                  # Smart contracts
    β”œβ”€β”€ OrderTracking.sol      # Main order tracking contract
    β”œβ”€β”€ hardhat.config.js      # Hardhat configuration
    β”œβ”€β”€ scripts/               # Deployment scripts
    β”‚   └── deploy.js         # Contract deployment script
    └── README.md              # Contract documentation

🀝 Contributing

We welcome contributions! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ”— Links

πŸ‘₯ Maintainers

πŸ™ Acknowledgments

  • Built with ❀️ by the open-source community
  • Special thanks to all contributors

Made with Next.js and Web3 🌢️

About

dApp that brings transparency to product delivery by tracking orders on-chain. It ensures trust between buyers and sellers through verifiable, decentralized order records.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors