AuthMesh provides enterprise-grade multi-tenant authentication, RBAC, and security middleware with seamless Keycloak integration. Build secure applications faster with battle-tested components.
import "github.com/AuthMesh/authmesh/pkg/platform"
// Simple initialization
authMesh := platform.New(platform.Config{
Keycloak: platform.KeycloakConfig{
URL: "https://keycloak:9443",
},
Redis: platform.RedisConfig{
URL: "redis:6379",
},
})
// Simple middleware integration
router.Use(authMesh.AuthMiddleware())
router.Use(authMesh.RateLimitMiddleware())
router.Use(authMesh.ObservabilityMiddleware())
Built from 11,874+ lines of production-tested code with comprehensive security and observability
Complete tenant isolation with JWT validation, role-based access control, and secure data boundaries.
Seamless integration with Keycloak for enterprise identity management and single sign-on.
Redis-based rate limiting with tenant-specific quotas and multiple algorithm support.
Built-in Prometheus metrics, OpenTelemetry tracing, and structured logging for production monitoring.
Comprehensive security headers, CORS configuration, and SSRF protection out of the box.
Advanced TLS configuration utilities for secure communication in production environments.
Simple setup with sensible defaults, powerful configuration when you need it
go get github.com/AuthMesh/authmesh
git clone https://github.com/AuthMesh/authmesh
cd authmesh
make dev-up
package main
import (
"github.com/AuthMesh/authmesh/pkg/platform"
"github.com/gin-gonic/gin"
)
func main() {
// Initialize AuthMesh
authMesh := platform.New(platform.Config{
Keycloak: platform.KeycloakConfig{
URL: "https://keycloak:9443",
Realm: "master",
},
Redis: platform.RedisConfig{
URL: "redis:6379",
},
})
// Setup Gin router
router := gin.Default()
// Add AuthMesh middleware
router.Use(authMesh.AuthMiddleware())
router.Use(authMesh.RateLimitMiddleware())
router.Use(authMesh.ObservabilityMiddleware())
// Protected route
router.GET("/api/protected", func(c *gin.Context) {
user := authMesh.GetUser(c)
c.JSON(200, gin.H{
"message": "Hello " + user.Name,
"tenant": user.Tenant,
"roles": user.Roles,
})
})
router.Run(":8080")
}
Everything you need to build secure, scalable applications
Complete examples with Docker, testing, and production configurations
Complete example application with authentication, rate limiting, and observability.
Advanced example with custom middleware, gRPC integration, and custom metrics.
Step-by-step migration examples from popular authentication libraries.
Get help, share knowledge, and contribute to AuthMesh