iron-session
Reasonable, with limits. 4th of 10 authentication libraries.
iron-session is a small library that stores session data in encrypted, signed cookies. It works with Next.js (App Router, Proxy), Express and web-standard runtimes. It is well kept and safe, and the Next.js docs recommend it. It only handles sessions, though: you build sign-in, OAuth and user storage yourself, or pick a full library such as Better Auth.
Best for: Teams that already handle sign-in themselves and want simple, database-free encrypted cookie sessions, especially in Next.js.
Scores
Overall6.8
How strongly do we recommend it for a new project today?
Claude Opus 5.5: 6.5, likely 5.5 to 7.5
It is the best simple choice for encrypted cookie sessions when you own the sign-in logic, and it is maintained, safe and recommended by Next.js. For most new apps that need full authentication, Better Auth or Auth.js do more of the job, so it ranks below them for the category as a whole. The range is wide because the score depends on whether you need only sessions.
- nextjs.org/docs/app/guides/authentication: Official recommendation for sessions
- github.com/vvo/iron-session/releases: Active v9 line in 2026
- peers Better Auth downloads: Full-featured peer growing much faster, 76M versus 1.8M
GPT-6.2 Sol: 7.1, likely 6.0 to 8.2
Pick iron-session when the app already handles identity and needs encrypted cookie sessions without a session database. Better Auth is the stronger default when a new project also needs sign-in, account management, and immediate session revocation. Fresh releases and framework guidance support adopting v9.1, while concentrated release ownership and limited independent production evidence for v9 keep the range open.
- github.com/vvo/iron-session/releases/tag/v9.1.0: Current stable release fixes cookie expiry and improves the examples.
- tanstack.com/start/latest/docs/framework/react/guide/authentication: Shows current v9 integration in a framework authentication guide.
- better-auth.com/docs/introduction: Peer offers sign-in, accounts, and session management in one library.
- blog.logrocket.com/best-auth-library-nextjs-2026: Independent testing favors Better Auth for new self-hosted Next.js projects needing full authentication.
- github.com/vvo/iron-session/blob/main/SECURITY.md: Release control rests with one maintainer.
Needed by many4.8
How many developers need a tool for this job?
Claude Opus 5.5: 5.0, likely 4.0 to 6.0
Most server-rendered web apps need sessions, but this project covers only that part of the auth job. Its users are mostly people who write their own sign-in, often in Next.js. Recent adapters for web-standard runtimes widen it beyond Next.js.
- github.com/vvo/iron-session: Adapters for Node, Next.js App Router and Proxy, Hono, Bun, Deno, Workers
- nextjs.org/docs/app/guides/authentication: Listed under session management libraries, separate from full auth libraries
GPT-6.2 Sol: 4.5, likely 3.4 to 5.7
Keeping users signed in is common in web apps, and the cookie adapters work across frameworks and runtimes. The fit narrows to apps that want stateless browser sessions and already have a way to sign users in. Framework surveys show the size of the surrounding ecosystem, while demand for standalone cookie sessions is harder to measure.
- survey.stackoverflow.co/2026/technology/data/web-framework: Web technology respondents report 46.4% Node.js and 20.6% Next.js use.
- github.com/vvo/iron-session#runtimes: Adapters cover Next.js, Express, and runtimes with standard web APIs.
- nextjs.org/docs/app/guides/authentication: Documents stateless and database sessions as distinct options.
Helps a lot7.3
How well does it do the job for those who need it?
Claude Opus 5.5: 7.0, likely 6.0 to 8.0
It does cookie sessions well. v9 brought Proxy support, chunked cookies, better types, onUnsealError and fixes for silent session bugs, and its cookies work with v8 in both directions. It scores below full libraries because it leaves sign-in, revocation and user management to you. Its small, stable API is easy for AI agents to write correctly.
- github.com/vvo/iron-session/releases: v9 features: nextProxyCookies, chunk option, onUnsealError, bug fixes
- dev.to/cibrax/cookie-based-authentication-for-nextjs-13-apps-4bad: Developer picked a cookie session library over next-auth for email/password auth
- tooling-2ry.pages.dev/docs/categories/auth: Roundup calls it a minimal session library for small apps
- npm hasTypes: Ships TypeScript types
GPT-6.2 Sol: 7.6, likely 6.5 to 8.7
Version 9.1 reads sessions without a network call and gives developers typed adapters, rejection diagnostics, and examples for common frameworks. Version 9 fixed a reported Next.js middleware write problem, and 9.1 corrected expiry handling for browser-session cookies. Applications still own refresh logic and immediate revocation. The small API and documented examples give coding agents a clear starting point, though independent measurements of v9 performance and agent accuracy are sparse.
- github.com/vvo/iron-session: Documents typed session reads, rejection diagnostics, cookie limits, and revocation behavior.
- github.com/vvo/iron-session/issues/938: User-reported middleware write problem addressed by the v9 adapter.
- github.com/vvo/iron-session/releases/tag/v9.1.0: Fixes seal expiry for browser-session cookies and improves error handling.
- reddit.com/r/nextjs/comments/1i2m3k4/how_do_i_do_refresh_token_rotation_once_again_w: User describes the work of implementing refresh-token rotation in an app.
Holds up over time6.8
Will it still be a good choice in two years?
Claude Opus 5.5: 7.0, likely 5.5 to 8.0
The project is active, with v9.0 in August 2026 and v9.1 in November 2026. It has 6 releases and 31 commits in the last year, and only 2 issues and 1 PR are open. The risk is one owner with little outside funding. The v9 ESM-only and Node 22 change is a real break, though it was handled carefully with cookie compatibility in both directions.
- github releasesLastYear / commitsLastYear: 6 releases, 31 commits
- github openIssues / closedIssues: 2 open versus 227 closed
- github.com/vvo/iron-session/releases: v9 breaking changes with a documented upgrade path
- scorecard Maintained: Score 10
GPT-6.2 Sol: 6.5, likely 5.2 to 7.7
The project recorded 31 commits and six GitHub releases in the past year, including prereleases, with v9.1 shipped in November. The v9 upgrade raised the Node minimum and changed how session data is typed, while keeping v8 cookies readable in both directions for rollback. A reported middleware issue took nearly nine months to reach a fix, and one maintainer controls releases. The project lists sponsorship, while funding continuity and release succession are unclear.
- github.commitsLastYear, github.releasesLastYear, npm.versionsLastYear: 31 commits, six GitHub releases, and three npm versions.
- github.com/vvo/iron-session/blob/main/MIGRATION.md: Documents the Node and ESM changes and v8 cookie compatibility.
- github.com/vvo/iron-session/issues/938: Middleware report opened in December 2025 and closed in August 2026.
- github.com/vvo/iron-session/blob/main/SECURITY.md: Documents a single maintainer authorized to start releases.
- github.com/vvo/iron-session/releases/tag/v9.1.0: November maintenance release records TurnShift sponsorship.
Used widely4.7
How many use it, and is that growing?
Claude Opus 5.5: 5.0, likely 4.0 to 6.0
Downloads were 14.5M in the last 4 weeks, against 2.3M a year earlier. That ratio of 6.3 is above the median of 4.1, so it is gaining ground. Part of the download count likely comes from packages that install it, such as auth wrappers. 900 dependent repos is modest next to Auth.js (19,200) and Passport, and Bluesky and Hacker News attention is minimal.
- npm downloadsLast4Weeks / downloadsSame4WeeksYearAgo: 14.5M versus 2.3M, ratio about 6.3
- dependents: 900 repos, 39 packages
- bluesky posts: Only 3 posts
- ramonmalcolm10.github.io/ideal-auth/migration/from-better-auth: Other auth libraries build on iron-session
GPT-6.2 Sol: 4.4, likely 3.2 to 5.7
Four-week downloads rose from 2.30 million to 14.54 million, or 6.33 times the prior year, above the catalog median of 4.1. The index found 900 dependent repositories and 39 packages, fewer than Auth.js's 19,200 repositories and more than SuperTokens's 597. Its 4,155 stars and three Bluesky posts show modest attention beside the category leaders. Build installs and indirect use through packages such as AuthKit make it hard to tell how much of the growth came from teams choosing iron-session directly.
- npm.downloadsLast4Weeks, npm.downloadsSame4WeeksYearAgo, medianDownloadsRatio: 6.33 times year-over-year growth against a 4.1 catalog median.
- dependents, peers: 900 indexed repositories and 39 packages, with much wider indexed use for Auth.js.
- github.stars, bluesky.posts, peers: 4,155 stars and three posts, versus 30,800 stars and 18 posts for Better Auth.
- github.com/workos/authkit-nextjs/blob/main/package.json: AuthKit installs iron-session as a runtime dependency.
Vouched for6.5
Who stands behind it being good?
Claude Opus 5.5: 6.0, likely 4.5 to 7.0
Its main endorsement is current: the official Next.js authentication guide lists it next to jose as a recommended session library. Small libraries such as ideal-auth and Iron Auth build on it. I found no developer survey data, independent benchmarks or named large production users.
- nextjs.org/docs/app/guides/authentication: Recommended session management library in the Next.js docs
- github.com/iron-auth/iron-auth: Built on iron-session
- hackerNews stories: No Hacker News stories
GPT-6.2 Sol: 6.9, likely 5.7 to 8.0
Next.js recommends iron-session for session management, and TanStack Start demonstrates the v9 adapter in its authentication guide. WorkOS uses v8 in its Next.js AuthKit SDK, and an independent hands-on comparison exercised that integration. Those sources support the cookie-session use case, with more limited independent evidence for v9.1 in production or its performance against peers.
- nextjs.org/docs/app/guides/authentication: Official Next.js guidance recommends iron-session for session management.
- tanstack.com/start/latest/docs/framework/react/guide/authentication: Official TanStack Start guide demonstrates the v9 adapter.
- github.com/workos/authkit-nextjs/blob/main/package.json: WorkOS AuthKit for Next.js declares iron-session v8 as a runtime dependency.
- blog.logrocket.com/best-auth-library-nextjs-2026: Independent Next.js comparison describes iron-session in the tested AuthKit flow.
Safe7.8
How safe is it to depend on?
Claude Opus 5.5: 8.0, likely 7.0 to 9.0
It has no advisories ever, two runtime dependencies built on the proven @hapi/iron design via iron-webcrypto, and an MIT licence. Releases now go out from CI with npm provenance. The Scorecard is 6.8: code review, SAST and fuzzing score 0, which fits a single-maintainer project.
- advisories total: 0 advisories
- npm dependencies: 2 dependencies
- scorecard: 6.8 overall; Code-Review 0, SAST 0, Fuzzing 0
- github.com/vvo/iron-session/releases: v9.0.1 republished from CI with provenance
GPT-6.2 Sol: 7.5, likely 6.3 to 8.6
The MIT package has two runtime dependencies, secure cookie defaults, and zero advisories in the supplied OSV snapshot. The v9.0.0 publish lacked provenance, and v9.0.1 republished the same code from CI with provenance that day. The v9.1 release workflow checks for a provenance record, and one maintainer controls releases. OpenSSF's 6.8 score includes zeroes for code review, fuzzing, and static analysis, which limits confidence in how consistently issues would be caught.
- npm.dependencies, npm.license, advisories.total: Two runtime dependencies, MIT license, and zero OSV advisories.
- scorecard.score, scorecard.checks: 6.8 overall, with zeroes for code review, fuzzing, and static analysis.
- github.com/vvo/iron-session/releases/tag/v9.0.1: Documents the missing v9.0.0 provenance and the same-day CI republish.
- github.com/vvo/iron-session/blob/v9.1.0/.github/workflows/release.yaml: The release workflow checks for npm provenance after publishing.
- github.com/vvo/iron-session/blob/main/SECURITY.md: Published security policy and release authority held by a single maintainer.
Good
- The API is tiny: one getIronSession() call, with adapters for App Router, Next.js Proxy, Express, Hono, Bun, Deno and Workers.
- Sessions need no database or session store, with key rotation and optional chunking for data over 4 KB.
- It has no known advisories, only two runtime dependencies, and releases are published from CI with npm provenance since v9.0.1.
- The official Next.js authentication guide names it as one of two recommended session libraries.
Bad
- It does not sign users in: no OAuth providers, passwords, MFA or user tables, which Better Auth or Auth.js provide.
- Stateless cookies cannot be revoked on the server, so 'log out all devices' needs extra work.
- v9 is ESM-only and needs Node 22.13+, so older projects must stay on v8.
- One owner does most of the work, and the Scorecard shows no code review on changes.
The numbers
- npm downloads, 4 weeks
- 15M ×6.3 in a year
- GitHub stars
- 4.2k
- Commits, 12 months
- 31
- npm version
- 9.1.0 Nov 2026
- Versions, 12 months
- 3
- Advisories, 24 months
- 0 of 0 ever
- OpenSSF Scorecard
- 6.8 out of 10, Nov 2026
- Licence
- MIT
Read on 21 November 2026 from GitHub (vvo/iron-session), npm (iron-session), OSV and the OpenSSF Scorecard.
Authentication libraries
- 8.5Better Auth
- 8.3jose
- 7.9openid-client
- 6.8iron-session
- 6.3SuperTokens
- 5.2jsonwebtoken
- 4.9Passport
- 4.0Auth.js
- 1.6Arctic
- 1.6Lucia