Installation
Learn about Installation in EchoNext.
Installation
This guide will help you install EchoNext and set up your development environment.
Prerequisites
Before installing EchoNext, ensure you have:
- Go 1.24.0 or later - Download Go
- Git - For version control
- A text editor or IDE (VS Code, GoLand, etc.)
Quick Install
The fastest way to install the EchoNext CLI:
Linux / macOS
curl -sSL https://raw.githubusercontent.com/abdussamadbello/echonext/v1.4.8/install.sh | bashWindows (PowerShell)
iwr -useb https://raw.githubusercontent.com/abdussamadbello/echonext/v1.4.8/install.ps1 | iexThis installs echonext to ~/.local/bin (Unix) or %LOCALAPPDATA%\bin (Windows) and automatically configures your PATH.
Installing EchoNext
Install the Library
Add EchoNext to your Go project:
go get github.com/abdussamadbello/echonext@v1.4.8This will install the core EchoNext library.
Install the CLI Tool (Optional but Recommended)
The EchoNext CLI helps you generate projects and code quickly:
go install github.com/abdussamadbello/echonext/cmd/echonext-cli@v1.4.8Verify the installation:
echonext --versionQuick Setup
Option 1: Start with a New Project (Recommended)
Use the CLI to create a new project with best practices:
# Create a new project
echonext init myapp --module=github.com/yourusername/myapp
# Navigate to the project
cd myapp
# Install dependencies
go mod tidy
# Run the application
go run ./cmd/apiVisit http://localhost:8080/api/docs to see your API documentation.
Option 2: Add to Existing Project
Add EchoNext to an existing Go project:
# In your existing project directory
go get github.com/abdussamadbello/echonext@v1.4.8
# Create a basic main.go
cat > main.go << 'EOF'
package main
import (
"github.com/abdussamadbello/echonext"
)
func main() {
app := echonext.New()
app.SetInfo("My API", "1.0.0", "My EchoNext API")
app.GET("/health", func(c echo.Context) error {
return c.JSON(200, map[string]string{"status": "ok"})
})
app.Start(":8080")
}
EOF
# Run it
go run main.goInstalling Optional Contrib Packages
EchoNext provides optional helper packages. Install them as needed:
Database Helpers
go get gorm.io/gorm
go get gorm.io/driver/postgres # or driver/mysql, driver/sqlite, etc.Config Management
go get github.com/spf13/viper
go get github.com/fsnotify/fsnotifyThe contrib packages are already part of the EchoNext module, so you can import them directly:
import (
"github.com/abdussamadbello/echonext/pkg/contrib/database"
"github.com/abdussamadbello/echonext/pkg/contrib/config"
"github.com/abdussamadbello/echonext/pkg/contrib/testing"
"github.com/abdussamadbello/echonext/pkg/contrib/middleware"
)Verifying Your Installation
Create a simple test to verify everything works:
// test.go
package main
import (
"testing"
"github.com/abdussamadbello/echonext"
)
func TestEchoNext(t *testing.T) {
app := echonext.New()
if app == nil {
t.Fatal("Failed to create EchoNext app")
}
}Run the test:
go test test.goDevelopment Tools (Optional)
Consider installing these tools for a better development experience:
Air - Hot Reload
go install github.com/air-verse/air@latestCreate .air.toml for hot reload:
root = "."
tmp_dir = "tmp"
[build]
cmd = "go build -o ./tmp/main ./cmd/api"
bin = "tmp/main"
include_ext = ["go"]
exclude_dir = ["tmp", "vendor"]Run with hot reload:
airgolangci-lint - Code Quality
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latestRun linter:
golangci-lint runNext Steps
Now that EchoNext is installed:
- Follow the Quick Start Guide to build your first API
- Learn about Core Concepts
- Explore Example Projects
Troubleshooting
"command not found: echonext"
If you used the install script, ensure ~/.local/bin is in your PATH:
# Linux/macOS
export PATH="$PATH:$HOME/.local/bin"If you used go install directly, ensure $GOPATH/bin is in your PATH:
export PATH=$PATH:$(go env GOPATH)/binAdd the appropriate line to your ~/.bashrc or ~/.zshrc to make it permanent.
Windows: The install script automatically adds %LOCALAPPDATA%\bin to your PATH. Restart your terminal after installation.
"package github.com/abdussamadbello/echonext: cannot find package"
Make sure you're in a Go module:
go mod init github.com/yourusername/yourproject
go get github.com/abdussamadbello/echonext@v1.4.8Version Conflicts
If you encounter version conflicts, try:
go get github.com/abdussamadbello/echonext@v1.4.8
go mod tidy