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: packages/plugins/plugin-auth/README.md
+77-8Lines changed: 77 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
Authentication & Identity Plugin for ObjectStack.
4
4
5
-
> **✨ Status:**Better-Auth library successfully integrated! Core authentication structure is in place with better-auth v1.4.18. Full API integration and advanced features are in active development.
5
+
> **✨ Status:**ObjectQL-based authentication implementation! Uses ObjectQL for data persistence (no third-party ORM required). Core authentication structure is in place with better-auth v1.4.18.
6
6
7
7
## Features
8
8
@@ -12,6 +12,7 @@ Authentication & Identity Plugin for ObjectStack.
12
12
- ✅ Service registration in ObjectKernel
13
13
- ✅ Configuration schema support
14
14
- ✅ **Better-Auth library integration (v1.4.18)**
15
+
- ✅ **ObjectQL-based database implementation (no ORM required)**
15
16
- ✅ **Direct request forwarding to better-auth handler**
16
17
- ✅ **Wildcard routing (`/api/v1/auth/*`)**
17
18
- ✅ **Full better-auth API access via `auth.api`**
@@ -28,10 +29,18 @@ Authentication & Identity Plugin for ObjectStack.
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.
43
+
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 **better-auth's native naming conventions** (camelCase) to ensure seamless migration for existing better-auth users.
// ObjectQL will be automatically injected by the kernel
56
69
providers: [
57
70
{
58
71
id: 'google',
@@ -65,13 +78,14 @@ const kernel = new ObjectKernel({
65
78
});
66
79
```
67
80
81
+
**Note:** The `databaseUrl` parameter is no longer used. The plugin now uses ObjectQL's IDataEngine interface, which is provided by the kernel's `data` service. This allows the plugin to work with any ObjectQL-compatible driver (memory, SQL, NoSQL, etc.) without requiring a specific ORM.
82
+
68
83
### With Organization Support
69
84
70
85
```typescript
71
86
newAuthPlugin({
72
87
secret: process.env.AUTH_SECRET,
73
88
baseUrl: 'http://localhost:3000',
74
-
databaseUrl: process.env.DATABASE_URL,
75
89
plugins: {
76
90
organization: true, // Enable organization/teams
77
91
twoFactor: true, // Enable 2FA
@@ -142,10 +156,12 @@ This package provides authentication services powered by better-auth. Current im
142
156
7. ✅ Full better-auth API support
143
157
8. ✅ OAuth providers (configurable)
144
158
9. ✅ 2FA, passkeys, magic links (configurable)
145
-
10.🔄 Database adapter integration (in progress)
159
+
10.✅ ObjectQL-based database implementation (no ORM required)
146
160
147
161
### Architecture
148
162
163
+
#### Request Flow
164
+
149
165
The plugin uses a **direct forwarding** approach:
150
166
151
167
```typescript
@@ -164,6 +180,59 @@ This architecture provides:
164
180
- ✅ **Type safety** - Full TypeScript support from better-auth
165
181
- ✅ **Programmatic API** - Access auth methods via `authManager.api`
166
182
183
+
#### ObjectQL Database Architecture
184
+
185
+
The plugin uses **ObjectQL** for data persistence instead of third-party ORMs:
186
+
187
+
```typescript
188
+
// Object definitions use better-auth's native naming conventions
The `createObjectQLAdapter()` function bridges better-auth's database interface to ObjectQL's IDataEngine using better-auth's native naming conventions:
224
+
225
+
```typescript
226
+
// Better-auth → ObjectQL Adapter (no name conversion needed)
227
+
const adapter =createObjectQLAdapter(dataEngine);
228
+
229
+
// Better-auth uses this adapter for all database operations
0 commit comments