This project implements a Decentralized Content Delivery Network (dCDN) that distributes content across decentralized nodes rather than relying on a single centralized server. The goal is to improve availability, scalability, fault tolerance, and resilience while exploring modern decentralized system design.
The project demonstrates a full-stack decentralized architecture, combining a modern web frontend with high-performance backend logic.
- Design a decentralized alternative to traditional CDNs
- Improve content availability through distributed nodes
- Reduce dependency on centralized infrastructure
- Explore decentralization using modern backend and frontend technologies
- Build an end-to-end deployable system
- Decentralized Storage: Files are distributed across multiple nodes for redundancy
- Global CDN: Worldwide network of nodes for fast content delivery
- Privacy Controls: Public and private file sharing options
- Real-time Analytics: Monitor network performance and usage statistics
- Peer-to-Peer Network: Direct node-to-node content distribution
- Censorship Resistant: Decentralized architecture prevents single points of failure
Before you begin, ensure you have the following installed:
-
Node.js and npm
# Download from https://nodejs.org/ node --version # Should be v16 or higher npm --version
-
Rust and Cargo
# Install from https://rustup.rs/ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh rustc --version cargo --version
-
DFINITY SDK
sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)" dfx --version
-
Clone or download this project
# If you have git: git clone <repository-url> cd dcdn # Or extract the downloaded files and navigate to the directory
-
Install frontend dependencies
npm install
-
Add required dependencies for ICP integration
npm install @dfinity/agent @dfinity/candid @dfinity/principal
-
Start the local development environment
# Start the frontend development server npm run dev -
Deploy to local ICP replica (in a new terminal)
# Make the deploy script executable chmod +x deploy.sh # Run the deployment script ./deploy.sh
The script will:
- Start a local ICP replica
- Deploy the Rust backend canister
- Build and deploy the React frontend
- Provide you with local URLs to access your DCDN
-
Get cycles for deployment
- Visit https://faucet.dfinity.org/ to get free cycles for testing
- Or purchase cycles for production deployment
-
Deploy to Internet Computer mainnet
# Make the mainnet deploy script executable chmod +x deploy-mainnet.sh # Deploy to mainnet ./deploy-mainnet.sh
dcdn/
├── src/
│ ├── components/ # React components
│ │ ├── UploadSection.tsx # File upload interface
│ │ ├── FileList.tsx # File management
│ │ ├── NetworkStats.tsx # Network statistics
│ │ └── PeerNodes.tsx # Node management
│ ├── pages/
│ │ └── Index.tsx # Main application page
│ └── dcdn_backend/ # Rust backend
│ ├── src/lib.rs # Main backend logic
│ └── Cargo.toml # Rust dependencies
├── dfx.json # ICP configuration
├── deploy.sh # Local deployment script
├── deploy-mainnet.sh # Mainnet deployment script
└── README.md # This file
- Frontend (TypeScript / Next.js):
User interface, routing, request handling, and visualization. - API / Gateway Layer:
Routes client requests to appropriate decentralized nodes. - Backend (Rust):
Handles core logic, performance-critical services, and decentralized coordination. - Decentralized Nodes / Storage:
Content is stored and retrieved from distributed locations.
- TypeScript
- React / Next.js
- CSS
- Rust (for performance-critical services)
- Shell scripts for build and automation
- Configuration & deployment scripts
- Container / environment configuration
- Navigate to the "Upload Files" tab
- Drag and drop files or click to browse
- Choose privacy settings (public/private)
- Click "Upload to Network"
- View uploaded files in the "My Files" tab
- Download, share, or delete files as needed
- Copy shareable links for public files
- Check network statistics in the "Network Stats" tab
- Monitor peer nodes in the "Peer Nodes" tab
- View real-time performance metrics
- Cryptographic Hashing: All files are identified by secure hashes
- Access Control: Private files are only accessible by owners
- Decentralized Verification: Network consensus for file integrity
- Immutable Storage: Files cannot be modified once uploaded
The dCDN operates on a peer-to-peer network where:
- Multiple nodes store file replicas for redundancy
- Closest nodes serve content for optimal performance
- Automatic failover ensures high availability
- Load balancing distributes traffic efficiently
Track important metrics:
- Upload/Download Statistics: Monitor data transfer rates
- Node Performance: Track uptime and response times
- Storage Utilization: View network-wide storage usage
- User Activity: Analyze usage patterns
-
"dfx not found" error
# Reinstall DFINITY SDK sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"
-
Build failures
# Clean and rebuild dfx stop dfx start --clean --background ./deploy.sh -
Frontend not loading
# Rebuild frontend npm run build dfx deploy dcdn_frontend -
Cycles balance issues
- Visit https://faucet.dfinity.org/ for test cycles
- Check balance:
dfx wallet --network ic balance
- Initial project scaffolding was AI-assisted and later customized and extended.
- Core architectural design, integration, configuration, and customization were done manually.
- Focus was on learning decentralized system design, not just building a UI.
It shows TypeScript as the dominant language (~92%) because:
- The project contains a full Next.js frontend, which naturally has many
.tsand.tsxfiles. - Rust is used for core backend logic, which is smaller in file count but critical in functionality.
- This distribution reflects project structure, not importance or ownership.
This is an open-source project. Contributions are welcome!
Abhineet Kaur
Computer Science | AI/ML & Systems Enthusiast
This project is licensed under the MIT License.
Happy building your decentralized CDN! 🎉
For questions or support, refer to the Internet Computer community forums or documentation.