A Go-based API framework with automatic route discovery and hot reloading.
- Automatic API route discovery and registration
- Built-in cross-platform hot reloading
- JSON response formatting
- Clean directory structure
- Simple route definition
# Clone the repository
git clone https://github.com/username/volt.git
cd volt
# Install dependencies
go mod download
# Install Air for hot reloading (optional)
make install-airAPI routes follow this organization:
app/
├── route.go # Root API route (/api)
└── example/
└── route.go # Example API route (/example)
Each route exports:
// HTTP method (GET, POST, etc.)
var Method = http.MethodGet
// Handler function
func Handler(w http.ResponseWriter, r *http.Request) (interface{}, int, error) {
return responseData, statusCode, err
}| Command | Description |
|---|---|
make run |
Run the API server |
make generate |
Generate route definitions |
make dev |
Run with hot reload |
make build |
Build application binary |
make install-air |
Install Air for hot reloading |
Custom port: PORT=3000 make run
The framework supports hot reloading on all platforms:
- All Platforms:
make dev - macOS/Linux:
./dev.sh - Windows:
dev.bat
- Install Air:
make install-air - Add Go bin to PATH:
- Bash/zsh:
export PATH=$PATH:$HOME/go/bin - Windows:
set PATH=%PATH%;%USERPROFILE%\go\bin
- Bash/zsh:
- Port conflicts: Default is 8080; change in
.air.tomlif needed - Infinite rebuilds: Already prevented by default configuration
- Create a directory under
app/(e.g.,app/users/) - Add
route.gowithMethodandHandler - Run
make generate - The route will be available at the corresponding path (e.g.,
/users)
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.