@checkstack/auth-backend 0.4.12 → 0.4.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @checkstack/auth-backend
2
2
 
3
+ ## 0.4.13
4
+
5
+ ### Patch Changes
6
+
7
+ - e01945b: Reduce excessive /api/auth/get-session requests
8
+
9
+ - Enable better-auth's `cookieCache` on the server (5-minute TTL) so repeated session
10
+ checks verify a signed cookie instead of querying the database. Compatible with
11
+ horizontal scaling since validation uses the shared `BETTER_AUTH_SECRET`.
12
+
13
+ - Introduce a `SessionProvider` React context that fetches the session exactly once
14
+ at the top of the component tree. All 7+ components that previously called
15
+ `useSession()` independently now read from this shared context — eliminating
16
+ duplicate HTTP requests on every page load.
17
+
18
+ - Remove the `useAuthClient()` hook which created per-component better-auth client
19
+ instances via `useMemo`, causing separate nanostore atoms and independent fetches.
20
+ All imperative usages (signIn, signUp, resetPassword, etc.) now use the singleton
21
+ `getAuthClientLazy()` instead.
22
+
3
23
  ## 0.4.12
4
24
 
5
25
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/auth-backend",
3
- "version": "0.4.12",
3
+ "version": "0.4.13",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "checkstack": {
package/src/index.ts CHANGED
@@ -639,6 +639,12 @@ export default createBackendPlugin({
639
639
  provider: "pg",
640
640
  schema: { ...schema },
641
641
  }),
642
+ session: {
643
+ cookieCache: {
644
+ enabled: true,
645
+ maxAge: 5 * 60, // 5 minutes — session verified from signed cookie, not DB
646
+ },
647
+ },
642
648
  emailAndPassword: {
643
649
  enabled: credentialEnabled,
644
650
  autoSignIn: true, // Log in user immediately after successful registration