The backend server automatically restarts when you change any .go file.
# Option 1: Use the run script (recommended - handles everything automatically)
./run-dev.sh
# Option 2: Use make
make dev
# Option 3: Use air directly (if installed)
airIf air is not installed:
# Install air
go install github.com/air-verse/air@latest
# Add to PATH (add to ~/.zshrc or ~/.bashrc)
export PATH=$PATH:$HOME/go/bin
# Then run
./run-dev.sh- ✅ All
.gofiles incmd/,internal/, and root directory - ✅ Automatically restarts within 1 second of file changes
- ❌ Excludes:
tmp/,vendor/,testdata/,migrations/,.git/, test files
Air configuration is in .air.toml. The server will:
- Build:
go build -o ./tmp/main ./cmd/api - Run:
./tmp/main - Watch: All
.gofiles (except tests and excluded directories)
Press Ctrl+C to stop the development server.
Air not found:
# Install it
go install github.com/air-verse/air@latest
# Make sure ~/go/bin is in PATH
export PATH=$PATH:$HOME/go/bin
# Verify installation
which airServer not restarting:
- Check that you're editing
.gofiles (not just config files) - Check
tmp/build-errors.logfor build errors - Make sure you're in the
backend/directory
Port already in use:
- Change
PORTin your.envfile - Or kill the existing process:
lsof -ti:8080 | xargs kill