This document provides an overview of all the start scripts created for Smart Code Diff.
| Script | Platform | Purpose | When to Use |
|---|---|---|---|
install.sh |
Linux/macOS | One-time setup | First time installation |
start.sh |
Linux/macOS | Full start with checks | Production-like start |
start.bat |
Windows | Full start with checks | Production-like start |
dev.sh |
Linux/macOS | Quick dev start | Active development |
stop.sh |
Linux/macOS | Stop all services | Cleanup |
stop.bat |
Windows | Stop all services | Cleanup |
make start |
Linux/macOS | Makefile wrapper | Alternative to start.sh |
make stop |
Linux/macOS | Makefile wrapper | Alternative to stop.sh |
Purpose: One-command installation and setup
What it does:
- Checks for Rust (installs if missing)
- Checks for Node.js (prompts to install if missing)
- Makes all scripts executable
- Installs frontend dependencies
- Builds backend in release mode
Usage:
./install.shFirst-time users: Start here!
Purpose: Full-featured start script with comprehensive checks
Features:
- ✓ Prerequisite checking (Rust, Node.js, npm)
- ✓ Port availability checking
- ✓ Automatic dependency installation
- ✓ Automatic backend building
- ✓ Health checks for both services
- ✓ Graceful shutdown on Ctrl+C
- ✓ Detailed logging
- ✓ Error handling and recovery
Usage:
./start.shPorts:
- Backend: 8080
- Frontend: 3000
Logs:
backend.logfrontend.log
Stop:
- Press
Ctrl+Cin the terminal - Or run
./stop.shin another terminal
Purpose: Windows equivalent of start.sh
Features:
- ✓ Prerequisite checking
- ✓ Port availability checking
- ✓ Automatic dependency installation
- ✓ Automatic backend building
- ✓ Health checks for both services
- ✓ Opens browser automatically
- ✓ Detailed logging in
logs/directory
Usage:
start.batPorts:
- Backend: 8080
- Frontend: 3000
Logs:
logs\backend.loglogs\frontend.log
Stop:
- Press any key in the terminal
- Or run
stop.batin another terminal
Purpose: Quick development start with minimal checks
Features:
- ✓ Fast startup (no prerequisite checks)
- ✓ Uses tmux for split-screen (if available)
- ✓ Hot-reload enabled for both services
- ✓ Real-time log viewing
- ✓ Easy detach/reattach
Usage:
./dev.shWith tmux:
- Backend in left pane
- Frontend in right pane
- Detach:
Ctrl+BthenD - Reattach:
tmux attach -t smartdiff - Kill:
tmux kill-session -t smartdiff
Without tmux:
- Runs in background
- Shows PIDs for manual control
- Check logs:
tail -f backend.log frontend.log
When to use:
- Active development
- Quick iterations
- Testing changes
- When you want to see both services at once
Purpose: Stop all Smart Code Diff services
What it stops:
- ✓ Backend on port 8080
- ✓ Frontend on port 3000
- ✓ tmux session (if exists)
Usage:
./stop.shSafe to run: Won't error if services aren't running
Purpose: Windows equivalent of stop.sh
What it stops:
- ✓ Backend processes
- ✓ Frontend processes
- ✓ Any processes on ports 8080 and 3000
Usage:
stop.batWrapper for ./start.sh
make startWrapper for ./dev.sh
make dev-startWrapper for ./stop.sh
make stopFirst-time setup (installs dependencies and builds)
make setupStart only the backend
make start-backendStart only the frontend
make start-frontendInstall frontend dependencies only
make install-frontendBuild frontend for production
make build-frontend| Feature | start.sh | start.bat | dev.sh |
|---|---|---|---|
| Prerequisite checks | ✓ | ✓ | ✗ |
| Port checks | ✓ | ✓ | ✗ |
| Auto-install deps | ✓ | ✓ | ✗ |
| Auto-build backend | ✓ | ✓ | ✗ |
| Health checks | ✓ | ✓ | ✗ |
| Graceful shutdown | ✓ | ✓ | ✓ |
| Logging | ✓ | ✓ | ✓ |
| tmux support | ✗ | N/A | ✓ |
| Auto-open browser | ✗ | ✓ | ✗ |
| Startup time | Slow | Slow | Fast |
Use install.sh:
- First time setup
- After pulling major updates
- When dependencies change
Use start.sh / start.bat:
- First time running
- Production-like environment
- When you want everything automated
- When ports might be in use
- When you're not sure if everything is set up
Use dev.sh:
- Active development
- Quick iterations
- When you know everything is set up
- When you want split-screen view
- When you want hot-reload
Use stop.sh / stop.bat:
- When services are running in background
- To free up ports
- Before switching branches
- Before pulling updates
Use make targets:
- When you prefer Makefile workflow
- For CI/CD integration
- For scripting and automation
# 1. Clone repository
git clone https://github.com/opensensor/smartdiff.git
cd smartdiff
# 2. Run installer
./install.sh
# 3. Start services
./start.sh
# 4. Open browser to http://localhost:3000# Morning: Start development
./dev.sh
# Work on code...
# (hot-reload handles changes automatically)
# Evening: Stop services
./stop.sh# Start with full checks
./start.sh
# Test your changes...
# Stop
./stop.sh# Stop services
./stop.sh
# Switch branch
git checkout feature-branch
# Reinstall dependencies if needed
cd nextjs-frontend && npm install && cd ..
# Rebuild backend if needed
cargo build --release --bin smart-diff-server
# Start again
./start.shProblem: Permission denied
Solution:
chmod +x install.sh start.sh dev.sh stop.shProblem: Port 8080 or 3000 is busy
Solution:
./stop.sh # Kill any existing services
./start.sh # Try againProblem: Backend or frontend fails to start
Solution:
- Check logs:
cat backend.logorcat frontend.log - Rebuild:
cargo clean && cargo build --release --bin smart-diff-server - Reinstall:
cd nextjs-frontend && rm -rf node_modules && npm install
Problem: dev.sh says tmux not found
Solution:
# Linux
sudo apt install tmux
# macOS
brew install tmux
# Or just use start.sh insteadEdit the scripts to change ports:
Backend port (default 8080):
- Edit
crates/web-ui/src/main.rs - Change
0.0.0.0:8080to your desired port
Frontend port (default 3000):
- Edit
nextjs-frontend/package.json - Change
"dev": "next dev"to"dev": "next dev -p YOUR_PORT"
Backend:
RUST_LOG=debug ./start.sh # More verbose logging
RUST_BACKTRACE=1 ./start.sh # Show backtracesFrontend:
Create nextjs-frontend/.env.local:
NEXT_PUBLIC_API_URL=http://localhost:8080Linux/macOS:
nohup ./start.sh > /dev/null 2>&1 &Windows: Use Task Scheduler or run as a service
- Always use
./stop.shbefore pulling updates - Run
./install.shafter major updates - Use
./dev.shfor development,./start.shfor testing - Check logs if something goes wrong
- Keep scripts executable with
chmod +x - Don't commit log files to git
The scripts create these files:
backend.log- Backend logsfrontend.log- Frontend logslogs/- Log directory (Windows)nextjs-frontend/node_modules/- Dependenciestarget/- Rust build artifacts
Add to .gitignore:
backend.log
frontend.log
logs/
- Installation:
./install.sh(one time) - Start:
./start.shorstart.bat - Development:
./dev.sh - Stop:
./stop.shorstop.bat - Help: See
QUICK_START.md
Happy coding! 🚀