This guide will help you get Smart Code Diff up and running in minutes!
Before you start, make sure you have:
- Rust (1.75 or later) - Install from rustup.rs
- Node.js (18 or later) - Install from nodejs.org
- npm (comes with Node.js)
- tmux (Linux/macOS only) - For better terminal management
- Linux:
sudo apt install tmuxorsudo yum install tmux - macOS:
brew install tmux
- Linux:
-
Make scripts executable:
chmod +x start.sh dev.sh stop.sh
-
Start all services:
./start.sh
-
Open your browser:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8080
-
Stop services:
- Press
Ctrl+Cin the terminal, or - Run
./stop.shin another terminal
- Press
-
Start all services:
start.bat
-
Open your browser:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8080
-
Stop services:
- Press any key in the terminal, or
- Run
stop.batin another terminal
For active development with hot-reload:
./dev.shThis will:
- Start backend with hot-reload (using
cargo run) - Start frontend with hot-reload (using
npm run dev) - Use tmux for split-screen view (if available)
Use the regular start.bat - it already runs in development mode.
Features:
- ✓ Checks all prerequisites (Rust, Node.js, npm)
- ✓ Checks if ports are available
- ✓ Installs frontend dependencies if needed
- ✓ Builds backend if needed
- ✓ Starts both services
- ✓ Waits for services to be ready
- ✓ Shows status and URLs
- ✓ Handles graceful shutdown
When to use:
- First time setup
- Production-like environment
- When you want everything automated
Features:
- ✓ Fast startup (no checks)
- ✓ Uses tmux for split-screen (if available)
- ✓ Hot-reload enabled
- ✓ Shows logs in real-time
When to use:
- Active development
- Quick iterations
- When you want to see both services at once
Features:
- ✓ Stops backend (port 8080)
- ✓ Stops frontend (port 3000)
- ✓ Kills tmux session (if exists)
- ✓ Clean shutdown
When to use:
- When services are running in background
- To free up ports
- Before switching branches
| Service | Port | URL |
|---|---|---|
| Backend | 8080 | http://localhost:8080 |
| Frontend | 3000 | http://localhost:3000 |
Logs are saved to:
- Backend:
backend.log(orlogs/backend.logon Windows) - Frontend:
frontend.log(orlogs/frontend.logon Windows)
View logs in real-time:
# Linux/macOS
tail -f backend.log
tail -f frontend.log
# Windows
type logs\backend.log
type logs\frontend.logProblem: Error message about port 8080 or 3000 already in use.
Solution:
# Linux/macOS
./stop.sh
# Windows
stop.batOr manually kill the process:
# Linux/macOS
lsof -ti:8080 | xargs kill -9
lsof -ti:3000 | xargs kill -9
# Windows
netstat -ano | findstr :8080
taskkill /PID <PID> /FProblem: Backend fails to start or crashes.
Solution:
- Check the logs:
cat backend.log - Rebuild:
cargo clean && cargo build --release --bin smart-diff-server - Check Rust version:
rustc --version(should be 1.75+)
Problem: Frontend fails to start or shows errors.
Solution:
- Check the logs:
cat frontend.log - Reinstall dependencies:
cd nextjs-frontend rm -rf node_modules package-lock.json npm install cd ..
- Check Node version:
node --version(should be 18+)
Problem: npm install fails.
Solution:
- Clear npm cache:
npm cache clean --force - Delete
node_modulesandpackage-lock.json - Try again:
npm install - If still failing, try:
npm install --legacy-peer-deps
Problem: Services appear to start but browser can't connect.
Solution:
- Wait a bit longer (services may still be initializing)
- Check if services are actually running:
# Linux/macOS curl http://localhost:8080/api/health curl http://localhost:3000 # Windows curl http://localhost:8080/api/health curl http://localhost:3000
- Check firewall settings
- Try accessing via
127.0.0.1instead oflocalhost
Problem: Can't exit tmux session.
Solution:
- Detach: Press
Ctrl+B, then pressD - Kill session:
tmux kill-session -t smartdiff - Force kill:
./stop.sh
If you prefer to start services manually:
# Development
RUST_LOG=info cargo run --bin smart-diff-server
# Production
cargo build --release --bin smart-diff-server
./target/release/smart-diff-servercd nextjs-frontend
# Development
npm run dev
# Production
npm run build
npm startRUST_LOG- Log level (default:info)- Options:
error,warn,info,debug,trace
- Options:
RUST_BACKTRACE- Show backtraces on errors (default:0)- Set to
1for full backtraces
- Set to
Example:
RUST_LOG=debug RUST_BACKTRACE=1 cargo run --bin smart-diff-serverCreate nextjs-frontend/.env.local:
NEXT_PUBLIC_API_URL=http://localhost:8080Once services are running:
- Open the frontend: http://localhost:3000
- Try the examples:
- Compare two files
- Analyze a directory
- View the graph visualization
- Read the docs:
- Documentation: Check the
docs/directory - Issues: Report bugs on GitHub
- Logs: Always check
backend.logandfrontend.logfirst
- First build is slow: Rust compilation takes time. Subsequent builds are faster.
- Use release mode: For better performance, always use
--releaseflag - Close other apps: Free up RAM and CPU for better performance
- Use SSD: Faster disk = faster builds and startup
To update to the latest version:
# Pull latest changes
git pull
# Rebuild backend
cargo build --release --bin smart-diff-server
# Update frontend dependencies
cd nextjs-frontend
npm install
cd ..
# Restart services
./stop.sh
./start.shTo completely remove:
# Stop services
./stop.sh
# Remove build artifacts
cargo clean
rm -rf nextjs-frontend/node_modules
rm -rf nextjs-frontend/.next
# Remove logs
rm -f backend.log frontend.log
rm -rf logs/Happy Coding! 🚀