Skip to content
This repository was archived by the owner on Jan 13, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 111 additions & 0 deletions .changeset/upgrade-0-10.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
---
"better-auth-convex": minor
---

### @convex-dev/better-auth 0.10

This release updates better-auth-convex to work with `@convex-dev/better-auth@0.10.4` and `better-auth@1.4.7`.

For the upstream migration guide, see: https://labs.convex.dev/better-auth/migrations/migrate-to-0-10

### Breaking Changes

#### `createApi` signature changed

The second parameter is now `createAuth` function instead of spread auth options:

```ts
// Before
export const { create, ... } = createApi(schema, {
...auth.options,
skipValidation: true,
});

// After
export const { create, ... } = createApi(schema, createAuth, {
skipValidation: true,
});
```

#### `authClient.adapter` signature changed

Now takes `createAuthOptions` function instead of options object:

```ts
// Before
database: authClient.adapter(ctx, auth.options),

// After
database: authClient.adapter(ctx, createAuthOptions),
```

#### `createAuth` pattern replaced

The static `auth` instance with `optionsOnly` is replaced by `createAuthOptions` factory:

```ts
// Before
export const createAuth = (ctx, { optionsOnly } = { optionsOnly: false }) => {
return betterAuth({ ... });
};
export const auth = createAuth({}, { optionsOnly: true });

// After
export const createAuthOptions = (ctx) => ({
baseURL: process.env.SITE_URL!,
plugins: [convex({ authConfig, jwks: process.env.JWKS })],
// ...
}) satisfies BetterAuthOptions;

export const createAuth = (ctx) => betterAuth(createAuthOptions(ctx));
```

### New Features

#### Static JWKS exports

`createApi` now exports `getLatestJwks` and `rotateKeys` for static JWKS management:

```ts
export const {
create,
// ... other exports
getLatestJwks,
rotateKeys,
} = createApi(schema, createAuth, { skipValidation: true });
```

After deploying, generate JWKS:

```bash
npx convex run auth:getLatestJwks | npx convex env set JWKS
```

### Migration Steps

1. Update dependencies:

```bash
pnpm add better-auth@1.4.7 @convex-dev/better-auth@0.10.4
```

2. Update `convex/auth.config.ts`:

```ts
export default {
providers: [getAuthConfigProvider({ jwks: process.env.JWKS })],
} satisfies AuthConfig;
```

3. Update `convex/auth.ts`:
- Replace `auth` static instance with `createAuthOptions` factory
- Update `createApi` call signature
- Update `getAuth` to use `createAuthOptions`
- Add `getLatestJwks` and `rotateKeys` to exports

4. Deploy and generate JWKS:
```bash
npx convex run auth:getLatestJwks | npx convex env set JWKS
```

See the [README](https://github.com/udecode/better-auth-convex) for complete setup examples.
87 changes: 87 additions & 0 deletions .claude/commands/sync-fork-full.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Migration Plan: Full Sync from External Repository Comparison

**Objective**
Compare two external repositories and identify both improvements to integrated code AND new features that can be added to this project.

## Context

- This project has integrated a subset of features from an external repository
- We want to track improvements in that external repository (or its forks)
- We also want to identify new features added from scratch
- We DON'T want changes to features we deliberately didn't integrate

## Usage

Provide a GitHub compare URL in the format:

```
https://github.com/OWNER/REPO/compare/BASE...HEAD
```

**Example:**

```
https://github.com/zbeyens/sparka/compare/main...FranciscoMoretti:sparka:main
```

## Workflow

1. **Parse the compare URL** to extract:
- Repository owner and name
- Base branch
- Head branch (may include fork reference)

2. **Fetch the diff** using GitHub CLI:

```bash
gh api repos/OWNER/REPO/compare/BASE...HEAD --jq '.files[] | "\(.filename)\n\(.patch)\n"'
```

3. **Analyze changes** against this project:
- Identify which files/features from the comparison exist in this project
- Identify entirely new files/features (created from scratch)
- Ignore changes to files/features that exist in external repo but not in this project

4. **Categorize changes into TWO sections**:

### Section A: Improvements to Integrated Features
- Bug fixes (for code we have)
- Performance improvements (for code we have)
- Code quality improvements (for code we have)
- Refactoring (for code we have)
- Documentation updates (for features we have)

### Section B: New Features (From Scratch)
- Entirely new components/files
- New functionality that doesn't exist anywhere in this project
- New capabilities added from scratch

### IGNORE:
- Changes to features that exist in external repo but NOT in this project
- Updates to files we deliberately didn't integrate

5. **Create a prioritized migration plan** with:
- **Section A: Improvements to sync** (what to backport)
- **Section B: New features to consider** (what to add)
- Value and rationale for each change
- Any potential conflicts or integration concerns
- Recommended order of migration
- File mappings (external repo → this project)

## Constraints

- **Section A**: Sync only improvements to features already in this project
- **Section B**: Include only features created from scratch (not updates to un-adopted features)
- **Exclude**: All changes to features that exist in external repo but not in this project
- Focus on keeping our integrated subset up-to-date AND identifying valuable additions
- Consider our project's specific architecture and patterns

## Key Distinction

- ✅ **Include**: New feature X created from scratch
- ✅ **Include**: Improvement to feature Y we already have
- ❌ **Exclude**: Change to feature Z that exists in external repo but we never integrated

---

**Please provide a GitHub compare URL to begin the analysis.**
Loading