Open Source

The Auth Platform Native to Go. Built for Any Stack.

An open-source authentication solution that scales with you. Embed it as a library in your Go app, or run it as a standalone auth server for any language or framework.

Gomain.go
Library Mode
// Library Mode
import (
  "log"

  gobetterauth "github.com/GoBetterAuth/go-better-auth"
  gobetterauthconfig "github.com/GoBetterAuth/go-better-auth/config"
)

func main() {
  // Create GoBetterAuth configuration
  config := gobetterauthconfig.NewConfig(
    gobetterauthconfig.WithAppName("MyApp"),
    gobetterauthconfig.WithBaseURL("http://localhost:8080"),
    gobetterauthconfig.WithBasePath("/auth"),
    // ...more config options
  ) 
  
  // Initialise GoBetterAuth
  auth := gobetterauth.New(config)
  
  // Native http.ServeMux support
  http.Handle("/auth/", auth.Handler())
  
  // Start your Go application
  log.Fatal(http.ListenAndServe(":8080", nil))
}
server
Standalone Mode
config.toml
Config File
# Configure settings
app_name = "GoBetterAuth"
base_url = "http://localhost:8080"
base_path = "/auth"

[database]
provider = "postgres"

[email_password]
enabled = true

// and more to configure and customise...
bash
Deploy with Docker
docker run -itd -p 8080:8080 \
  -v $(pwd)/config.toml:/home/appuser/config.toml \
  -e GO_BETTER_AUTH_ADMIN_API_KEY=my-admin-api-key \
  -e GO_BETTER_AUTH_BASE_URL=http://localhost:8080 \
  -e GO_BETTER_AUTH_SECRET=my-app-secret \
  -e GO_BETTER_AUTH_DATABASE_URL=<your_connection_string> \
  ghcr.io/gobetterauth/go-better-auth:latest

Two Ways to Build

GoBetterAuth is designed to grow with your needs. Start simple as a library, or deploy as a centralised auth service for your entire platform.

Library Mode
Import directly into your Go application. Perfect for monoliths and simple services.
  • Native http.ServeMux compatibility
  • Zero network latency (in-process)
  • Full access to internal Go APIs
  • Share database connections
  • Compile into a single binary
Standalone Mode
Run as a standalone service. Ideal for microservices and multi-app platforms.
  • Centralised auth service
  • Works with any language
  • Live config updates
  • Scales independently
  • Docker & K8s ready

Flexible Configuration

Whether you're embedding as a library or running as a server, GoBetterAuth gives you full control over your authentication logic.

Library Configuration

Configure directly in Go using type-safe structs. Compiler verification ensures your config is always valid and consistent.

gobetterauth.New(config.NewConfig(...))

Standalone Configuration

Configure your server with a simple TOML file, then continue with Dynamic Configuration with all the settings stored in your database and update them via the API in real-time.

Database
API Updates

Everything you need for Auth

Production-ready features that would take months to build yourself.

Email & Password

Secure authentication with Argon2 hashing, email verification, password reset, and change email flows.

Social OAuth

Connect with Google, GitHub, Discord, and more. Extensible provider system.

Multiple Databases

First-class support for PostgreSQL, MySQL, SQLite, and custom adapters with migration scripts.

Secondary Storage

Redis/Key-Value support for high-performance sessions and rate limiting.

Enhanced Security

Built-in CSRF protection, secure session management, and configurable rate limiting.

Minimal Dependencies

Standard library first design. Production-ready and framework-agnostic.

Webhooks

Trigger external workflows on user signup, login, and other key events with configurable webhooks.

Engineered for Performance

GoBetterAuth brings the power of Go to authentication. Experience unmatched speed, efficiency, and flexibility compared to other solutions.

Feature
GoBetterAuth
Others
Runtime Performance
Blazing fast (Compiled Go)
Runtime overhead (Node.js/TS)
Memory Footprint
Minimal (Native binaries)
Heavy (Node.js runtime)
Deployment
Single static binary
Complex node_modules & runtime
Architecture
Library + Standalone Server
Mostly framework-bound
Type Safety
Native Go Type Safety
Transpiled TypeScript
Concurrency
Power of Goroutines
Single-threaded Event Loop

Blazing Fast

Go's compiled nature means sub-millisecond response times for authentication flows, even under heavy load.

Memory Efficient

Run your entire auth service with just a few megabytes of RAM. Perfect for edge deployments and cost-saving.

Truly Flexible

Not just for Go apps. Use it standalone and connect it with any web frontend such as React, Vue, and more.

Extensible Plugin System

Easily extend authentication flows with our plugin system—add custom logic, integrations, or providers with minimal effort.

Microservices Ready

Built for distributed systems—deploy as a lightweight service in your microservices architecture. Easily configure separate instances with different auth flows or plugins.

Security First

Built with Go's strong type safety and robust security features to keep your users and data protected.

Powerful Customisation

The Hooks System

Deeply customise behavior without forking. Inject logic at any stage of the authentication pipeline.

Endpoint Hooks

Modify requests and responses of the HTTP lifecycle.

BeforeResponseAfter

Database Hooks

Intercept data before or after it hits the database.

BeforeCreateAfterCreateBeforeUpdateAfterUpdate+ more

Event Hooks

Execute workflows after key authentication actions.

user.signed_upuser.logged_inuser.email_verified+ more

Webhooks

Notify external services when auth events occur.

User SignupEmail VerifiedPassword Reset+ more

Event Bus

Pub/Sub architecture for async workflows

Custom Routes

Add new endpoints to the auth server

Core Logic

Extend the core authentication engine

+

Your Plugin

Implement the Plugin interface

Extensible Plugin System &
Event-Driven Architecture

GoBetterAuth isn't just a black box. It's a platform designed to be extended. Use the built-in Event Bus to trigger external systems, or write full plugins to add custom business logic and routes.

Plugin Interface

Implement a simple Go interface to inject custom services, repositories, and HTTP handlers into the main application.

Event Bus

Subscribe to system events like user.signed_up or user.logged_in and more to trigger emails, analytics, or webhooks.

Built Natively in Go

No complex frameworks or adapters needed. GoBetterAuth works with the standard library and integrates seamlessly into your existing Go stack.

Standard Library Compatible

Works directly with net/http and http.ServeMux.

Type-Safe Context

Retrieve user data and claims with full type safety.

Zero Dependencies

Minimal external dependencies to keep your binary small.

Extensible Hooks

Hook into any stage of the auth pipeline with Go functions.

Open Source & Community Driven

GoBetterAuth is seeking community collaboration and open-source contributions. Your involvement—sharing code, offering feedback, and support will help shape the future of authentication. Join us on this journey to build the most flexible, configurable, and more secure authentication solution for everyone.

100%Open Source
DiscordCommunity Support
GitHubGitHubPull Requests Welcome

Released under the Apache 2.0 License