Production Ready v1.0.0

Production-Ready Go
Authentication Library

AuthMesh provides enterprise-grade multi-tenant authentication, RBAC, and security middleware with seamless Keycloak integration. Build secure applications faster with battle-tested components.

85% Test Coverage
100% Test Pass Rate
11K+ Lines of Code
234+ Tests
main.go
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())

Enterprise-Grade Features

Built from 11,874+ lines of production-tested code with comprehensive security and observability

Multi-Tenant Security

Complete tenant isolation with JWT validation, role-based access control, and secure data boundaries.

  • JWT middleware with tenant claims
  • RBAC enforcement
  • Secure tenant isolation

Keycloak Integration

Seamless integration with Keycloak for enterprise identity management and single sign-on.

  • Realm management
  • User & role synchronization
  • SSO & federation support

Rate Limiting

Redis-based rate limiting with tenant-specific quotas and multiple algorithm support.

  • Per-tenant rate limits
  • Multiple algorithms
  • Redis clustering support

Observability

Built-in Prometheus metrics, OpenTelemetry tracing, and structured logging for production monitoring.

  • Prometheus metrics
  • OpenTelemetry tracing
  • Structured logging

Security Middleware

Comprehensive security headers, CORS configuration, and SSRF protection out of the box.

  • Security headers
  • CORS configuration
  • SSRF protection

Production TLS

Advanced TLS configuration utilities for secure communication in production environments.

  • TLS best practices
  • Certificate management
  • Cipher suite optimization

Get Started in Minutes

Simple setup with sensible defaults, powerful configuration when you need it

1

Install AuthMesh

go get github.com/AuthMesh/authmesh
2

Start Development Environment

git clone https://github.com/AuthMesh/authmesh
cd authmesh
make dev-up
3

Initialize AuthMesh

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")
}

Comprehensive Documentation

Everything you need to build secure, scalable applications

Real-World Examples

Complete examples with Docker, testing, and production configurations

Basic Application

Go Docker Keycloak

Complete example application with authentication, rate limiting, and observability.

JWT Auth Multi-tenant Rate Limiting Metrics

Advanced Features

Go gRPC Prometheus

Advanced example with custom middleware, gRPC integration, and custom metrics.

Custom Middleware gRPC Custom Metrics Tracing

Migration Examples

Migration Guide

Step-by-step migration examples from popular authentication libraries.

From JWT-Go From Casbin From OAuth2

Join the Community

Get help, share knowledge, and contribute to AuthMesh