You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ROADMAP.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -162,6 +162,7 @@ business/custom objects, aligning with industry best practices (e.g., ServiceNow
162
162
163
163
**Migration (v3.x → v4.0):**
164
164
- v3.x: The `SystemObjectName` constants now emit `sys_`-prefixed names. Implementations using `StorageNameMapping.resolveTableName()` can set `tableName` to preserve legacy physical table names during the transition.
165
+
- v3.x: The `@objectstack/plugin-auth` ObjectQL adapter now includes `AUTH_MODEL_TO_PROTOCOL` mapping to translate better-auth's hardcoded model names (`user`, `session`, `account`, `verification`) to protocol names (`sys_user`, `sys_session`, `sys_account`, `sys_verification`). Custom adapters must adopt the same mapping.
165
166
- v4.0: Legacy un-prefixed aliases will be fully removed.
166
167
167
168
---
@@ -364,7 +365,7 @@ business/custom objects, aligning with industry best practices (e.g., ServiceNow
Copy file name to clipboardExpand all lines: content/docs/guides/authentication.mdx
+16-8Lines changed: 16 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -111,11 +111,15 @@ That's it! Your authentication endpoints are now available at `/api/v1/auth/*`.
111
111
112
112
The plugin automatically uses ObjectQL for data persistence. No additional database configuration is required - it works with your existing ObjectQL setup.
113
113
114
-
The plugin creates the following auth objects:
115
-
-`user` - User accounts
116
-
-`session` - Active sessions
117
-
-`account` - OAuth provider accounts
118
-
-`verification` - Email/phone verification tokens
114
+
The plugin creates the following auth objects (using ObjectStack `sys_` protocol names):
115
+
-`sys_user` - User accounts (mapped from better-auth's `user` model)
116
+
-`sys_session` - Active sessions (mapped from better-auth's `session` model)
117
+
-`sys_account` - OAuth provider accounts (mapped from better-auth's `account` model)
118
+
-`sys_verification` - Email/phone verification tokens (mapped from better-auth's `verification` model)
119
+
120
+
> **Note:** better-auth uses hardcoded model names (`user`, `session`, etc.). The ObjectQL adapter
121
+
> automatically maps these to `sys_`-prefixed protocol names via `AUTH_MODEL_TO_PROTOCOL`.
122
+
> Client-side API routes (`/api/v1/auth/*`) are **not affected** — they do not expose object names.
119
123
120
124
---
121
125
@@ -569,12 +573,16 @@ try {
569
573
570
574
### ObjectStack Field Naming
571
575
572
-
The plugin uses ObjectStack's snake_case naming convention for field names, which is required by the ObjectStack protocol:
576
+
The plugin uses ObjectStack's `sys_` prefix convention for protocol object names and snake_case for field names, which is required by the ObjectStack protocol:
573
577
574
-
-Table names: `user`, `session`, `account`, `verification` (compatible with better-auth)
- Field names: `email_verified`, `created_at`, `user_id` (snake_case)
576
580
577
-
The ObjectQL adapter automatically handles field name transformation between better-auth's expectations and ObjectStack's snake_case convention, providing seamless integration while maintaining protocol compliance.
581
+
better-auth internally uses model names like `user` and `session`. The ObjectQL adapter (`AUTH_MODEL_TO_PROTOCOL` mapping) automatically translates these to `sys_`-prefixed protocol names, providing seamless integration.
582
+
583
+
> **Upgrade note:** If you have custom adapters or plugins that reference auth objects by name,
584
+
> update them to use `sys_user`, `sys_session`, `sys_account`, `sys_verification`
The plugin uses [better-auth](https://www.better-auth.com/) for robust, production-ready authentication functionality. All requests are forwarded directly to better-auth's universal handler, ensuring full compatibility with all better-auth features. Data persistence is handled by ObjectQL using **ObjectStack's snake_case naming conventions** for field names to maintain consistency across the platform.
@@ -187,7 +187,7 @@ The plugin uses **ObjectQL** for data persistence instead of third-party ORMs:
187
187
```typescript
188
188
// Object definitions use ObjectStack's snake_case naming conventions
189
189
exportconst AuthUser =ObjectSchema.create({
190
-
name: 'user', // better-auth compatible table name
190
+
name: 'sys_user', //ObjectStack protocol name (better-auth model 'user' is mapped automatically)
The `createObjectQLAdapter()` function bridges better-auth's database interface to ObjectQL's IDataEngine with field name transformation:
224
+
The `createObjectQLAdapter()` function bridges better-auth's database interface to ObjectQL's IDataEngine. It includes a model→protocol name mapping (`AUTH_MODEL_TO_PROTOCOL`) that translates better-auth's hardcoded model names (e.g. `user`) to ObjectStack protocol names (e.g. `sys_user`):
0 commit comments