ParkChain is a decentralized application (dApp) for managing parking spots using blockchain technology. It features tokenization of parking spaces, automated reservations, immutable history tracking, and automatic payment processing.
- π« Smart Contracts (Solidity): ERC721-based parking spot tokenization with reservation and payment management
- βοΈ Backend (Node.js/TypeScript): RESTful API for parking management and QR code generation
- π¨ Frontend (React + Tailwind CSS): Modern, responsive UI for booking and managing parking spots
- π± QR Code Generator: Generate unique QR codes for parking tokens and reservations
- π Automated Deployment: GitHub Actions workflow for CI/CD
- π Immutable History: All transactions recorded on blockchain
- π° Automatic Payments: Smart contract-based payment processing
parkchain/
βββ contracts/ # Solidity smart contracts
β βββ ParkingToken.sol # ERC721 token for parking spots
β βββ ParkingReservation.sol # Reservation management
β βββ PaymentProcessor.sol # Payment handling
βββ backend/ # Node.js backend server
β βββ server.ts # Express server
β βββ routes/ # API routes
β βββ parking.ts # Parking management endpoints
β βββ qr.ts # QR code generation
βββ frontend/ # React frontend
β βββ src/
β βββ components/ # React components
β βββ pages/ # Page components
β βββ utils/ # Utility functions
βββ scripts/ # Deployment scripts
β βββ deploy.ts # Contract deployment
βββ test/ # Contract tests
βββ .github/workflows/ # CI/CD workflows
- Node.js (v20 or higher)
- npm or yarn
- MetaMask or another Web3 wallet
- Hardhat
- Clone the repository
git clone https://github.com/Louay012/parkchain.git
cd parkchain- Install root dependencies
npm install --legacy-peer-deps- Install frontend dependencies
cd frontend
npm installCreate a .env file in the root directory:
# Network Configuration
NETWORK=localhost
RPC_URL=http://127.0.0.1:8545
# Contract Addresses (will be populated after deployment)
PARKING_TOKEN_ADDRESS=
PARKING_RESERVATION_ADDRESS=
PAYMENT_PROCESSOR_ADDRESS=
# Backend Configuration
PORT=3001
# Private key for deployment (use test accounts only!)
PRIVATE_KEY=npx hardhat compilenpx hardhat testStart a local Hardhat node:
npx hardhat nodeIn another terminal, deploy contracts:
npx hardhat run scripts/deploy.ts --network ganachenpm run backendThe backend will run on http://localhost:3001
cd frontend
npm run devThe frontend will run on http://localhost:3000
ERC721 token representing parking spot ownership with metadata including:
- Location
- Spot number
- Price per hour
- Availability status
Manages parking reservations with features:
- Create reservations with time slots
- Automatic payment processing
- Reservation cancellation with refunds
- Immutable reservation history
Handles payments with:
- Platform fee collection
- Payment history tracking
- Automatic fund distribution
- Secure payment processing
GET /api/parking/spots- Get all parking spotsGET /api/parking/spots/:tokenId- Get specific parking spotPOST /api/parking/reservations- Create a reservationGET /api/parking/reservations/:address- Get user reservations
POST /api/qr/generate- Generate QR code for parking tokenPOST /api/qr/reservation- Generate QR code for reservation
# Compile contracts
npm run compile
# Run tests
npm run test
# Deploy contracts
npm run deploy
# Start backend
npm run backend
# Start frontend (in frontend directory)
cd frontend && npm run dev
# Build frontend
cd frontend && npm run buildmain- Production-ready codedevelop- Development branchfeature/*- Feature brancheshotfix/*- Hotfix branches
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the ISC License.
- Louay012
- OpenZeppelin for secure smart contract libraries
- Hardhat for Ethereum development environment
- React and Tailwind CSS for the frontend
- Express.js for the backend API
For support, please open an issue in the GitHub repository.
Made with β€οΈ using Blockchain Technology