Live hot-reload runtime for Go applications with zero-downtime restarts.
Phoenix brings hot-reload to Go. Save your code, and Phoenix automatically rebuilds and restarts your applicationโon Linux/macOS, it even transfers open TCP connections to the new process so clients never disconnect.
- ๐ Instant Rebuilds โ File watcher detects changes and triggers builds automatically
- ๐ Connection Handoff โ Open TCP connections transfer to new process (Linux/macOS)
- ๐พ State Preservation โ Serialize sessions, caches, and counters across reloads
- โก Incremental Builds โ Source hashing skips rebuilds when nothing changed
- ๐จ Beautiful Output โ Powered by Aurora for stunning terminal UI
- ๐ฆ SDK Integration โ Drop-in library for full hot-reload support in your apps
- ๐ช Cross-Platform โ Works on Windows, Linux, and macOS
go install github.com/Summaw/GoPhoenix/cmd/phoenix@latestphoenix ./cmd/myappThat's it. Phoenix watches your files, rebuilds on save, and restarts your app.
For connection handoff and state preservation, integrate the SDK:
package main
import (
"net/http"
"github.com/Summaw/GoPhoenix/pkg/sdk"
)
func main() {
app := sdk.New(sdk.WithAddress(":8080"))
mux := http.NewServeMux()
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Hello from Phoenix! ๐ฅ"))
})
app.ListenAndServe(mux)
}โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โโโโโโโ โโโ โโโ โโโโโโโ โโโโโโโโโโโโ โโโโโโโโโ โโโ โ
โ โโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโ โ
โ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโ โโโโโโ โโโโโโ โโโโโโ โ
โ โโโโโโโ โโโโโโโโโโโ โโโโโโโโโ โโโโโโโโโโโโโ โโโโโโ โ
โ โโโ โโโ โโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโ โโโ โ
โ โโโ โโโ โโโ โโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโ โโโ โ
โ Hot Reload Runtime for Go โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
12:34:56.789 โ INFO Starting Phoenix
โโ target: ./cmd/server
โโ watch: .
โโ binary: ./bin/app.exe
12:34:56.812 โ SUCCESS Build successful
โโ binary: ./bin/app.exe
โโ duration: 156ms
12:34:56.834 โ SUCCESS Application started
โโ pid: 12345
12:35:02.123 โ INFO Change detected
โโ file: ./handlers/api.go
12:35:02.456 โ SUCCESS Build complete
โโ duration: 203ms
12:35:02.478 โ SUCCESS Application restarted
โโ pid: 12346
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Phoenix Daemon โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ ๐ Watch Files โ ๐จ Rebuild โ ๐ Handoff โ
โ โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โ
โ โ .go โ โ go build โ โ New โ โ
โ โ files โ โโโถ โ โ โโโถ โ Process โ โ
โ โ change โ โ โ โ โ โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโโโโโโโโโโโ โ
โ โผ โ
โ โโโโโโโโโโโโโโโ โ
โ โ Transfer: โ โ
โ โ โข Listeners โ โ
โ โ โข State โ โ
โ โ โข Sessions โ โ
โ โโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
On Linux/macOS, Phoenix uses Unix socket file descriptor passing (SCM_RIGHTS) to transfer open TCP listeners between processesโclients stay connected through the reload.
phoenix [options] <package>
Options:
-watch Paths to watch (comma-separated) default: "."
-ext File extensions to watch default: ".go"
-exclude Paths to exclude default: "vendor,node_modules,.git"
-bin Output binary path default: "./bin/app"
-drain Graceful shutdown timeout default: 30s
-debug Enable debug logging default: false
Examples:
phoenix ./cmd/server
phoenix -watch=./cmd,./internal ./cmd/api
phoenix -ext=.go,.html -debug .
Keep data alive across reloads:
type MyCache struct {
data map[string]string
mu sync.RWMutex
}
func (c *MyCache) Snapshot() ([]byte, error) {
c.mu.RLock()
defer c.mu.RUnlock()
return json.Marshal(c.data)
}
func (c *MyCache) Restore(data []byte) error {
c.mu.Lock()
defer c.mu.Unlock()
return json.Unmarshal(data, &c.data)
}
app := sdk.New(
sdk.WithStateProvider("cache", myCache),
)| Feature | Phoenix | Air | Fresh | Realize |
|---|---|---|---|---|
| Hot reload | โ | โ | โ | โ |
| Zero downtime | โ | โ | โ | โ |
| Connection handoff | โ | โ | โ | โ |
| State preservation | โ | โ | โ | โ |
| SDK integration | โ | โ | โ | โ |
| Cross-platform | โ | โ | โ | โ |
| Beautiful UI | โ | โ |
phoenix/
โโโ cmd/phoenix/ # CLI daemon
โโโ pkg/sdk/ # Application SDK
โโโ internal/
โ โโโ watcher/ # File system monitoring
โ โโโ compiler/ # Build orchestration
โ โโโ handoff/ # Connection & state transfer
โ โโโ process/ # Process lifecycle
โ โโโ state/ # State serialization
โโโ examples/basic/ # Demo application
| Platform | Connection Handoff | State Transfer |
|---|---|---|
| Linux | โ Full support | โ |
| macOS | โ Full support | โ |
| Windows | โ Quick restart | โ |
On Windows, Phoenix performs a fast restart instead of true zero-downtime handoff (Unix sockets required for FD passing).
MIT License โ see LICENSE for details.
- Terminal UI powered by Aurora
- Inspired by Erlang's hot code loading
Like Phoenix? Give it a โญ to support the project!