[PR #4822] [CLOSED] feat(client): add dedicated package for vanilla and react #13843

Closed
opened 2026-04-13 09:10:36 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4822
Author: @himself65
Created: 9/22/2025
Status: Closed

Base: canaryHead: himself65/2025/09/22/react


📝 Commits (9)

📊 Changes

61 files changed (+1728 additions, -851 deletions)

View changed files

📝 packages/better-auth/package.json (+3 -0)
packages/better-auth/src/client/client.test.ts (+0 -383)
📝 packages/better-auth/src/client/index.ts (+3 -8)
📝 packages/better-auth/src/client/lynx/index.ts (+4 -4)
📝 packages/better-auth/src/client/react/index.ts (+2 -106)
📝 packages/better-auth/src/client/solid/index.ts (+10 -9)
📝 packages/better-auth/src/client/svelte/index.ts (+10 -9)
packages/better-auth/src/client/types.ts (+0 -177)
📝 packages/better-auth/src/client/vue/index.ts (+9 -8)
📝 packages/better-auth/src/error/codes.ts (+6 -14)
📝 packages/better-auth/src/error/index.ts (+2 -0)
📝 packages/better-auth/src/plugins/api-key/schema.ts (+1 -1)
📝 packages/better-auth/src/plugins/organization/adapter.ts (+1 -1)
📝 packages/better-auth/src/test-utils/index.ts (+3 -2)
📝 packages/better-auth/src/test-utils/test-instance.ts (+1 -3)
📝 packages/better-auth/src/types/helper.ts (+11 -31)
📝 packages/better-auth/src/types/index.ts (+1 -1)
📝 packages/better-auth/src/utils/parser.ts (+0 -0)
📝 packages/better-auth/tsconfig.json (+8 -1)
packages/client/core/build.config.ts (+17 -0)

...and 41 more files

📄 Description

Summary by cubic

Split the client into dedicated packages for vanilla and React to make the SDK modular and easier to use. This refactor centralizes shared client code in a new core package and updates framework clients to consume it.

  • New Features

    • Added @better-auth/client-core with the vanilla client, shared types, query/store utils, proxy, session atom, URL/env/id helpers, logger, and a safer JSON parser.
    • Added @better-auth/react exposing createAuthClient and useStore; better-auth now re-exports from this package.
    • Solid/Svelte/Vue clients now use client-core (including BASE_ERROR_CODES); removed better-auth/src/client/types.ts and moved types to client-core.
  • Migration

    • React: import { createAuthClient, useStore } from @better-auth/react (or continue importing from better-auth which re-exports).
    • Vanilla/Node/tests: import client APIs and types (ClientOptions, Session, User, etc.) from @better-auth/client-core.
    • Replace any imports from internal client paths (better-auth/src/client/*) with @better-auth/client-core.

🔄 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/4822 **Author:** [@himself65](https://github.com/himself65) **Created:** 9/22/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `himself65/2025/09/22/react` --- ### 📝 Commits (9) - [`4496c1d`](https://github.com/better-auth/better-auth/commit/4496c1d958fefc71d3418946c7cc659581407d2d) feat(client): add dedicated package for vanilla and react - [`f3c38cf`](https://github.com/better-auth/better-auth/commit/f3c38cf153640e100030b05d48f744e831bab593) fix: deps - [`4fe3826`](https://github.com/better-auth/better-auth/commit/4fe382624ce42ddbb39649f0316bb32309f0b6cd) test: migrate - [`ccad02b`](https://github.com/better-auth/better-auth/commit/ccad02bd02c3dc94d4773ea9d85b944736fa179b) refactor: remove unused - [`1c6d41d`](https://github.com/better-auth/better-auth/commit/1c6d41d895ec600dad34d29d4e4a9e5657b97784) refactor: remove unused - [`2cca2aa`](https://github.com/better-auth/better-auth/commit/2cca2aaaa1a232dee76d893a9dd882a2a8d9f715) fix: type - [`40c8c23`](https://github.com/better-auth/better-auth/commit/40c8c230e70f18c7820bb26298e9411265d626c4) fix: type - [`e95efbf`](https://github.com/better-auth/better-auth/commit/e95efbf3f41b31380d190165123b92a568c1f235) fix: migrate - [`0c8776e`](https://github.com/better-auth/better-auth/commit/0c8776eda9d3b945093de18a80cd212f8fdf11a2) fix: type ### 📊 Changes **61 files changed** (+1728 additions, -851 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/package.json` (+3 -0) ➖ `packages/better-auth/src/client/client.test.ts` (+0 -383) 📝 `packages/better-auth/src/client/index.ts` (+3 -8) 📝 `packages/better-auth/src/client/lynx/index.ts` (+4 -4) 📝 `packages/better-auth/src/client/react/index.ts` (+2 -106) 📝 `packages/better-auth/src/client/solid/index.ts` (+10 -9) 📝 `packages/better-auth/src/client/svelte/index.ts` (+10 -9) ➖ `packages/better-auth/src/client/types.ts` (+0 -177) 📝 `packages/better-auth/src/client/vue/index.ts` (+9 -8) 📝 `packages/better-auth/src/error/codes.ts` (+6 -14) 📝 `packages/better-auth/src/error/index.ts` (+2 -0) 📝 `packages/better-auth/src/plugins/api-key/schema.ts` (+1 -1) 📝 `packages/better-auth/src/plugins/organization/adapter.ts` (+1 -1) 📝 `packages/better-auth/src/test-utils/index.ts` (+3 -2) 📝 `packages/better-auth/src/test-utils/test-instance.ts` (+1 -3) 📝 `packages/better-auth/src/types/helper.ts` (+11 -31) 📝 `packages/better-auth/src/types/index.ts` (+1 -1) 📝 `packages/better-auth/src/utils/parser.ts` (+0 -0) 📝 `packages/better-auth/tsconfig.json` (+8 -1) ➕ `packages/client/core/build.config.ts` (+17 -0) _...and 41 more files_ </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Split the client into dedicated packages for vanilla and React to make the SDK modular and easier to use. This refactor centralizes shared client code in a new core package and updates framework clients to consume it. - **New Features** - Added @better-auth/client-core with the vanilla client, shared types, query/store utils, proxy, session atom, URL/env/id helpers, logger, and a safer JSON parser. - Added @better-auth/react exposing createAuthClient and useStore; better-auth now re-exports from this package. - Solid/Svelte/Vue clients now use client-core (including BASE_ERROR_CODES); removed better-auth/src/client/types.ts and moved types to client-core. - **Migration** - React: import { createAuthClient, useStore } from @better-auth/react (or continue importing from better-auth which re-exports). - Vanilla/Node/tests: import client APIs and types (ClientOptions, Session, User, etc.) from @better-auth/client-core. - Replace any imports from internal client paths (better-auth/src/client/*) with @better-auth/client-core. <!-- 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-04-13 09:10:36 -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#13843