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 extensions for data management and application infrastructure:

Communication Extensions

Real-time communication, APIs, and streaming capabilities:

Specialized Extensions

Advanced features for specific use cases:

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

ExtensionStatusLOCTestsCoverageBackends
AI✅ Production15,000+500+85%+OpenAI, Anthropic, Azure, Ollama, HuggingFace
Auth✅ Production8,000+300+90%+JWT, OAuth2, SAML, LDAP
Cache✅ Production5,000+200+95%+Redis, Memcached, In-Memory
Database✅ Production10,000+400+88%+PostgreSQL, MySQL, SQLite, MongoDB
Events✅ Production12,000+450+87%+NATS, Redis, In-Memory
GraphQL✅ Production6,000+250+92%+Native Go, Federation
gRPC✅ Production7,000+280+89%+Native gRPC, Streaming
Queue✅ Production8,000+350+91%+RabbitMQ, Redis, In-Memory
Search✅ Production9,000+320+86%+Elasticsearch, OpenSearch, Meilisearch
Storage✅ Production7,500+300+93%+S3, GCS, Azure Blob, Local
Streaming✅ Production11,000+400+84%+WebSocket, Server-Sent Events
Consensus🚧 Beta20,000+600+82%+Raft, Multiple Transports
Dashboard🚧 Beta5,000+150+78%+Web UI, Metrics
HLS🚧 Beta4,000+120+75%+HTTP Live Streaming
Kafka🚧 Beta6,000+200+80%+Apache Kafka
MCP🚧 Beta3,000+100+85%+Model Context Protocol
MQTT🚧 Beta4,500+150+82%+MQTT v3.1.1, v5.0
oRPC🚧 Beta5,500+180+88%+TypeScript, OpenRPC
WebRTC🚧 Beta8,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

  1. Choose Extensions: Select the extensions you need for your application
  2. Configuration: Set up configuration files or programmatic config
  3. Integration: Register extensions with your Forge application
  4. Monitoring: Set up observability and health checks
  5. 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