Forgeβ’ is a backend framework, and Forge Cloudβ’ is its AI cloud offering, maintained by XRAPHβ’.
Enterprise-Grade Web Framework for Go
Build scalable, maintainable, and observable Go applications with Forgeβthe modern framework that brings clean architecture, dependency injection, and powerful extensions to your production services.
# Install the Forge CLI
go install github.com/xraph/forge/cmd/forge@latest
# Verify installation
forge --version# Initialize a new project
forge init my-app
# Start the development server
forge devpackage main
import "github.com/xraph/forge"
func main() {
// Create app with default configuration
app := forge.NewApp(forge.AppConfig{
Name: "my-app",
Version: "1.0.0",
Environment: "development",
HTTPAddress: ":8080",
})
// Register routes
router := app.Router()
router.GET("/", func(ctx forge.Context) error {
return ctx.JSON(200, map[string]string{
"message": "Hello, Forge v2!",
})
})
// Run the application (blocks until SIGINT/SIGTERM)
app.Run()
}Built-in endpoints:
/_/info- Application information/_/metrics- Prometheus metrics/_/health- Health checks
- β Dependency Injection - Type-safe container with service lifecycle
- β HTTP Router - Fast, lightweight routing with middleware support
- β Middleware - Auth, CORS, logging, rate limiting, and more
- β Configuration - YAML/JSON/TOML support with environment variable override
- β Observability - Structured logging, metrics, distributed tracing
- β Health Checks - Automatic discovery and reporting
- β Lifecycle Management - Graceful startup and shutdown
| Extension | Description | Status |
|---|---|---|
| AI | LLM integration, agents, inference engine | β |
| Auth | Multi-provider authentication (OAuth, JWT, SAML) | β |
| Cache | Multi-backend caching (Redis, Memcached, In-Memory) | β |
| Consensus | Raft consensus for distributed systems | β |
| Database | SQL (Postgres, MySQL, SQLite) + MongoDB support | β |
| Events | Event bus and event sourcing | β |
| GraphQL | GraphQL server with schema generation | β |
| gRPC | gRPC server with reflection | β |
| HLS | HTTP Live Streaming | β |
| Kafka | Apache Kafka integration | β |
| MCP | Model Context Protocol | β |
| MQTT | MQTT broker and client | β |
| orpc | ORPC transport protocol | β |
| Queue | Message queue management | β |
| Search | Full-text search (Elasticsearch, Typesense) | β |
| Storage | Multi-backend storage (S3, GCS, Local) | β |
| Streaming | WebSocket, SSE, WebRTC | β |
| WebRTC | Real-time peer-to-peer communication | β |
- β Project Scaffolding - Initialize new projects with templates
- β Code Generation - Generate handlers, controllers, and services
- β Database Migrations - Schema management with versioning
- β Interactive Prompts - Arrow-key navigation, multi-select
- β Server Management - Development server with hot reload
- β Testing - Built-in test runner and coverage reports
- AI Extension - LLM integration and AI agents
- Auth Extension - Authentication providers
- Database Extension - SQL and NoSQL databases
- GraphQL Extension - GraphQL server
- gRPC Extension - gRPC services
- Streaming Extension - WebSocket and SSE
Forge is built for production from day one:
- β Graceful Shutdown - Proper resource cleanup on SIGTERM
- β Health Monitoring - Automatic discovery and reporting
- β Observability - Metrics, logging, and distributed tracing
- β Error Handling - Comprehensive error management
- β Security - Built-in security best practices
- β Type Safety - Generics and compile-time guarantees
- β Zero Config - Sensible defaults with full customization
- β Hot Reload - Instant feedback during development
- β CLI Tools - Fast project scaffolding and generation
- β Rich Docs - Comprehensive documentation and examples
- β Low Latency - Optimized HTTP router and middleware
- β Efficient Routing - Trie-based path matching
- β Concurrent Safe - Thread-safe components
- β Memory Efficient - Minimal allocations
- β Extension System - Modular, composable extensions
- β Plugin Architecture - Easy to add custom functionality
- β Multi-Backend - Switch implementations without code changes
- β Middleware Chain - Powerful middleware composition
// Application Structure
app := forge.NewApp(forge.AppConfig{
Name: "my-service",
Version: "1.0.0",
Environment: "production",
// Extensions
Extensions: []forge.Extension{
database.NewExtension(database.Config{
Databases: []database.DatabaseConfig{
{
Name: "primary",
Type: database.TypePostgres,
DSN: "postgres://localhost/mydb",
},
},
}),
auth.NewExtension(auth.Config{
Provider: "oauth2",
// ... auth configuration
}),
},
})
// Dependency Injection
forge.RegisterSingleton(app.Container(), "userService", func(c forge.Container) (*UserService, error) {
db, err := database.GetSQL(c)
if err != nil {
return nil, err
}
logger := forge.Must[forge.Logger](c, "logger")
return NewUserService(db, logger), nil
})
// Routing
router := app.Router()
router.GET("/users/:id", getUserHandler)
router.POST("/users", createUserHandler)
// Run
app.Run()package main
import (
"github.com/xraph/forge"
"github.com/xraph/forge/extensions/ai"
)
func main() {
app := forge.NewApp(forge.AppConfig{
Extensions: []forge.Extension{
ai.NewExtension(ai.Config{
LLMProviders: map[string]ai.LLMProviderConfig{
"openai": {
APIKey: os.Getenv("OPENAI_API_KEY"),
Model: "gpt-4",
},
},
}),
},
})
// Access AI service via DI using helper function
aiService, err := ai.GetAIService(app.Container())
if err != nil {
log.Fatal(err)
}
// Use in your handlers
router := app.Router()
router.POST("/chat", func(ctx forge.Context) error {
result, err := aiService.Chat(ctx, ai.ChatRequest{
Messages: []ai.Message{
{Role: "user", Content: "Hello!"},
},
})
if err != nil {
return err
}
return ctx.JSON(200, result)
})
app.Run()
}- Go 1.24+ - Latest Go compiler
- Make - Build tool (optional but recommended)
# Build the CLI
make build
# Build with debug symbols
make build-debug
# Build for all platforms
make release# Run all tests
make test
# Run with coverage
make test-coverage
# Run specific package
go test ./extensions/ai/...# Format code
make fmt
# Run linter
make lint
# Fix linting issues
make lint-fix
# Run security scan
make security-scan
# Check vulnerabilities
make vuln-check# Start development server
forge dev
# Start with hot reload
forge dev --watch
# Start on custom port
forge dev --port 3000- β Dependency Injection - Production ready
- β HTTP Router - Fast, lightweight
- β Middleware System - Comprehensive
- β Configuration - Multi-format support
- β Observability - Metrics, logging, tracing
- β Health Checks - Automatic discovery
- β CLI Tools - Full-featured CLI
Production Ready (14):
- β AI - LLM integration and agents
- β Auth - Multi-provider authentication
- β Cache - Multi-backend caching
- β Consensus - Raft consensus
- β Database - SQL and NoSQL
- β Events - Event bus and sourcing
- β GraphQL - GraphQL server
- β gRPC - gRPC services
- β HLS - HTTP Live Streaming
- β Kafka - Apache Kafka
- β MCP - Model Context Protocol
- β MQTT - MQTT broker
- β Storage - Multi-backend storage
- β Streaming - WebSocket, SSE, WebRTC
In Progress (3):
- π Queue - Message queue management
- π Search - Full-text search
- π orpc - ORPC transport protocol
The examples/ directory contains production-ready examples:
- Minimal App - Hello World
- Configuration - Config management
- Database - Database integration
- Auth - Authentication
- GraphQL - GraphQL server
- gRPC - gRPC services
- WebRTC - Real-time communication
- MCP - Model Context Protocol
- AI Agents - AI agent system
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
# Fork and clone
git clone https://github.com/your-username/forge.git
cd forge
# Install tools
make install-tools
# Make changes
# ...
# Run tests
make test
# Check code quality
make ci
# Commit with conventional commits
git commit -m "feat: add new feature"feat: add new feature
fix: fix bug in router
docs: update documentation
style: format code
refactor: refactor DI container
perf: optimize routing performance
test: add tests for middleware
chore: update dependenciesThis project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Built with β€οΈ by Rex Raphael
Special thanks to:
- Bun - SQL ORM
- Uptrace - Observability platform
- Chi - Router inspiration
- All contributors and maintainers
- Documentation - Comprehensive docs
- GitHub - Source code
- Issues - Bug reports
- Discussions - Questions and ideas
- Examples - Code examples
- CLI Reference - CLI documentation
Forge uses a dual-licensing approach:
The core framework and most extensions are licensed under the MIT License - one of the most permissive open source licenses.
β Use freely for:
- Commercial products and services
- Personal projects
- Closed-source applications
- Modifications and distributions
See the LICENSE file for full terms.
The AI Extension (extensions/ai/) uses a more restrictive Commercial Source-Available License.
β Free for:
- Personal projects
- Educational purposes
- Research and academic use
- Internal evaluation (90 days)
β Commercial license required for:
- Production deployments
- Commercial products/services
- Revenue-generating applications
See extensions/ai/LICENSE for full terms or LICENSING.md for the complete licensing guide.
Need a commercial license? Contact: licensing@xraph.com
- Complete remaining extensions (Queue, Search, orpc)
- Enhanced AI agent orchestration
- Real-time collaboration features
- Advanced monitoring dashboard
- Kubernetes operator
- Helm charts and deployment automation
- Advanced caching strategies
- Performance optimization pass
- TypeScript/Node.js runtime
- Multi-language code generation
- Enhanced observability platform
- Enterprise features (SLA, auditing, compliance)
Ready to build? Get Started β