Skip to content

Conversation

Copy link

Copilot AI commented Jan 18, 2026

Set up @objectstack/plugin-auth as an ObjectStack plugin that wraps Better-Auth with ObjectQL storage adapter support.

Structure

  • src/adapter/ - ObjectQL adapter (empty, ready for implementation)
  • src/schema/auth.gql - GraphQL entity definitions
  • src/client/ - React hooks (empty, ready for implementation)
  • src/server/ - Server initialization (empty, ready for implementation)

Schema (src/schema/auth.gql)

Defines four entities compatible with Better-Auth's table structure:

  • User: id, email, emailVerified, name, image, timestamps
  • Session: token, expiresAt, userId, optional ipAddress/userAgent
  • Account: OAuth fields (provider, providerAccountId, accessToken, refreshToken, etc.)
  • VerificationToken: identifier, token, expiresAt for email verification flows

All entities use ObjectQL directives (@entity, @primary, @unique, @index, @relation, @updatedAt) and include bidirectional relations where needed.

Package Configuration

  • Better-Auth v1.0.0 as core dependency
  • Peer dependencies: @objectstack/protocol, @objectstack/ql, react
  • ESM with bundler module resolution
  • Strict TypeScript with react-jsx transform and DOM types
  • Module exports for /, /client, /server paths

Plugin Config (objectstack.config.ts)

Registers as type: 'plugin' with entities loaded from ./src/schema/*.gql.

This enables authentication data to persist in any ObjectQL-supported backend (Postgres, Redis, Excel, etc.) while maintaining full Better-Auth compatibility.

Original prompt

Based on the system prompt, please initialize the repository structure, create the package.json, and write the src/schema/auth.gql file to define the User and Session entities compatible with Better-Auth.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Initialize repository structure with auth schema Initialize repository with Better-Auth compatible schema and package configuration Jan 18, 2026
Copilot AI requested a review from huangyiirene January 18, 2026 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants