Installation
Install the Forge CLI and set up your development environment
Requirements
| Requirement | Minimum Version | Recommended |
|---|---|---|
| Go | 1.21+ | Latest stable |
| OS | Linux, macOS, Windows | Any |
Forge uses Go generics extensively for type-safe dependency injection. Go 1.21 or later is required.
Install the Forge CLI
The Forge CLI (forge) is the primary tool for developing, building, and managing Forge applications. It provides hot-reload development servers, code generation, database migrations, and more.
The recommended way to install on macOS and Linux:
brew install xraph/tap/forgeTo upgrade to the latest version:
brew upgrade xraph/tap/forgeIf you already have Go installed:
go install github.com/xraph/forge/cmd/forge@latestMake sure $GOPATH/bin (or $HOME/go/bin) is in your PATH.
Install using Scoop:
scoop bucket add xraph https://github.com/xraph/scoop-bucket
scoop install forgeTo upgrade:
scoop update forgeDownload the pre-built binary for your platform from the GitHub Releases page.
- Download the archive for your OS and architecture (e.g.,
forge-x.x.x-darwin-arm64.tar.gz) - Extract the binary:
tar -xzf forge-*.tar.gz- Move it to a directory in your
PATH:
sudo mv forge /usr/local/bin/- Verify:
forge versionPre-built .deb, .rpm, .apk, and Arch Linux packages are available on the GitHub Releases page.
# Debian / Ubuntu
sudo dpkg -i forge_*.deb
# Fedora / RHEL
sudo rpm -i forge_*.rpm
# Alpine
sudo apk add --allow-untrusted forge_*.apkThe Forge CLI is also available as a Docker image:
docker pull ghcr.io/xraph/forge:latestRun it:
docker run --rm ghcr.io/xraph/forge:latest versionVerify the CLI
After installation, confirm the CLI is available:
forge versionYou should see version, commit, and build information printed to the terminal.
Add Forge to Your Project
Once the CLI is installed, set up Forge as a Go dependency in your project.
Initialize your Go module
If you are starting a new project, create a module first:
mkdir my-project && cd my-project
go mod init github.com/yourorg/my-projectAdd Forge as a dependency
go get github.com/xraph/forge@latestThis installs the core framework. Extensions are installed separately as needed:
# Examples of optional extensions
go get github.com/xraph/forge/extensions/database@latest
go get github.com/xraph/forge/extensions/kafka@latest
go get github.com/xraph/forge/extensions/grpc@latestVerify the library
Create a minimal main.go to confirm the library is working:
package main
import (
"fmt"
"github.com/xraph/forge"
)
func main() {
app := forge.New(
forge.WithAppName("install-check"),
)
fmt.Printf("Forge app created: %s\n", app.Name())
}Run it using the Forge CLI:
forge devYou should see the Forge startup banner with your application name and the address it is listening on.
Version Compatibility
Forge follows semantic versioning. The module path is github.com/xraph/forge.
When upgrading, always run:
go get github.com/xraph/forge@latest
go mod tidyExtensions share the same version as the core framework. Keep them in sync to avoid compatibility issues.
IDE Setup
VS Code
Install the official Go extension for full IntelliSense, debugging, and test support. Add these settings for the best experience:
{
"go.useLanguageServer": true,
"gopls": {
"ui.semanticTokens": true,
"ui.completion.usePlaceholders": true
}
}GoLand / IntelliJ
GoLand provides full support out of the box. Ensure the Go plugin is up to date and that the project SDK points to Go 1.21+.
Neovim
Use gopls as the language server with your preferred LSP client (nvim-lspconfig, coc.nvim, or similar).
Recommended Project Structure
Forge does not enforce a specific project layout, but the following structure works well for most applications:
my-project/
├── main.go # Application entry point
├── config.yaml # Base configuration
├── config.local.yaml # Local overrides (git-ignored)
├── .forge.yaml # Forge CLI configuration (optional)
├── go.mod
├── go.sum
├── internal/
│ ├── handlers/ # HTTP handler functions
│ │ └── users.go
│ ├── services/ # Business logic
│ │ └── user_service.go
│ ├── models/ # Data models
│ │ └── user.go
│ └── middleware/ # Custom middleware
│ └── auth.go
└── extensions/ # Custom extensions (if any)
└── notifications/
└── extension.goKey conventions:
main.gocreates the app, registers services and routes, and callsapp.Run().config.yamlis auto-discovered by Forge and loaded into the configuration manager.config.local.yamlprovides developer-specific overrides and should be added to.gitignore.internal/keeps packages private to your module, following standard Go conventions.
Configuration Files
Forge auto-discovers configuration files on startup. Place a config.yaml in your project root:
# config.yaml
server:
port: 8080
timeout: 30s
database:
host: localhost
port: 5432
name: myapp
logging:
level: infoCreate config.local.yaml for personal overrides (add this to .gitignore):
# config.local.yaml - developer-specific overrides
database:
host: 127.0.0.1
password: localdev
logging:
level: debugSee the Configuration guide for full details on auto-discovery, environment variables, and config binding.
Next Steps
How is this guide?