jwt

A zero-dependency Go implementation of JSON Web Tokens (JWT) with pluggable HMAC, RSA, RSA-PSS, ECDSA, and Ed25519 signing methods.

Library
Go
vv5.3.1
9,251 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
68 /100 Good
Development Activity 64
Maintenance 48
Community 60
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
83 /100 Excellent
Architecture 80
Code Quality 85
Innovation 80
Learning Curve 85

golang-jwt/jwt is the community-maintained continuation of the original dgrijalva/jwt-go, implementing the JSON Web Token standard (RFC 7519) for Go applications. It provides a Token type and Parser for creating, signing, and verifying JWTs, with a pluggable SigningMethod registry that ships HMAC-SHA, RSA, RSA-PSS, ECDSA, and EdDSA/Ed25519 out of the box.

Beyond signature verification, the library includes a dedicated Validator for checking expiration, not-before, issued-at, audience, issuer, and subject claims, plus support for fully custom claim types via the Claims interface. A companion request sub-package adds extractors for pulling tokens out of HTTP headers, query parameters, and OAuth2-style forms, making it a complete building block for stateless authentication in Go services.

What You Get

  • A Token type plus New/NewWithClaims/Parse/ParseWithClaims functions for building and verifying JWTs
  • Built-in signing methods for HMAC-SHA (HS256/384/512), RSA and RSA-PSS, ECDSA, and EdDSA/Ed25519 behind a common SigningMethod interface
  • A validation API (Validator, ParserOptions) for expiration, not-before, issued-at, audience, issuer, and subject claim checks with configurable leeway
  • MapClaims and RegisteredClaims implementations of the Claims interface, with support for fully custom claim types
  • A request sub-package with extractors for pulling tokens out of HTTP headers, query params, and OAuth2-style forms

Common Use Cases

  • Issuing and verifying bearer tokens for stateless API authentication
  • Implementing OAuth2-style access tokens for a Go backend service
  • Validating third-party JWTs (e.g. from an identity provider) before trusting their claims
  • Embedding custom application claims (roles, tenant IDs) in a signed token passed between services

Under The Hood

Architecture - A Token struct holds Raw/Method/Header/Claims/Signature/Valid. New/NewWithClaims build a Token; SignedString computes the signing string (base64url-encoded JSON header and claims joined by ’.’), calls Method.Sign to produce a signature, and appends it. Parsing flows through Parse/ParseWithClaims into ParseUnverified, which splits the token into three segments, base64-decodes header/claims/signature, and resolves the SigningMethod from the header’s alg via a global registry. ParseWithClaims then checks the method against an optional allow-list, invokes the caller-supplied Keyfunc to obtain a verification key (a single key or a VerificationKeySet for key rotation), calls Method.Verify, and runs Validator.Validate for claim checks (exp/nbf/iat/aud/iss/sub) unless skipped. SigningMethod is a minimal interface (Sign/Verify/Alg) backed by a registry map guarded by sync.RWMutex, populated via init() in each algorithm file, letting third parties register new algorithms without touching core code. A request sub-package layers pluggable Extractors on top for pulling raw tokens out of *http.Request.

Tech Stack - Pure Go standard library: go.mod declares module github.com/golang-jwt/jwt/v5 at go 1.21 with an empty go.sum (zero third-party dependencies). It relies solely on crypto, crypto/hmac, crypto/rsa, crypto/ecdsa, crypto/ed25519, encoding/base64, encoding/json, and slices/errors from stdlib, with GitHub Actions driving CI. This zero-dependency, stdlib-only design is a deliberate strength for a security-sensitive library, minimizing supply-chain surface area.

Code Quality - 19 _test.go files against 27 non-test .go files, covering nearly every signing algorithm plus parser and validator logic (parser_test.go alone runs to 36KB), with example_test.go and http_example_test.go serving as executable documentation. Errors are modeled as sentinel vars wrapped through a custom newError/joinedError helper supporting Go 1.20+ multi-error %w wrapping compatible with errors.Is/As, rather than ad hoc string errors. Naming is idiomatic and consistent, and doc comments are extensive with links to the project’s usage guide.

API Design - Getting started is a two-line NewWithClaims(…).SignedString(key) / Parse(token, keyFunc) pair with sane MapClaims defaults, while ParserOption functional options and the Keyfunc callback pattern (including VerificationKeySet for rotation) allow full customization. Doc comments proactively flag security footguns directly on exported functions - e.g. always validating alg and avoiding low-entropy HMAC secrets - which is a strong signal for a cryptography-adjacent library. The one notable friction point is a documented pointer/allocation caveat when embedding RegisteredClaims in custom claim types.

Used by 66 apps in this directory

Go
49%
Other

Cosmos-Server

Authentication · Security

6,183

All-in-one self-hosted home server with SmartShield anti-DDoS, Nebula mesh VPN, automatic HTTPS, and a 250-app marketplace — all secured behind a unified auth layer.

View details
82
Repo Health
59
Technical
65
Dependency
Built with
Go 49%
JavaScript 48%
Updated 1 weeks ago
Go
88%
AGPL 3.0

Cozy Stack

File Storage · Productivity

1,268

Self-hosted personal cloud platform that unifies your files, apps, and devices in one private space you fully control.

View details
95
Repo Health
77
Technical
67
Dependency
Built with
Go 88%
Updated 1 weeks ago
Go
33%
Apache 2.0

CubeSandbox

AI Agents · Developer Tools · Security

13,023

Instant, concurrent, hardware-isolated MicroVM sandboxes for AI agents — E2B-API compatible, sub-60ms cold starts, and a built-in zero-trust egress proxy, all self-hostable at scale.

View details
84
Repo Health
88
Technical
63
Dependency
Built with
Go 33%
Rust 26%
C 22%
Updated 1 weeks ago
Go
75%
MIT

Digger

Automation · Developer Tools · Devops

5,057

Run Terraform and OpenTofu natively inside your existing CI pipeline — no separate runners, no third-party secrets, no extra compute costs.

View details
78
Repo Health
73
Technical
66
Dependency
Built with
Go 75%
TypeScript 15%
Updated 1 weeks ago
Go
38%
MIT

ezBookkeeping

Invoicing Finance

5,814

Lightweight self-hosted personal finance manager with AI receipt scanning, multi-currency support, and MCP integration for complete data privacy.

View details
88
Repo Health
80
Technical
71
Dependency
Built with
Go 38%
Vue 33%
TypeScript 25%
Updated 1 weeks ago
Go
66%
AGPL 3.0

Fider

Customer Support · Product Management

4,586

Open-source feedback portal where customers submit, vote on, and track feature requests so product teams build what actually matters.

View details
88
Repo Health
85
Technical
65
Dependency
Built with
Go 66%
TypeScript 28%
Updated 1 weeks ago
Go
52%
AGPL 3.0

Filestash

File Storage

14,824

A self-hosted file management platform that unifies access to S3, SFTP, SMB, FTP, WebDAV, NFS, Git, SharePoint, and 20+ other storage backends through a single extensible web interface.

View details
79
Repo Health
67
Technical
67
Dependency
Built with
Go 52%
JavaScript 34%
Updated 1 weeks ago
Go
76%
Other

Flipt

Developer Tools · Devops

4,926

Git-native feature flag platform that stores, versions, and deploys feature toggles directly in your own Git repositories with no external database required.

View details
90
Repo Health
83
Technical
68
Dependency
Built with
Go 76%
TypeScript 23%
Updated 6 days ago
Go
83%
MIT

Gitea

Developer Tools · Devops · Project Management

58,668

Self-hosted DevOps in a single Go binary — Git hosting, GitHub Actions-compatible CI/CD, and 30+ package registries without any SaaS dependency.

View details
93
Repo Health
79
Technical
64
Dependency
Built with
Go 83%
Updated 6 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers