Extensions
Comprehensive guide to Forge extensions for building production-ready applications
Extensions
Forge extensions provide production-ready, plug-and-play functionality for common application requirements. Each extension follows a consistent architecture pattern with unified interfaces, comprehensive configuration options, and built-in observability.
All extensions support dependency injection, health checks, graceful shutdown, and observability out of the box.
Architecture Overview
Every Forge extension follows a consistent pattern:
type Extension interface {
Name() string
Version() string
Description() string
Dependencies() []string
Register(app forge.App) error
Start(ctx context.Context) error
Stop(ctx context.Context) error
Health(ctx context.Context) error
}Key Features
- Unified Interfaces: Consistent APIs across all extensions
- Multiple Backends: Support for various backend implementations
- Production Ready: Built-in connection pooling, retry logic, and error handling
- Observability: Metrics, tracing, and health checks included
- Configuration: YAML/JSON config files and programmatic configuration
- Security: TLS/mTLS, authentication, rate limiting, and input validation
Extension Categories
Core Extensions
Essential building blocks for any application
Communication
Real-time messaging, APIs, and streaming
Specialized
Advanced features for specific use cases
Core Extensions
Essential extensions for data management and application infrastructure:
AI
LLM integration, agents, inference engine, and model management
Auth
Authentication and authorization with multiple providers
Cache
High-performance caching with Redis, Memcached, and in-memory backends
Database
Unified database access for SQL and NoSQL databases
Queue
Message queuing with RabbitMQ, Redis, and in-memory backends
Search
Full-text search with Elasticsearch, OpenSearch, and Meilisearch
Storage
Object storage with S3, GCS, Azure Blob, and local filesystem
Communication Extensions
Real-time communication, APIs, and streaming capabilities:
Events
Event-driven architecture with multiple message brokers
GraphQL
GraphQL API with schema generation and federation
gRPC
High-performance RPC with protobuf and streaming
oRPC
Modern RPC with TypeScript support and OpenRPC
Streaming
Real-time WebSocket connections with rooms and presence
WebRTC
Peer-to-peer communication and media streaming
Specialized Extensions
Advanced features for specific use cases:
Consensus
Distributed consensus with Raft algorithm
Dashboard
Admin dashboard with metrics and monitoring
HLS
HTTP Live Streaming for video delivery
Kafka
Apache Kafka integration for event streaming
MCP
Model Context Protocol for AI tool integration
MQTT
IoT messaging with MQTT protocol
Quick Start
extensions:
database:
type: postgres
dsn: "postgres://user:pass@localhost/db"
max_open_conns: 25
max_idle_conns: 5
cache:
type: redis
addr: "localhost:6379"
db: 0
pool_size: 10
queue:
type: rabbitmq
url: "amqp://guest:guest@localhost:5672/"
exchange: "forge.events"package main
import (
"github.com/xraph/forge"
"github.com/xraph/forge/extensions/database"
"github.com/xraph/forge/extensions/cache"
"github.com/xraph/forge/extensions/queue"
)
func main() {
app := forge.New()
// Register extensions
app.RegisterExtension(database.New(database.Config{
Type: "postgres",
DSN: "postgres://user:pass@localhost/db",
}))
app.RegisterExtension(cache.New(cache.Config{
Type: "redis",
Addr: "localhost:6379",
}))
app.RegisterExtension(queue.New(queue.Config{
Type: "rabbitmq",
URL: "amqp://guest:guest@localhost:5672/",
}))
app.Run()
}Extension Status
| Extension | Status | LOC | Tests | Coverage | Backends |
|---|---|---|---|---|---|
| AI | ✅ Production | 15,000+ | 500+ | 85%+ | OpenAI, Anthropic, Azure, Ollama, HuggingFace |
| Auth | ✅ Production | 8,000+ | 300+ | 90%+ | JWT, OAuth2, SAML, LDAP |
| Cache | ✅ Production | 5,000+ | 200+ | 95%+ | Redis, Memcached, In-Memory |
| Database | ✅ Production | 10,000+ | 400+ | 88%+ | PostgreSQL, MySQL, SQLite, MongoDB |
| Events | ✅ Production | 12,000+ | 450+ | 87%+ | NATS, Redis, In-Memory |
| GraphQL | ✅ Production | 6,000+ | 250+ | 92%+ | Native Go, Federation |
| gRPC | ✅ Production | 7,000+ | 280+ | 89%+ | Native gRPC, Streaming |
| Queue | ✅ Production | 8,000+ | 350+ | 91%+ | RabbitMQ, Redis, In-Memory |
| Search | ✅ Production | 9,000+ | 320+ | 86%+ | Elasticsearch, OpenSearch, Meilisearch |
| Storage | ✅ Production | 7,500+ | 300+ | 93%+ | S3, GCS, Azure Blob, Local |
| Streaming | ✅ Production | 11,000+ | 400+ | 84%+ | WebSocket, Server-Sent Events |
| Consensus | 🚧 Beta | 20,000+ | 600+ | 82%+ | Raft, Multiple Transports |
| Dashboard | 🚧 Beta | 5,000+ | 150+ | 78%+ | Web UI, Metrics |
| HLS | 🚧 Beta | 4,000+ | 120+ | 75%+ | HTTP Live Streaming |
| Kafka | 🚧 Beta | 6,000+ | 200+ | 80%+ | Apache Kafka |
| MCP | 🚧 Beta | 3,000+ | 100+ | 85%+ | Model Context Protocol |
| MQTT | 🚧 Beta | 4,500+ | 150+ | 82%+ | MQTT v3.1.1, v5.0 |
| oRPC | 🚧 Beta | 5,500+ | 180+ | 88%+ | TypeScript, OpenRPC |
| WebRTC | 🚧 Beta | 8,000+ | 250+ | 79%+ | Peer-to-peer, Media |
Performance Targets
All extensions are designed with performance in mind:
- Latency: Sub-millisecond for cache operations, <10ms for database queries
- Throughput: 10,000+ operations/second per extension
- Memory: Efficient memory usage with connection pooling
- CPU: Optimized for multi-core systems
- Scalability: Horizontal scaling support
Security Features
Every extension includes comprehensive security features:
- TLS/mTLS: Encrypted connections with certificate validation
- Authentication: Multiple authentication mechanisms
- Authorization: Role-based access control
- Input Validation: Comprehensive input sanitization
- Rate Limiting: Configurable rate limiting and throttling
- Audit Logging: Detailed security event logging
Next Steps
- Choose Extensions: Select the extensions you need for your application
- Configuration: Set up configuration files or programmatic config
- Integration: Register extensions with your Forge application
- Monitoring: Set up observability and health checks
- Production: Deploy with proper security and scaling configuration
Start with the core extensions (Database, Cache, Queue) and add specialized extensions as your application grows.
How is this guide?
Last updated on