Thank you for your interest in 0trace! This document will help you get started with development.
- Rust 1.75+
- Cargo
- Git
git clone https://github.com/momo2029/0trace
cd 0traceMethod 1: Hot-reload Mode (Recommended)
./dev.shFeatures:
- ✅ Automatically watches for code changes
- ✅ Automatically recompiles
- ✅ Automatically restarts server
Watch scope:
backend/src/**/*.rs- Backend codeshared/src/**/*.rs- Shared library code
Method 2: Normal Mode
make devBackend Code
- Edit
backend/src/*.rsorshared/src/*.rs - Hot-reload mode: auto-restart ✅
- Normal mode: Ctrl+C to stop →
make devto restart
Frontend Code
- Edit
frontend/static/*.{html,css,js} - Copy to backend:
cp frontend/static/* backend/static/ - Refresh browser ✅
Shortcut commands:
# Update all frontend files
cp -r frontend/static/* backend/static/
# Or update individually
cp frontend/static/style.css backend/static/
cp frontend/static/app.js backend/static/make test-
Open two browser windows (or use incognito mode)
Window 1: http://localhost:2029 Window 2: http://localhost:2029 -
Window 1 (Sender):
- Select "Send Files" tab
- Choose test file (recommended < 10MB)
- Copy share link
-
Window 2 (Receiver):
- Paste link into address bar
- Auto-start receiving
| File Type | Size | Purpose |
|---|---|---|
| Text file | < 1MB | Quick test |
| Image | 1-10MB | Regular test |
| Video | 10-100MB | Performance test |
RUST_LOG=debug ./dev.shLog levels:
error- Errors onlywarn- Warnings and aboveinfo- Info and above (default)debug- Debug infotrace- All info
- Open Developer Tools: F12
- Console tab: View JS logs
- Network tab: View requests
- Application tab: View localStorage
cargo buildmake build
# Binary: backend/target/release/backenddocker build -t 0trace .
docker run -p 2029:2029 0trace# Format
cargo fmt
# Lint
cargo clippy
# Fix warnings
cargo clippy --fix- Use ES6+ syntax
- Avoid frameworks (stay lightweight)
- Add necessary comments
Use semantic commit messages:
feat: Add new feature
fix: Fix bug
docs: Update documentation
style: Code formatting changes
refactor: Refactor code
test: Add tests
chore: Build/toolchain updates
Examples:
git commit -m "feat: Add multi-file transfer support"
git commit -m "fix: Fix memory overflow for large files"
git commit -m "docs: Update README deployment instructions"0trace/
├── shared/ # Shared library (protocol definitions)
│ ├── src/
│ │ ├── protocol.rs # Signaling protocol
│ │ └── room.rs # Room management
│ └── Cargo.toml
│
├── backend/ # Rust backend
│ ├── src/
│ │ ├── main.rs # Server entry point
│ │ ├── room.rs # Room manager
│ │ └── ws.rs # WebSocket handling
│ └── static/ # Static files (production)
│
├── frontend/ # Frontend development
│ └── static/
│ ├── index.html # Main page
│ ├── app.js # WebRTC logic
│ ├── style.css # Styles
│ ├── i18n.js # Multilingual system
│ └── i18n/ # Translation files
│
├── Dockerfile
├── Makefile
└── README.md
- Fork the project
- Create feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m "feat: Add new feature" - Push branch:
git push origin feature/amazing-feature - Submit Pull Request
- Code formatted with
cargo fmt - Code passes
cargo clippychecks - Added necessary tests
- Updated relevant documentation
- Tested locally
- Commit messages follow convention
# Find process using port
lsof -ti:2029
# Kill process
lsof -ti:2029 | xargs kill -9# Install cargo-watch
cargo install cargo-watch
# Check version
cargo watch --version# Confirm files copied
ls -la backend/static/
# Force refresh browser
Cmd+Shift+R (Mac)
Ctrl+Shift+R (Windows/Linux)# Clean build cache
make clean
# Update dependencies
cargo update
# Rebuild
make build- Rust Official Documentation
- Axum Framework Documentation
- WebRTC API Documentation
- Project Architecture Documentation
- Small commits - Each commit should do one thing
- Write comments - Add comments for complex logic
- Test first - Write tests before modifying features
- Keep it simple - Avoid over-engineering
- Performance mindset - Consider memory and performance impact
Contributions welcome for:
Short-term
- Add transfer speed display
- Support resumable transfers
- Add file preview
- Optimize large file transfers
Medium-term
- Integrate TURN server
- Add file encryption option
- Support batch transfers
- Mobile optimization
Long-term
- Text message transfer
- QR code sharing
- Transfer history
- Custom STUN/TURN configuration
Questions or suggestions?
- Open Issue: https://github.com/momo2029/0trace/issues
- Discussions: https://github.com/momo2029/0trace/discussions
Thank you for your contributions! 🎉