[PR #5916] [MERGED] chore: support stateless without any configuration #6319

Closed
opened 2026-03-13 12:54:41 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5916
Author: @Bekacru
Created: 11/11/2025
Status: Merged
Merged: 11/12/2025
Merged by: @Bekacru

Base: canaryHead: fix/statless


📝 Commits (6)

📊 Changes

10 files changed (+521 additions, -48 deletions)

View changed files

📝 demo/stateless/src/lib/auth.ts (+1 -15)
📝 docs/content/docs/concepts/session-management.mdx (+49 -23)
📝 docs/content/docs/errors/index.mdx (+2 -1)
docs/content/docs/errors/signup_disabled.mdx (+32 -0)
packages/better-auth/src/context/__snapshots__/create-context.test.ts.snap (+377 -0)
📝 packages/better-auth/src/context/create-context.test.ts (+40 -4)
📝 packages/better-auth/src/context/create-context.ts (+18 -0)
📝 packages/better-auth/src/context/init-minimal.ts (+1 -1)
📝 packages/better-auth/src/context/init.ts (+1 -1)
📝 packages/better-auth/src/db/adapter-base.ts (+0 -3)

📄 Description

Summary by cubic

Enable stateless session mode automatically when no database is configured, with secure cookie/JWE and OAuth state defaults. Updates the demo and docs to support zero-config stateless usage.

  • New Features

    • Auto-enable stateless when database is not provided.
    • Default session.cookieCache to enabled, JWE, and refresh.
    • Default oauthConfig.storeStateStrategy to cookie.
    • Demo switches to better-auth/minimal and removes extra config.
    • Removed the "no database" memory adapter warning.
  • Docs

    • Updated stateless guide: zero-config behavior, manual setup, and session invalidation via cookieCache.version.
    • Added “Signup disabled” error page with guidance to use database hooks in stateless mode.
    • Linked the new error in the errors index.

Written for commit 7e5ff951e9. Summary will update automatically on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/5916 **Author:** [@Bekacru](https://github.com/Bekacru) **Created:** 11/11/2025 **Status:** ✅ Merged **Merged:** 11/12/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `fix/statless` --- ### 📝 Commits (6) - [`d4abfeb`](https://github.com/better-auth/better-auth/commit/d4abfeb18c7ce70191ca612defef2aca99b6f6de) improve - [`ccce10d`](https://github.com/better-auth/better-auth/commit/ccce10d3069d04c7e2c9a4390ab02ded2a0adf02) Apply suggestions from code review - [`8775c42`](https://github.com/better-auth/better-auth/commit/8775c42835ab4ae304db63eb21ca0efeaa640145) chore: add test - [`f9163c4`](https://github.com/better-auth/better-auth/commit/f9163c462a0736f38c82430202bbd45afbffcb58) update docs - [`60e3313`](https://github.com/better-auth/better-auth/commit/60e33133704a4c09e66964252aeacd876bf43696) chore: update tests - [`7e5ff95`](https://github.com/better-auth/better-auth/commit/7e5ff951e9d18c2c66a75ed92de722569aa0aefc) Merge branch 'canary' into fix/statless ### 📊 Changes **10 files changed** (+521 additions, -48 deletions) <details> <summary>View changed files</summary> 📝 `demo/stateless/src/lib/auth.ts` (+1 -15) 📝 `docs/content/docs/concepts/session-management.mdx` (+49 -23) 📝 `docs/content/docs/errors/index.mdx` (+2 -1) ➕ `docs/content/docs/errors/signup_disabled.mdx` (+32 -0) ➕ `packages/better-auth/src/context/__snapshots__/create-context.test.ts.snap` (+377 -0) 📝 `packages/better-auth/src/context/create-context.test.ts` (+40 -4) 📝 `packages/better-auth/src/context/create-context.ts` (+18 -0) 📝 `packages/better-auth/src/context/init-minimal.ts` (+1 -1) 📝 `packages/better-auth/src/context/init.ts` (+1 -1) 📝 `packages/better-auth/src/db/adapter-base.ts` (+0 -3) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Enable stateless session mode automatically when no database is configured, with secure cookie/JWE and OAuth state defaults. Updates the demo and docs to support zero-config stateless usage. - **New Features** - Auto-enable stateless when `database` is not provided. - Default `session.cookieCache` to enabled, JWE, and refresh. - Default `oauthConfig.storeStateStrategy` to `cookie`. - Demo switches to `better-auth/minimal` and removes extra config. - Removed the "no database" memory adapter warning. - **Docs** - Updated stateless guide: zero-config behavior, manual setup, and session invalidation via `cookieCache.version`. - Added “Signup disabled” error page with guidance to use database hooks in stateless mode. - Linked the new error in the errors index. <sup>Written for commit 7e5ff951e9d18c2c66a75ed92de722569aa0aefc. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 12:54:41 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#6319