Skip to content

Conversation

@brenelz
Copy link
Contributor

@brenelz brenelz commented Nov 9, 2025

Summary by CodeRabbit

  • New Features

    • New Solid example app showcasing Convex + Better Auth: login/signup UI, protected dashboard to add/list numbers, auth-protected routes, and API auth endpoints.
  • Documentation

    • Added example README and environment template; added the example to the docs index.
  • Chores

    • Project scaffolding: build/dev configs, TypeScript/Vite setup, styles, gitignore, and utility/provider scaffolding for the example.

@brenelz brenelz requested a review from birkskyum November 9, 2025 01:19
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 9, 2025

Walkthrough

Adds a new Solid Start example "Bare + Convex + Better Auth": a complete example project (frontend + Convex backend), routing and generated route types, Better Auth integration and server handlers, build/tooling configs, env template, docs config entry registering the example.

Changes

Cohort / File(s) Change Summary
Docs config
docs/start/config.json
Inserted new Solid example entry "Bare + Convex + Better Auth" -> framework/solid/examples/start-convex-better-auth.
Convex backend & auth
examples/solid/start-convex-better-auth/convex/*
Added Convex backend and auth integration files: auth.config.ts, auth.ts, convex.config.ts, http.ts, myFunctions.ts, schema.ts, README.md, tsconfig.json — Better Auth wiring, HTTP auth routes, queries/mutations/actions, schema and docs.
Example project manifest & tooling
examples/solid/start-convex-better-auth/package.json, .../vite.config.ts, .../tsconfig.json
New package manifest, Vite config and TypeScript project config for the Solid + Convex example (scripts, deps, plugins, TS options).
Frontend routes, router & generated types
examples/solid/start-convex-better-auth/src/routes/*, .../src/router.tsx, .../src/routeTree.gen.ts
Added file-based routes (index, about, _authed, _authed/dashboard, api/auth/$), router factory getRouter(), generated route tree and TypeScript module augmentations.
UI components & providers
examples/solid/start-convex-better-auth/src/components/*, .../src/providers/*, .../src/styles/*
Added login-signup-form.tsx component, AppConvexProvider wrapper, and Tailwind-based app.css.
Client/server library code
examples/solid/start-convex-better-auth/src/library/*
Added auth-client.ts, auth-server.ts, convex-client.ts (with refreshAuth), server helpers (server.ts), and utils.ts (cn helper).
Route implementations (pages)
examples/solid/start-convex-better-auth/src/routes/index.tsx, .../about.tsx, .../_authed.tsx, .../_authed/dashboard.tsx, .../api/auth/$.ts
New route files with beforeLoad guards, server endpoints delegating to reactStartHandler, dashboard using Convex queries/mutations, and redirects based on auth.
Env & gitignore
examples/solid/start-convex-better-auth/.env.example, .../.gitignore
Added .env.example with CONVEX and SITE_URL placeholders and .gitignore rules to ignore .env.local and convex/_generated/.
Docs / README
examples/solid/start-convex-better-auth/README.md
New README describing setup, environment variables, Convex dev instructions and run steps.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Browser
    participant Frontend as Solid App
    participant BetterAuth as BetterAuth Router
    participant Convex as Convex Services

    User->>Browser: Open app
    Browser->>Frontend: Load index route
    Frontend->>Frontend: beforeLoad -> fetchAuth (SSR)
    alt no token
        Frontend->>User: Render LoginSignupForm
        User->>Frontend: Submit credentials
        Frontend->>BetterAuth: POST /api/auth -> reactStartHandler
        BetterAuth->>Convex: create/verify user, issue JWT
        Convex-->>BetterAuth: token/session
        BetterAuth-->>Frontend: session/token
        Frontend->>Frontend: refreshAuth() (store token)
        Frontend->>Browser: Redirect /_authed/dashboard
    else has token
        Frontend->>Browser: Redirect /_authed/dashboard
    end

    Browser->>Frontend: Load dashboard route
    Frontend->>Frontend: _authed.beforeLoad -> fetchUser
    Frontend->>Convex: runQuery listNumbers
    Convex-->>Frontend: numbers data
    Frontend-->>User: Render dashboard with data
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Pay extra attention to:
    • examples/solid/start-convex-better-auth/convex/auth.ts — adapter and JWT/config wiring.
    • examples/solid/start-convex-better-auth/src/routes/api/auth/$.ts and src/library/auth-server.ts — server handler delegation and fetch client initialization.
    • examples/solid/start-convex-better-auth/src/routeTree.gen.ts — generated typings and module augmentation.

Possibly related PRs

Suggested reviewers

  • birkskyum

Poem

🐰
I hopped through routes and tiny stacks of code,
Wove Convex keys where auth and data flowed,
Solid leaves glint in a tidy, cozy lair,
Routes and tokens snug — a rabbit's cheerful flair. ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a new documentation example for Solid Start with Convex and Better Auth integration.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5113692 and 4fd9338.

📒 Files selected for processing (2)
  • examples/solid/start-convex-better-auth/.gitignore (1 hunks)
  • examples/solid/start-convex-better-auth/README.md (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • examples/solid/start-convex-better-auth/README.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • examples/solid/start-convex-better-auth/.gitignore
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Test
  • GitHub Check: Preview

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added the documentation Everything documentation related label Nov 9, 2025
@nx-cloud
Copy link

nx-cloud bot commented Nov 9, 2025

🤖 Nx Cloud AI Fix Eligible

An automatically generated fix could have helped fix failing tasks for this run, but Self-healing CI is disabled for this workspace. Visit workspace settings to enable it and get automatic fixes in future runs.

To disable these notifications, a workspace admin can disable them in workspace settings.


View your CI Pipeline Execution ↗ for commit 4fd9338

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ❌ Failed 8m 34s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 1m 24s View ↗

☁️ Nx Cloud last updated this comment at 2025-11-09 16:10:41 UTC

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🧹 Nitpick comments (9)
examples/solid/start-convex-better-auth/.gitignore (1)

1-2: Consider adding common ignore patterns for completeness.

While .env.local is correctly ignored, this .gitignore is missing common patterns for a Solid/Vite project. Consider adding entries for build artifacts and dependencies.

Apply this diff to add common ignore patterns:

+node_modules
+dist
+.solid
+.output
+.vinxi
 
 .env.local
examples/solid/start-convex-better-auth/src/styles/app.css (1)

9-11: Consider scoping the anchor margin more narrowly.

The global margin-right: 1rem on all anchors may affect layout unintentionally. Consider applying this only to navigation links or specific contexts.

Alternative approach - scope to navigation:

nav a {
  margin-right: 1rem;
}
examples/solid/start-convex-better-auth/src/routes/about.tsx (1)

1-4: Add blank line after imports.

Missing blank line between import statement and export, as flagged by ESLint.

Apply this diff:

 import { createFileRoute } from '@tanstack/solid-router'
+
 export const Route = createFileRoute('/about')({
   component: RouteComponent,
 })
examples/solid/start-convex-better-auth/convex/auth.config.ts (1)

1-8: Add type annotation for better type safety.

The configuration object lacks type annotations, reducing type safety.

Apply this diff to add types:

+type AuthProvider = {
+  domain: string
+  applicationID: string
+}
+
+type AuthConfig = {
+  providers: AuthProvider[]
+}
+
-export default {
+export default {
   providers: [
     {
-      domain: process.env.CONVEX_SITE_URL,
+      domain: process.env.CONVEX_SITE_URL || process.env.SITE_URL || 'http://localhost:3000',
       applicationID: 'convex',
     },
   ],
-}
+} satisfies AuthConfig
examples/solid/start-convex-better-auth/.env.example (1)

10-10: Add trailing newline.

The file should end with a blank line as flagged by dotenv-linter.

 # Your local site URL
 SITE_URL=http://localhost:3000
+
examples/solid/start-convex-better-auth/src/routes/_authed/dashboard.tsx (2)

22-25: Consider refreshing auth state after sign-out.

The sign-out handler navigates to the home page but doesn't explicitly refresh the authentication state. While navigation may trigger a re-fetch, explicitly calling refreshAuth() after signOut() ensures the client-side session is cleared before navigation, similar to the login flow.

Apply this diff to add explicit auth refresh:

 const handleSignOut = async () => {
   await authClient.signOut()
+  refreshAuth()
   navigate({ to: '/' })
 }

59-64: Add error handling for the mutation.

The addNumber() call lacks error handling. If the mutation fails (e.g., due to network issues or authentication errors), the user receives no feedback.

Consider wrapping the mutation call with error handling:

-            <button
-              onClick={() => addNumber()}
-              class="px-4 py-2 text-sm font-semibold text-white bg-gradient-to-r from-blue-600 to-indigo-600 rounded-lg hover:from-blue-700 hover:to-indigo-700 transition-all duration-200 shadow-lg hover:shadow-xl transform hover:-translate-y-0.5"
-            >
-              Add Random Number To Convex
-            </button>
+            <button
+              onClick={async () => {
+                try {
+                  await addNumber()
+                } catch (err) {
+                  console.error('Failed to add number:', err)
+                  // Consider showing a toast/alert to the user
+                }
+              }}
+              class="px-4 py-2 text-sm font-semibold text-white bg-gradient-to-r from-blue-600 to-indigo-600 rounded-lg hover:from-blue-700 hover:to-indigo-700 transition-all duration-200 shadow-lg hover:shadow-xl transform hover:-translate-y-0.5"
+            >
+              Add Random Number To Convex
+            </button>
examples/solid/start-convex-better-auth/src/components/login-signup-form.tsx (1)

37-38: Prefer unknown over any for error handling.

Using any bypasses type safety. Consider using unknown and narrowing the type for better type safety.

Apply this diff:

-    } catch (err: any) {
-      setError(err?.message || 'An error occurred')
+    } catch (err: unknown) {
+      setError(err instanceof Error ? err.message : 'An error occurred')
     } finally {
examples/solid/start-convex-better-auth/convex/myFunctions.ts (1)

63-63: Consider removing console.log statements.

Console logs in production code can impact performance and clutter logs. For an example demonstrating best practices, consider using a proper logging solution or removing debug statements.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0a8578f and 2cbe033.

⛔ Files ignored due to path filters (7)
  • examples/solid/start-convex-better-auth/convex/_generated/api.d.ts is excluded by !**/_generated/**
  • examples/solid/start-convex-better-auth/convex/_generated/api.js is excluded by !**/_generated/**
  • examples/solid/start-convex-better-auth/convex/_generated/dataModel.d.ts is excluded by !**/_generated/**
  • examples/solid/start-convex-better-auth/convex/_generated/server.d.ts is excluded by !**/_generated/**
  • examples/solid/start-convex-better-auth/convex/_generated/server.js is excluded by !**/_generated/**
  • examples/solid/start-convex-better-auth/public/favicon.ico is excluded by !**/*.ico
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (25)
  • docs/start/config.json (1 hunks)
  • examples/solid/start-convex-better-auth/.env.example (1 hunks)
  • examples/solid/start-convex-better-auth/.gitignore (1 hunks)
  • examples/solid/start-convex-better-auth/convex/README.md (1 hunks)
  • examples/solid/start-convex-better-auth/convex/auth.config.ts (1 hunks)
  • examples/solid/start-convex-better-auth/convex/auth.ts (1 hunks)
  • examples/solid/start-convex-better-auth/convex/convex.config.ts (1 hunks)
  • examples/solid/start-convex-better-auth/convex/http.ts (1 hunks)
  • examples/solid/start-convex-better-auth/convex/myFunctions.ts (1 hunks)
  • examples/solid/start-convex-better-auth/convex/schema.ts (1 hunks)
  • examples/solid/start-convex-better-auth/convex/tsconfig.json (1 hunks)
  • examples/solid/start-convex-better-auth/package.json (1 hunks)
  • examples/solid/start-convex-better-auth/src/components/login-signup-form.tsx (1 hunks)
  • examples/solid/start-convex-better-auth/src/providers/convex.tsx (1 hunks)
  • examples/solid/start-convex-better-auth/src/routeTree.gen.ts (1 hunks)
  • examples/solid/start-convex-better-auth/src/router.tsx (1 hunks)
  • examples/solid/start-convex-better-auth/src/routes/__root.tsx (1 hunks)
  • examples/solid/start-convex-better-auth/src/routes/_authed.tsx (1 hunks)
  • examples/solid/start-convex-better-auth/src/routes/_authed/dashboard.tsx (1 hunks)
  • examples/solid/start-convex-better-auth/src/routes/about.tsx (1 hunks)
  • examples/solid/start-convex-better-auth/src/routes/api/auth/$.ts (1 hunks)
  • examples/solid/start-convex-better-auth/src/routes/index.tsx (1 hunks)
  • examples/solid/start-convex-better-auth/src/styles/app.css (1 hunks)
  • examples/solid/start-convex-better-auth/tsconfig.json (1 hunks)
  • examples/solid/start-convex-better-auth/vite.config.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript in strict mode with extensive type safety across the codebase

Files:

  • examples/solid/start-convex-better-auth/src/router.tsx
  • examples/solid/start-convex-better-auth/convex/auth.config.ts
  • examples/solid/start-convex-better-auth/vite.config.ts
  • examples/solid/start-convex-better-auth/convex/auth.ts
  • examples/solid/start-convex-better-auth/src/routes/api/auth/$.ts
  • examples/solid/start-convex-better-auth/src/components/login-signup-form.tsx
  • examples/solid/start-convex-better-auth/src/routes/__root.tsx
  • examples/solid/start-convex-better-auth/convex/myFunctions.ts
  • examples/solid/start-convex-better-auth/convex/convex.config.ts
  • examples/solid/start-convex-better-auth/src/providers/convex.tsx
  • examples/solid/start-convex-better-auth/convex/http.ts
  • examples/solid/start-convex-better-auth/convex/schema.ts
  • examples/solid/start-convex-better-auth/src/routes/_authed/dashboard.tsx
  • examples/solid/start-convex-better-auth/src/routes/about.tsx
  • examples/solid/start-convex-better-auth/src/routes/index.tsx
  • examples/solid/start-convex-better-auth/src/routes/_authed.tsx
  • examples/solid/start-convex-better-auth/src/routeTree.gen.ts
examples/{react,solid}/**

📄 CodeRabbit inference engine (AGENTS.md)

Keep example applications under examples/react/ and examples/solid/

Files:

  • examples/solid/start-convex-better-auth/src/router.tsx
  • examples/solid/start-convex-better-auth/convex/auth.config.ts
  • examples/solid/start-convex-better-auth/vite.config.ts
  • examples/solid/start-convex-better-auth/convex/auth.ts
  • examples/solid/start-convex-better-auth/src/routes/api/auth/$.ts
  • examples/solid/start-convex-better-auth/src/components/login-signup-form.tsx
  • examples/solid/start-convex-better-auth/src/routes/__root.tsx
  • examples/solid/start-convex-better-auth/convex/README.md
  • examples/solid/start-convex-better-auth/convex/tsconfig.json
  • examples/solid/start-convex-better-auth/tsconfig.json
  • examples/solid/start-convex-better-auth/package.json
  • examples/solid/start-convex-better-auth/convex/myFunctions.ts
  • examples/solid/start-convex-better-auth/convex/convex.config.ts
  • examples/solid/start-convex-better-auth/src/providers/convex.tsx
  • examples/solid/start-convex-better-auth/convex/http.ts
  • examples/solid/start-convex-better-auth/convex/schema.ts
  • examples/solid/start-convex-better-auth/src/routes/_authed/dashboard.tsx
  • examples/solid/start-convex-better-auth/src/routes/about.tsx
  • examples/solid/start-convex-better-auth/src/routes/index.tsx
  • examples/solid/start-convex-better-auth/src/styles/app.css
  • examples/solid/start-convex-better-auth/src/routes/_authed.tsx
  • examples/solid/start-convex-better-auth/src/routeTree.gen.ts
**/src/routes/**

📄 CodeRabbit inference engine (AGENTS.md)

Place file-based routes under src/routes/ directories

Files:

  • examples/solid/start-convex-better-auth/src/routes/api/auth/$.ts
  • examples/solid/start-convex-better-auth/src/routes/__root.tsx
  • examples/solid/start-convex-better-auth/src/routes/_authed/dashboard.tsx
  • examples/solid/start-convex-better-auth/src/routes/about.tsx
  • examples/solid/start-convex-better-auth/src/routes/index.tsx
  • examples/solid/start-convex-better-auth/src/routes/_authed.tsx
**/package.json

📄 CodeRabbit inference engine (AGENTS.md)

Use workspace:* protocol for internal dependencies in package.json files

Files:

  • examples/solid/start-convex-better-auth/package.json
docs/{router,start}/**

📄 CodeRabbit inference engine (AGENTS.md)

Place router docs under docs/router/ and start framework docs under docs/start/

Files:

  • docs/start/config.json
🧠 Learnings (8)
📚 Learning: 2025-09-23T17:36:12.598Z
Learnt from: CR
Repo: TanStack/router PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-23T17:36:12.598Z
Learning: Applies to packages/{react-router,solid-router}/** : Implement React and Solid bindings/components only in packages/react-router/ and packages/solid-router/

Applied to files:

  • examples/solid/start-convex-better-auth/src/router.tsx
  • examples/solid/start-convex-better-auth/src/routes/api/auth/$.ts
  • examples/solid/start-convex-better-auth/src/routes/__root.tsx
  • examples/solid/start-convex-better-auth/tsconfig.json
  • examples/solid/start-convex-better-auth/package.json
  • examples/solid/start-convex-better-auth/src/routes/_authed/dashboard.tsx
  • examples/solid/start-convex-better-auth/src/routes/about.tsx
  • examples/solid/start-convex-better-auth/src/routes/index.tsx
  • examples/solid/start-convex-better-auth/src/routes/_authed.tsx
  • examples/solid/start-convex-better-auth/src/routeTree.gen.ts
📚 Learning: 2025-10-08T08:11:47.088Z
Learnt from: nlynzaad
Repo: TanStack/router PR: 5402
File: packages/router-generator/tests/generator/no-formatted-route-tree/routeTree.nonnested.snapshot.ts:19-21
Timestamp: 2025-10-08T08:11:47.088Z
Learning: Test snapshot files in the router-generator tests directory (e.g., files matching the pattern `packages/router-generator/tests/generator/**/routeTree*.snapshot.ts` or `routeTree*.snapshot.js`) should not be modified or have issues flagged, as they are fixtures used to verify the generator's output and are intentionally preserved as-is.

Applied to files:

  • examples/solid/start-convex-better-auth/src/router.tsx
  • examples/solid/start-convex-better-auth/src/routeTree.gen.ts
📚 Learning: 2025-11-02T16:16:24.898Z
Learnt from: nlynzaad
Repo: TanStack/router PR: 5732
File: packages/start-client-core/src/client/hydrateStart.ts:6-9
Timestamp: 2025-11-02T16:16:24.898Z
Learning: In packages/start-client-core/src/client/hydrateStart.ts, the `import/no-duplicates` ESLint disable is necessary for imports from `#tanstack-router-entry` and `#tanstack-start-entry` because both aliases resolve to the same placeholder file (`fake-start-entry.js`) in package.json during static analysis, even though they resolve to different files at runtime.

Applied to files:

  • examples/solid/start-convex-better-auth/src/routes/__root.tsx
  • examples/solid/start-convex-better-auth/tsconfig.json
  • examples/solid/start-convex-better-auth/package.json
  • examples/solid/start-convex-better-auth/src/routeTree.gen.ts
📚 Learning: 2025-10-01T18:31:35.420Z
Learnt from: schiller-manuel
Repo: TanStack/router PR: 5330
File: e2e/react-start/custom-basepath/src/routeTree.gen.ts:58-61
Timestamp: 2025-10-01T18:31:35.420Z
Learning: Do not review files named `routeTree.gen.ts` in TanStack Router repositories, as these are autogenerated files that should not be manually modified.

Applied to files:

  • examples/solid/start-convex-better-auth/src/routes/__root.tsx
  • examples/solid/start-convex-better-auth/src/routeTree.gen.ts
📚 Learning: 2025-09-23T17:36:12.598Z
Learnt from: CR
Repo: TanStack/router PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-23T17:36:12.598Z
Learning: Applies to **/*.{ts,tsx} : Use TypeScript in strict mode with extensive type safety across the codebase

Applied to files:

  • examples/solid/start-convex-better-auth/convex/tsconfig.json
  • examples/solid/start-convex-better-auth/tsconfig.json
📚 Learning: 2025-09-23T17:36:12.598Z
Learnt from: CR
Repo: TanStack/router PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-23T17:36:12.598Z
Learning: Applies to packages/{router-cli,router-generator,router-plugin,virtual-file-routes}/** : Keep CLI, generators, bundler plugins, and virtual file routing utilities in their dedicated tooling package directories

Applied to files:

  • examples/solid/start-convex-better-auth/src/routeTree.gen.ts
📚 Learning: 2025-09-23T17:36:12.598Z
Learnt from: CR
Repo: TanStack/router PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-23T17:36:12.598Z
Learning: Applies to packages/router-core/** : Keep framework-agnostic core router logic in packages/router-core/

Applied to files:

  • examples/solid/start-convex-better-auth/src/routeTree.gen.ts
📚 Learning: 2025-09-23T17:36:12.598Z
Learnt from: CR
Repo: TanStack/router PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-23T17:36:12.598Z
Learning: Applies to **/src/routes/** : Place file-based routes under src/routes/ directories

Applied to files:

  • examples/solid/start-convex-better-auth/src/routeTree.gen.ts
🧬 Code graph analysis (9)
examples/solid/start-convex-better-auth/convex/auth.ts (3)
examples/solid/start-convex-better-auth/convex/_generated/dataModel.d.ts (1)
  • DataModel (60-60)
examples/solid/start-convex-better-auth/convex/_generated/api.js (2)
  • components (23-23)
  • components (23-23)
examples/solid/start-convex-better-auth/convex/_generated/server.js (2)
  • query (30-30)
  • query (30-30)
examples/solid/start-convex-better-auth/src/routes/api/auth/$.ts (3)
examples/solid/start-convex-better-auth/src/routes/_authed.tsx (1)
  • Route (4-19)
examples/solid/start-convex-better-auth/src/routes/index.tsx (1)
  • Route (5-12)
examples/solid/start-convex-better-auth/src/routes/__root.tsx (1)
  • Route (10-19)
examples/solid/start-convex-better-auth/src/routes/__root.tsx (3)
examples/solid/start-convex-better-auth/src/routes/_authed.tsx (1)
  • Route (4-19)
examples/solid/start-convex-better-auth/src/routes/index.tsx (1)
  • Route (5-12)
examples/solid/start-convex-better-auth/src/providers/convex.tsx (1)
  • AppConvexProvider (5-7)
examples/solid/start-convex-better-auth/convex/myFunctions.ts (3)
examples/solid/start-convex-better-auth/convex/_generated/server.js (6)
  • query (30-30)
  • query (30-30)
  • mutation (50-50)
  • mutation (50-50)
  • action (73-73)
  • action (73-73)
examples/solid/start-convex-better-auth/convex/auth.ts (1)
  • authComponent (13-13)
examples/solid/start-convex-better-auth/convex/_generated/api.js (2)
  • api (21-21)
  • api (21-21)
examples/solid/start-convex-better-auth/convex/http.ts (1)
examples/solid/start-convex-better-auth/convex/auth.ts (2)
  • authComponent (13-13)
  • createAuth (15-37)
examples/solid/start-convex-better-auth/src/routes/_authed/dashboard.tsx (4)
examples/solid/start-convex-better-auth/src/routes/_authed.tsx (1)
  • Route (4-19)
examples/solid/start-convex-better-auth/src/routes/__root.tsx (1)
  • Route (10-19)
examples/solid/start-convex-better-auth/convex/_generated/api.js (2)
  • api (21-21)
  • api (21-21)
examples/solid/start-convex-better-auth/convex/myFunctions.ts (1)
  • addNumber (40-67)
examples/solid/start-convex-better-auth/src/routes/index.tsx (3)
examples/solid/start-convex-better-auth/src/routes/_authed.tsx (1)
  • Route (4-19)
examples/solid/start-convex-better-auth/src/routes/__root.tsx (1)
  • Route (10-19)
examples/solid/start-convex-better-auth/src/components/login-signup-form.tsx (1)
  • LoginSignupForm (6-199)
examples/solid/start-convex-better-auth/src/routes/_authed.tsx (3)
examples/solid/start-convex-better-auth/src/routes/_authed/dashboard.tsx (1)
  • Route (12-14)
examples/solid/start-convex-better-auth/src/routes/index.tsx (1)
  • Route (5-12)
examples/solid/start-convex-better-auth/src/routes/__root.tsx (1)
  • Route (10-19)
examples/solid/start-convex-better-auth/src/routeTree.gen.ts (1)
examples/solid/start-convex-better-auth/src/router.tsx (1)
  • getRouter (4-14)
🪛 dotenv-linter (4.0.0)
examples/solid/start-convex-better-auth/.env.example

[warning] 10-10: [EndingBlankLine] No blank line at the end of the file

(EndingBlankLine)

🪛 ESLint
examples/solid/start-convex-better-auth/src/routes/about.tsx

[error] 1-1: Expected 1 empty line after import statement not followed by another import.

(import/newline-after-import)

🪛 markdownlint-cli2 (0.18.1)
examples/solid/start-convex-better-auth/convex/README.md

4-4: Bare URL used

(MD034, no-bare-urls)

🔇 Additional comments (13)
examples/solid/start-convex-better-auth/vite.config.ts (1)

1-19: LGTM!

The Vite configuration is well-structured with appropriate plugins for a Solid Start + TanStack Router project. The server port (3000) correctly matches the SITE_URL in .env.example, and the plugin order ensures proper path resolution and SSR support.

examples/solid/start-convex-better-auth/convex/tsconfig.json (1)

1-25: LGTM!

The TypeScript configuration is well-structured with strict mode enabled (as per coding guidelines), appropriate SolidJS JSX settings, and clear separation between required Convex options and customizable settings. The configuration correctly excludes generated files while including all source files.

Based on coding guidelines.

examples/solid/start-convex-better-auth/src/providers/convex.tsx (1)

1-7: Missing convex-client module - create src/lib/convex-client.ts file

The import from '~/lib/convex-client' in the provider (line 3) and in components/login-signup-form.tsx cannot be resolved—the file does not exist. This will cause runtime import failures. Create src/lib/convex-client.ts with the Convex client initialization using environment variables (e.g., VITE_CONVEX_URL):

import { ConvexClient } from 'convex/browser'

export const convexClient = new ConvexClient(
  import.meta.env.VITE_CONVEX_URL
)

export const refreshAuth = () => {
  // auth refresh logic
}

Verify the environment variable is set in .env.local or your deployment configuration.

⛔ Skipped due to learnings
Learnt from: nlynzaad
Repo: TanStack/router PR: 5732
File: packages/start-client-core/src/client/hydrateStart.ts:6-9
Timestamp: 2025-11-02T16:16:24.898Z
Learning: In packages/start-client-core/src/client/hydrateStart.ts, the `import/no-duplicates` ESLint disable is necessary for imports from `#tanstack-router-entry` and `#tanstack-start-entry` because both aliases resolve to the same placeholder file (`fake-start-entry.js`) in package.json during static analysis, even though they resolve to different files at runtime.
examples/solid/start-convex-better-auth/tsconfig.json (1)

1-23: LGTM!

The TypeScript configuration correctly enables strict mode and includes appropriate compiler options for a Solid Start project. The path alias setup and JSX configuration are properly configured.

examples/solid/start-convex-better-auth/src/routes/__root.tsx (1)

10-37: LGTM!

The root route is well-structured with proper authentication preloading in beforeLoad, correct HTML shell setup in RootDocument, and appropriate integration of the Convex provider. The use of Suspense to wrap the provider is a good practice for handling async boundaries.

docs/start/config.json (1)

341-344: LGTM!

The new example entry is correctly added to the Solid examples section with proper formatting and naming that matches the convention of other examples in the config.

examples/solid/start-convex-better-auth/convex/convex.config.ts (1)

1-6: LGTM!

The Convex app configuration is clean and correctly applies the Better Auth middleware. The structure follows the recommended pattern for Convex configuration files.

examples/solid/start-convex-better-auth/src/routes/index.tsx (1)

5-12: LGTM!

The authentication guard logic correctly redirects authenticated users to the dashboard, preventing redundant login attempts.

examples/solid/start-convex-better-auth/convex/schema.ts (1)

8-13: LGTM!

The schema definition is appropriate for the example, with a userId index supporting efficient per-user queries.

examples/solid/start-convex-better-auth/convex/http.ts (1)

4-6: LGTM!

The HTTP router configuration correctly integrates authentication routes via the auth component.

examples/solid/start-convex-better-auth/convex/auth.ts (1)

28-30: Email verification is disabled for quick setup.

While appropriate for development and initial setup, be aware that requireEmailVerification: false allows accounts to be created without verifying email ownership, which can lead to abuse in production environments.

For production deployments, consider enabling email verification and configuring an email provider.

examples/solid/start-convex-better-auth/convex/myFunctions.ts (1)

26-35: Verify the intended sort order.

The query orders results by 'desc' (most recent first) but then calls .reverse() on line 34, which would make them oldest-first. The comment on line 29 states "return most recent", which suggests descending order is intended.

If you want most recent first, remove the .reverse() call:

     const numbers = await ctx.db
       .query('numbers')
       .withIndex('userId', (q) => q.eq('userId', authUser._id))
       // Ordered by _creationTime, return most recent
       .order('desc')
       .take(args.count)
     return {
       viewer: (await ctx.auth.getUserIdentity())?.name ?? null,
-      numbers: numbers.reverse().map((number) => number.value),
+      numbers: numbers.map((number) => number.value),
     }

If you want oldest first, update the comment:

       .withIndex('userId', (q) => q.eq('userId', authUser._id))
-      // Ordered by _creationTime, return most recent
+      // Ordered by _creationTime, return oldest first
       .order('desc')
examples/solid/start-convex-better-auth/src/router.tsx (1)

8-8: Avoid exposing stack traces directly in the UI.

Displaying raw error stack traces can leak sensitive information such as file paths, internal structure, and dependencies. While acceptable for local development, this should be guarded for production environments.

Consider applying this diff to conditionally display stack traces:

-    defaultErrorComponent: (err) => <p>{err.error.stack}</p>,
+    defaultErrorComponent: (err) => (
+      <p>{import.meta.env.DEV ? err.error.stack : 'An error occurred'}</p>
+    ),
⛔ Skipped due to learnings
Learnt from: schiller-manuel
Repo: TanStack/router PR: 5363
File: examples/react/start-streaming-data-from-server-functions/src/router.tsx:8-8
Timestamp: 2025-10-05T20:43:54.661Z
Learning: For code in example or demo directories (e.g., paths containing `examples/`), do not flag production-level security concerns such as displaying raw error stacks, hardcoded credentials for demos, or lack of input validation. Examples are for educational purposes and different standards apply.

Comment on lines +1 to +10
# Deployment used by `npx convex dev`
CONVEX_DEPLOYMENT=

VITE_CONVEX_URL=

# Same as VITE_CONVEX_URL but ends in .site
VITE_CONVEX_SITE_URL=

# Your local site URL
SITE_URL=http://localhost:3000 No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Add CONVEX_SITE_URL for backend auth configuration.

The convex/auth.config.ts file references process.env.CONVEX_SITE_URL, but this environment variable is not defined in .env.example. This may cause the auth configuration to have an undefined domain.

Apply this diff to add the missing variable:

 # Deployment used by `npx convex dev`
 CONVEX_DEPLOYMENT=
 
 VITE_CONVEX_URL=
 
 # Same as VITE_CONVEX_URL but ends in .site
 VITE_CONVEX_SITE_URL=
 
+# Backend site URL for Convex auth (same as SITE_URL)
+CONVEX_SITE_URL=http://localhost:3000
+
 # Your local site URL
 SITE_URL=http://localhost:3000
🧰 Tools
🪛 dotenv-linter (4.0.0)

[warning] 10-10: [EndingBlankLine] No blank line at the end of the file

(EndingBlankLine)

🤖 Prompt for AI Agents
In examples/solid/start-convex-better-auth/.env.example around lines 1 to 10,
add a CONVEX_SITE_URL entry so the backend auth config can read
process.env.CONVEX_SITE_URL; update the file by inserting a new line like
CONVEX_SITE_URL= (or a sensible default such as http://localhost:3000) alongside
the other CONVEX/VITE variables so the auth configuration never receives an
undefined domain.

export default {
providers: [
{
domain: process.env.CONVEX_SITE_URL,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify environment variable and handle undefined domain.

The domain field uses process.env.CONVEX_SITE_URL, but the .env.example file defines SITE_URL (not CONVEX_SITE_URL). Additionally, if the environment variable is not set, the domain will be undefined, which may cause runtime issues.

Verify the correct environment variable name and consider adding validation:


🏁 Script executed:

#!/bin/bash
# Check if CONVEX_SITE_URL or SITE_URL is referenced in Convex auth setup
rg -n 'CONVEX_SITE_URL|SITE_URL' --type ts examples/solid/start-convex-better-auth/convex/

Length of output: 201



---

🏁 Script executed:

```shell
#!/bin/bash
# Find and display .env.example file
fd '.env.example' examples/solid/start-convex-better-auth/

Length of output: 0


🏁 Script executed:

#!/bin/bash
# View auth.config.ts with context around line 4
cat examples/solid/start-convex-better-auth/convex/auth.config.ts

Length of output: 125


🏁 Script executed:

#!/bin/bash
# View auth.ts with context around line 9
cat examples/solid/start-convex-better-auth/convex/auth.ts

Length of output: 1516


🏁 Script executed:

#!/bin/bash
# Check if there are any .env files in the root or example directory
fd '\.env' examples/solid/start-convex-better-auth/ -type f

Length of output: 170


🏁 Script executed:

#!/bin/bash
# Search for CONVEX_SITE_URL or SITE_URL in entire example directory
rg -n 'CONVEX_SITE_URL|SITE_URL' examples/solid/start-convex-better-auth/

Length of output: 201


🏁 Script executed:

#!/bin/bash
# Search for .env.example at multiple levels
find examples/solid/start-convex-better-auth -name '.env*' -o -name '.env.example' 2>/dev/null | head -20

Length of output: 52


🏁 Script executed:

#!/bin/bash
# Check for README or setup files that document environment variables
fd 'README|setup|ENV|\.env' examples/solid/start-convex-better-auth/ --max-depth 2

Length of output: 56


🏁 Script executed:

#!/bin/bash
# Search entire repository for .env.example to understand naming pattern
fd -H '\.env\.example' . --max-depth 4

Length of output: 208


🏁 Script executed:

#!/bin/bash
# Check all references to SITE_URL and CONVEX_SITE_URL across entire examples/solid directory
rg 'SITE_URL|CONVEX_SITE_URL' examples/solid/ -n

Length of output: 201


🏁 Script executed:

#!/bin/bash
# View .env.example to see which variables are defined
cat examples/solid/start-convex-better-auth/.env.example

Length of output: 195


🏁 Script executed:

#!/bin/bash
# View convex README for documentation on env vars
cat examples/solid/start-convex-better-auth/convex/README.md

Length of output: 2485


Fix environment variable mismatch in auth.config.ts.

The .env.example file defines SITE_URL and VITE_CONVEX_SITE_URL, but auth.config.ts references CONVEX_SITE_URL (which does not exist). This creates an inconsistency where the domain field will be undefined at runtime. Either correct the variable name to match what's defined in .env.example or add validation to handle the undefined case.

🤖 Prompt for AI Agents
In examples/solid/start-convex-better-auth/convex/auth.config.ts around line 4,
the code uses process.env.CONVEX_SITE_URL which doesn't exist in .env.example;
update the reference to read from the correct env vars (prefer client-safe
VITE_CONVEX_SITE_URL, falling back to SITE_URL) and add a runtime validation
that throws or logs a clear error if the resolved domain is undefined so domain
is never silently undefined at runtime.

import type { GenericCtx } from '@convex-dev/better-auth'
import type { DataModel } from './_generated/dataModel'

const siteUrl = process.env.SITE_URL!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Validate the required environment variable.

Using a non-null assertion on process.env.SITE_URL! will cause a runtime error if the variable is undefined. Consider providing a fallback or validation with a clear error message.

Apply this diff to add validation:

-const siteUrl = process.env.SITE_URL!
+const siteUrl = process.env.SITE_URL
+if (!siteUrl) {
+  throw new Error('SITE_URL environment variable is required')
+}
🤖 Prompt for AI Agents
In examples/solid/start-convex-better-auth/convex/auth.ts around line 9, the
code uses a non-null assertion on process.env.SITE_URL! which can throw at
runtime if the env var is missing; replace the assertion with an explicit
validation: read process.env.SITE_URL into a const, check if it's undefined or
empty, and if so throw a clear Error explaining SITE_URL is required (or
alternatively assign a safe default URL if appropriate), otherwise use the
validated value for siteUrl.

# Welcome to your Convex functions directory!

Write your Convex functions here.
See https://docs.convex.dev/functions for more.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Wrap the URL in angle brackets for proper Markdown formatting.

The bare URL should be wrapped in angle brackets to comply with Markdown best practices.

Apply this diff:

-See https://docs.convex.dev/functions for more.
+See <https://docs.convex.dev/functions> for more.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
See https://docs.convex.dev/functions for more.
See <https://docs.convex.dev/functions> for more.
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

4-4: Bare URL used

(MD034, no-bare-urls)

🤖 Prompt for AI Agents
In examples/solid/start-convex-better-auth/convex/README.md around line 4, the
bare URL "https://docs.convex.dev/functions" should be wrapped in angle brackets
for proper Markdown formatting; update the line to use
<https://docs.convex.dev/functions> so the URL renders correctly and doesn't get
parsed as plain text.

Comment on lines +15 to +17
"@tanstack/solid-router": "^1.134.16",
"@tanstack/solid-router-devtools": "^1.134.16",
"@tanstack/solid-start": "^1.134.16",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Use workspace protocol for internal TanStack dependencies.

Per the coding guidelines, internal dependencies should use the workspace:* protocol instead of fixed versions. This ensures the example uses the local workspace versions of TanStack packages.

Apply this diff:

-    "@tanstack/solid-router": "^1.134.16",
-    "@tanstack/solid-router-devtools": "^1.134.16",
-    "@tanstack/solid-start": "^1.134.16",
+    "@tanstack/solid-router": "workspace:*",
+    "@tanstack/solid-router-devtools": "workspace:*",
+    "@tanstack/solid-start": "workspace:*",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"@tanstack/solid-router": "^1.134.16",
"@tanstack/solid-router-devtools": "^1.134.16",
"@tanstack/solid-start": "^1.134.16",
"@tanstack/solid-router": "workspace:*",
"@tanstack/solid-router-devtools": "workspace:*",
"@tanstack/solid-start": "workspace:*",
🤖 Prompt for AI Agents
In examples/solid/start-convex-better-auth/package.json around lines 15 to 17,
the TanStack internal dependencies are pinned to fixed versions; change each of
the three entries ("@tanstack/solid-router", "@tanstack/solid-router-devtools",
"@tanstack/solid-start") to use the workspace protocol by replacing their
version strings with "workspace:*" so the example resolves to local workspace
packages.

Comment on lines +10 to +18
beforeLoad: async (ctx) => {
const user = await fetchUser()
if (!ctx.context.token) {
throw redirect({
to: '/',
})
}
return { user }
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Check token before fetching user to avoid unnecessary calls.

The current implementation calls fetchUser() before checking if ctx.context.token exists. If the token is missing, this results in an unnecessary async call that will either fail or return no data. Checking the token first improves performance and avoids potential errors.

Apply this diff:

   beforeLoad: async (ctx) => {
-    const user = await fetchUser()
     if (!ctx.context.token) {
       throw redirect({
         to: '/',
       })
     }
+    const user = await fetchUser()
     return { user }
   },
🤖 Prompt for AI Agents
In examples/solid/start-convex-better-auth/src/routes/_authed.tsx around lines
10 to 18, fetchUser() is called before verifying ctx.context.token; this makes
an unnecessary async call when no token exists. Move the token existence check
to run before calling fetchUser(): if ctx.context.token is falsy, immediately
throw the redirect, otherwise await fetchUser() and return the user. Ensure no
fetchUser() call happens when token is absent.

@@ -0,0 +1,15 @@
import { createFileRoute } from '@tanstack/solid-router'
import { reactStartHandler } from '@convex-dev/better-auth/react-start'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify the correct handler import for Solid Start.

The import is from @convex-dev/better-auth/react-start, but this is a Solid Start example. Please verify that this is the correct handler for Solid Start applications. If Better Auth provides a separate solid-start export or if this handler is framework-agnostic despite the name, it would be helpful to add a comment explaining this to avoid confusion.


🏁 Script executed:

#!/bin/bash
# Description: Search for Better Auth Solid Start documentation or alternative handlers

# Check if there are any references to solid-start in the Better Auth package
rg -n "solid-start" --type=ts --type=js -g '!node_modules' -C2

# Look for any documentation or examples using Better Auth with Solid
fd -e md -e mdx README CHANGELOG -x cat {} \; | rg -i "solid"

Length of output: 70836


Incorrect import for Solid Start framework.

SolidStart requires toSolidStartHandler from "better-auth/solid-start", but this file uses reactStartHandler from @convex-dev/better-auth/react-start. React Start integration is specifically for TanStack Start applications, not SolidStart. Update the import to use the correct handler for this Solid Start example.

- import { reactStartHandler } from '@convex-dev/better-auth/react-start'
+ import { toSolidStartHandler } from 'better-auth/solid-start'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { reactStartHandler } from '@convex-dev/better-auth/react-start'
import { toSolidStartHandler } from 'better-auth/solid-start'
🤖 Prompt for AI Agents
In examples/solid/start-convex-better-auth/src/routes/api/auth/$.ts around line
2, the file incorrectly imports reactStartHandler from
@convex-dev/better-auth/react-start instead of the Solid Start integration;
replace that import with toSolidStartHandler from
@convex-dev/better-auth/solid-start and update any references to use
toSolidStartHandler so the handler matches SolidStart’s API.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 9, 2025

More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@5796

@tanstack/directive-functions-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/directive-functions-plugin@5796

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/eslint-plugin-router@5796

@tanstack/history

npm i https://pkg.pr.new/TanStack/router/@tanstack/history@5796

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/nitro-v2-vite-plugin@5796

@tanstack/react-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router@5796

@tanstack/react-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-devtools@5796

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-ssr-query@5796

@tanstack/react-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@5796

@tanstack/react-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@5796

@tanstack/react-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@5796

@tanstack/router-cli

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-cli@5796

@tanstack/router-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-core@5796

@tanstack/router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools@5796

@tanstack/router-devtools-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools-core@5796

@tanstack/router-generator

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-generator@5796

@tanstack/router-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-plugin@5796

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-ssr-query-core@5796

@tanstack/router-utils

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-utils@5796

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-vite-plugin@5796

@tanstack/server-functions-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/server-functions-plugin@5796

@tanstack/solid-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router@5796

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-devtools@5796

@tanstack/solid-router-ssr-query

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-ssr-query@5796

@tanstack/solid-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@5796

@tanstack/solid-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@5796

@tanstack/solid-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@5796

@tanstack/start-client-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@5796

@tanstack/start-plugin-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@5796

@tanstack/start-server-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@5796

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-static-server-functions@5796

@tanstack/start-storage-context

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@5796

@tanstack/valibot-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@5796

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@5796

@tanstack/zod-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@5796

commit: 4fd9338

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

♻️ Duplicate comments (1)
examples/solid/start-convex-better-auth/src/routes/_authed.tsx (1)

10-18: Check token before fetching user to avoid unnecessary calls.

As noted in the previous review, fetchUser() is called before verifying that ctx.context.token exists. If the token is missing, this results in an unnecessary async call. Check the token first to improve performance and avoid potential errors.

Apply this diff:

   beforeLoad: async (ctx) => {
-    const user = await fetchUser()
     if (!ctx.context.token) {
       throw redirect({
         to: '/',
       })
     }
+    const user = await fetchUser()
     return { user }
   },
🧹 Nitpick comments (1)
examples/solid/start-convex-better-auth/src/library/utils.ts (1)

5-7: LGTM! Standard utility implementation.

This is a well-established pattern for merging Tailwind CSS classes. The implementation is correct and functional.

Consider adding an explicit return type for enhanced type safety, as per the coding guidelines:

-export function cn(...inputs: Array<ClassValue>) {
+export function cn(...inputs: Array<ClassValue>): string {
   return twMerge(clsx(inputs))
 }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 60b687f and 5113692.

📒 Files selected for processing (10)
  • examples/solid/start-convex-better-auth/src/components/login-signup-form.tsx (1 hunks)
  • examples/solid/start-convex-better-auth/src/library/auth-client.ts (1 hunks)
  • examples/solid/start-convex-better-auth/src/library/auth-server.ts (1 hunks)
  • examples/solid/start-convex-better-auth/src/library/convex-client.ts (1 hunks)
  • examples/solid/start-convex-better-auth/src/library/server.ts (1 hunks)
  • examples/solid/start-convex-better-auth/src/library/utils.ts (1 hunks)
  • examples/solid/start-convex-better-auth/src/providers/convex.tsx (1 hunks)
  • examples/solid/start-convex-better-auth/src/routes/__root.tsx (1 hunks)
  • examples/solid/start-convex-better-auth/src/routes/_authed.tsx (1 hunks)
  • examples/solid/start-convex-better-auth/src/routes/_authed/dashboard.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • examples/solid/start-convex-better-auth/src/providers/convex.tsx
  • examples/solid/start-convex-better-auth/src/routes/__root.tsx
  • examples/solid/start-convex-better-auth/src/routes/_authed/dashboard.tsx
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript in strict mode with extensive type safety across the codebase

Files:

  • examples/solid/start-convex-better-auth/src/library/utils.ts
  • examples/solid/start-convex-better-auth/src/library/convex-client.ts
  • examples/solid/start-convex-better-auth/src/library/auth-client.ts
  • examples/solid/start-convex-better-auth/src/library/server.ts
  • examples/solid/start-convex-better-auth/src/components/login-signup-form.tsx
  • examples/solid/start-convex-better-auth/src/routes/_authed.tsx
  • examples/solid/start-convex-better-auth/src/library/auth-server.ts
examples/{react,solid}/**

📄 CodeRabbit inference engine (AGENTS.md)

Keep example applications under examples/react/ and examples/solid/

Files:

  • examples/solid/start-convex-better-auth/src/library/utils.ts
  • examples/solid/start-convex-better-auth/src/library/convex-client.ts
  • examples/solid/start-convex-better-auth/src/library/auth-client.ts
  • examples/solid/start-convex-better-auth/src/library/server.ts
  • examples/solid/start-convex-better-auth/src/components/login-signup-form.tsx
  • examples/solid/start-convex-better-auth/src/routes/_authed.tsx
  • examples/solid/start-convex-better-auth/src/library/auth-server.ts
**/src/routes/**

📄 CodeRabbit inference engine (AGENTS.md)

Place file-based routes under src/routes/ directories

Files:

  • examples/solid/start-convex-better-auth/src/routes/_authed.tsx
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
Repo: TanStack/router PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-23T17:36:12.598Z
Learning: Applies to examples/{react,solid}/** : Keep example applications under examples/react/ and examples/solid/
📚 Learning: 2025-09-23T17:36:12.598Z
Learnt from: CR
Repo: TanStack/router PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-23T17:36:12.598Z
Learning: Applies to packages/{react-router,solid-router}/** : Implement React and Solid bindings/components only in packages/react-router/ and packages/solid-router/

Applied to files:

  • examples/solid/start-convex-better-auth/src/routes/_authed.tsx
🧬 Code graph analysis (6)
examples/solid/start-convex-better-auth/src/library/convex-client.ts (1)
examples/solid/start-convex-better-auth/src/library/server.ts (1)
  • fetchAuth (12-23)
examples/solid/start-convex-better-auth/src/library/auth-client.ts (1)
examples/solid/start-convex-better-auth/src/library/convex-client.ts (1)
  • convexClient (10-10)
examples/solid/start-convex-better-auth/src/library/server.ts (2)
packages/start-server-core/src/request-response.ts (2)
  • getRequest (72-75)
  • getCookie (226-228)
examples/solid/start-convex-better-auth/convex/auth.ts (1)
  • createAuth (15-37)
examples/solid/start-convex-better-auth/src/components/login-signup-form.tsx (2)
examples/solid/start-convex-better-auth/src/library/auth-client.ts (1)
  • authClient (4-6)
examples/solid/start-convex-better-auth/src/library/convex-client.ts (1)
  • refreshAuth (13-18)
examples/solid/start-convex-better-auth/src/routes/_authed.tsx (4)
examples/solid/start-convex-better-auth/src/routes/__root.tsx (1)
  • Route (10-19)
examples/solid/start-convex-better-auth/src/routes/_authed/dashboard.tsx (1)
  • Route (12-14)
examples/solid/start-convex-better-auth/src/routes/index.tsx (1)
  • Route (5-12)
examples/solid/start-convex-better-auth/src/library/server.ts (1)
  • fetchUser (25-32)
examples/solid/start-convex-better-auth/src/library/auth-server.ts (2)
examples/solid/start-convex-better-auth/convex/auth.ts (1)
  • createAuth (15-37)
packages/start-server-core/src/request-response.ts (1)
  • getCookie (226-228)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Test
🔇 Additional comments (7)
examples/solid/start-convex-better-auth/src/library/auth-client.ts (1)

1-6: LGTM!

Clean auth client setup integrating Better Auth with the Convex plugin for Solid.js.

examples/solid/start-convex-better-auth/src/library/convex-client.ts (1)

12-20: LGTM!

The refreshAuth implementation correctly configures the Convex client to fetch authentication tokens from the server and initializes auth on load.

examples/solid/start-convex-better-auth/src/components/login-signup-form.tsx (2)

1-13: LGTM!

Clean component setup with appropriate imports and Solid.js signal declarations for form state management.


44-199: LGTM!

Well-structured form UI with appropriate conditional rendering for login/signup modes, loading states, and error handling.

examples/solid/start-convex-better-auth/src/library/server.ts (3)

11-23: LGTM!

The fetchAuth function correctly retrieves the session and token from cookies for SSR auth flow using Better Auth and Convex integration.


25-32: LGTM!

The fetchUser function appropriately queries the current user and handles errors by redirecting to the root route.


34-42: LGTM!

Good example demonstrating how to call Convex mutations from server functions.

Comment on lines +20 to +36
try {
if (isLogin()) {
await authClient.signIn.email({
email: email(),
password: password(),
})
} else {
await authClient.signUp.email({
name: name(),
email: email(),
password: password(),
})
}

refreshAuth()

navigate({ to: '/dashboard' })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Consider awaiting refreshAuth() before navigation.

Line 34 calls refreshAuth() but doesn't await it. This could cause a race condition where navigation to /dashboard occurs before the Convex client's auth state is fully updated, potentially leading to authentication issues on the dashboard route.

Apply this diff:

       }
 
-      refreshAuth()
+      await refreshAuth()
 
       navigate({ to: '/dashboard' })
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
try {
if (isLogin()) {
await authClient.signIn.email({
email: email(),
password: password(),
})
} else {
await authClient.signUp.email({
name: name(),
email: email(),
password: password(),
})
}
refreshAuth()
navigate({ to: '/dashboard' })
try {
if (isLogin()) {
await authClient.signIn.email({
email: email(),
password: password(),
})
} else {
await authClient.signUp.email({
name: name(),
email: email(),
password: password(),
})
}
await refreshAuth()
navigate({ to: '/dashboard' })
🤖 Prompt for AI Agents
In examples/solid/start-convex-better-auth/src/components/login-signup-form.tsx
around lines 20 to 36, refreshAuth() is invoked but not awaited, which can race
with navigate to '/dashboard'; update the function call to await refreshAuth()
(i.e., await the promise returned by refreshAuth() before calling navigate) so
the Convex client's auth state is fully updated prior to navigation.

Comment on lines +1 to +6
import { createAuth } from 'convex/auth'
import { setupFetchClient } from '@convex-dev/better-auth/react-start'
import { getCookie } from '@tanstack/solid-start/server'

export const { fetchQuery, fetchMutation, fetchAction } =
await setupFetchClient(createAuth, getCookie)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify import path consistency for createAuth.

The import path for createAuth differs between files:

  • Line 1 imports from 'convex/auth'
  • server.ts line 13 imports from '../../convex/auth'

Ensure this inconsistency is intentional (e.g., if convex/auth is a configured module alias) or correct it to use consistent paths across the codebase.

Run this script to check import paths:


🏁 Script executed:

#!/bin/bash
# Check all imports of createAuth to verify consistency
rg -n "from ['\"].*convex/auth['\"]" examples/solid/start-convex-better-auth/

Length of output: 109


🏁 Script executed:

#!/bin/bash
# Find all server.ts files in the examples/solid/start-convex-better-auth/ directory
fd -type f "server\.ts" examples/solid/start-convex-better-auth/

Length of output: 170


🏁 Script executed:

#!/bin/bash
# List all TypeScript files in the library directory to understand the project structure
fd -type f "\.ts$" examples/solid/start-convex-better-auth/src/

Length of output: 170


🏁 Script executed:

#!/bin/bash
# Search for all imports of createAuth across the entire example project
rg -n "createAuth" examples/solid/start-convex-better-auth/

Length of output: 1136


🏁 Script executed:

#!/bin/bash
# Check the full structure and file list of the example
find examples/solid/start-convex-better-auth/ -type f -name "*.ts" -o -name "*.tsx" | head -20

Length of output: 1273


🏁 Script executed:

#!/bin/bash
# Check if there's a convex directory with auth-related files
find examples/solid/start-convex-better-auth/convex -type f 2>/dev/null || echo "No convex directory found"

Length of output: 815


🏁 Script executed:

#!/bin/bash
# Check package.json for module alias configuration
cat examples/solid/start-convex-better-auth/package.json | grep -A 20 '"imports"\|"alias"\|"paths"' || echo "No explicit imports/alias configuration found in package.json"

Length of output: 61


🏁 Script executed:

#!/bin/bash
# Check tsconfig.json for path aliases
cat examples/solid/start-convex-better-auth/tsconfig.json 2>/dev/null | grep -A 10 '"paths"' || echo "No tsconfig.json or paths found"

Length of output: 71


🏁 Script executed:

#!/bin/bash
# Look for vite.config or similar configuration files that might define module aliases
find examples/solid/start-convex-better-auth/ -type f \( -name "vite.config.ts" -o -name "vite.config.js" -o -name "astro.config.mjs" \) -exec cat {} \; 2>/dev/null | head -50

Length of output: 455


🏁 Script executed:

#!/bin/bash
# Check if auth-server.ts is imported/used anywhere in the project
rg -n "from.*auth-server|import.*auth-server" examples/solid/start-convex-better-auth/

Length of output: 121


🏁 Script executed:

#!/bin/bash
# Check the actual auth-server.ts file content
cat examples/solid/start-convex-better-auth/src/library/auth-server.ts

Length of output: 275


🏁 Script executed:

#!/bin/bash
# Look for any rollup/build config or other config that might define module aliases
find examples/solid/start-convex-better-auth/ -type f \( -name ".rolluprc*" -o -name "rollup.config.*" -o -name "build.config.*" -o -name "wrangler.toml" \) 2>/dev/null | xargs cat

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Check package.json for any exports field or subpath configuration
cat examples/solid/start-convex-better-auth/package.json

Length of output: 964


🏁 Script executed:

#!/bin/bash
# Check for convex.config.ts and how convex is configured
cat examples/solid/start-convex-better-auth/convex/convex.config.ts

Length of output: 168


🏁 Script executed:

#!/bin/bash
# Check the root-level package.json to see if convex is configured there
cat package.json 2>/dev/null | head -50 || echo "No root package.json or cannot access"

Length of output: 2414


🏁 Script executed:

#!/bin/bash
# Check if 'convex' package (in node_modules) might define a subpath export for 'convex/auth'
# by looking at @convex-dev/better-auth documentation about import paths
rg -n "convex/auth|@convex-dev/better-auth" examples/solid/start-convex-better-auth/package.json

Length of output: 43


🌐 Web query:

Does the convex npm package export convex/auth as a subpath export?

💡 Result:

Short answer: No.

The Convex Auth functionality is provided by a separate package (@convex-dev/auth) and the docs show importing from that package (e.g. "@convex-dev/auth/server" and "@convex-dev/auth/react") and creating a local convex/auth.ts file in your project—rather than importing a "convex/auth" subpath from the main convex package. [1][2]

Sources:

  • Convex Auth docs / setup and API reference. [1]
  • @convex-dev/auth npm page. [2]

🌐 Web query:

How does Better Auth Convex integration handle module imports?

💡 Result:

Short answer: the Convex integration distributes a small set of named exports you import from the Better Auth packages and register in your Convex app (not by mixing your runtime auth instance into Convex code).

Key points:

  • You import the Convex plugin/config and register it in convex.config.ts (e.g. import betterAuth from "@convex-dev/better-auth/convex.config"; app.use(betterAuth)). [1]
  • Server-side helpers and the Better Auth component are imported from the Better Auth packages (examples use imports like createClient / betterAuth from "@convex-dev/better-auth" and the Convex plugins from "@convex-dev/better-auth/plugins"). Generated Convex types (./_generated/...) are used alongside those imports. [1]
  • Client-side uses the Convex client plugin (e.g. convexClient from "@convex-dev/better-auth/client/plugins") and a Convex provider component from the package. [1]
  • Guidance / gotcha: older third‑party Convex adapters explicitly warn not to import your Better Auth runtime auth instance into Convex files (it can cause build/runtime issues); prefer the official @Convex-Dev integration and follow the documented import/register pattern. [2]

Sources: Better Auth Convex integration docs. [1][2]


🌐 Web query:

convex/auth subpath export documentation

💡 Result:

Do you mean the Convex Auth "subpath" export (e.g., exporting auth routes or a subpath in convex/auth.config) — or do you want links to the official docs for Convex Auth and related exports?


🌐 Web query:

@convex-dev/better-auth convex/auth import path

💡 Result:

Use the package exports shown in the Convex+Better Auth docs:

  • From the npm package:

    • import core helpers: import { createClient, type GenericCtx } from "@convex-dev/better-auth". [1]
    • import the Convex plugin(s): import { convex, crossDomain } from "@convex-dev/better-auth/plugins". [2]
  • Your Convex project should have a local convex/auth.ts that exports createAuth (used by Convex functions). Example usage imports createAuth from your local file: import { createAuth, authComponent } from "./auth"; and you register routes with authComponent.registerRoutes(...). [2][3]

Sources:
[1] @convex-dev/better-auth npm page.
[2] Convex + Better Auth docs (convex/auth.ts examples).
[3] Convex + Better Auth framework guides (Next.js / React examples).


🌐 Web query:

Convex package subpath exports node_modules resolution

💡 Result:

Short answer: Convex publishes an exports map in its package.json, so Node (and bundlers that respect package exports) will only resolve the public subpaths the package author declared (e.g. "convex", "convex/server", "convex/react", "convex/browser", "convex/values", and "./package.json"). That means deep imports into convex's internal paths under node_modules (like importing arbitrary files under dist/) will be blocked — you must import the documented subpath exports or the package's main entry. See the convex package.json for the exact subpaths. [1]

Practical guidance

  • Use the documented subpath imports: import from "convex", "convex/server", "convex/react", etc. — these are listed in the package exports. [1]
  • If a server-side Convex action needs an npm package, follow Convex bundling/externalPackage rules (Convex will bundle or mark as external per convex.json). For server Node actions you can configure node.externalPackages or mark "*" to install on the server. [2][3]
  • If you need access to an internal file the package doesn’t export, either request the maintainer to expose a public subpath or copy the required logic into your project — don’t rely on deep node_modules file paths because Node’s exports map intentionally prevents that. [1]

Sources

  • convex package.json (exports map & subpaths). [1]
  • Convex bundling / externalPackages docs. [2]
  • Convex functions docs about using NPM packages in Convex functions. [3]

🌐 Web query:

convex/server vs convex/auth module resolution

💡 Result:

Short answer: "convex/server" is the core Convex package that exports schema/table/edge builders and server runtime types (defineSchema, defineTable, v, defineApp, server-side function helpers). The Auth package is a separate npm package (published under @convex-dev/auth or provider-specific packages) that exports auth-related helpers and table definitions from its own module paths (e.g. @convex-dev/auth/server, @convex-dev/auth/react). In practice you import core DB/schema primitives from "convex/server" and import the auth helpers/tables from the auth package; you may also create a local convex/auth.ts file that composes or re-exports auth helpers for your app.

Key points

  • Use "convex/server" for Convex core schema and server APIs (defineSchema, defineTable, v, defineApp, server functions). [1]
  • Use the auth package’s server entry (e.g. @convex-dev/auth/server) to get authTables, getAuthUserId, convexAuth helpers and server-side auth utilities. Add authTables into your schema via spread (...authTables). [2][3]
  • For frontend/react hooks and client integration import from @convex-dev/auth/react (or provider-specific client exports). [2][4]
  • Many examples place a local convex/auth.ts that imports/initializes the auth package and re-exports createAuth/convexAuth for app use (so imports look like "./auth" or "convex/auth" in your Convex code). [2][5]

If you want, tell me which exact import lines you’re using (and your package.json) and I’ll show the minimal, correct imports for your setup and fix any resolution errors.

Sources:
[1] Convex core docs (schema/server APIs).
[2] Convex Auth docs / setup examples (authTables, getAuthUserId, server vs react entry points).
[3] Labs Convex Auth schema example showing ...authTables in convex/schema.ts.
[4] @convex-dev/auth react usage examples.
[5] Examples that create a local convex/auth.ts to compose/re-export auth helpers.


Fix invalid module import path in auth-server.ts.

The import path 'convex/auth' is invalid and will fail at runtime. The convex npm package does not export a convex/auth subpath—it only exports documented paths like convex/server, convex/react, etc. The local convex/auth.ts file must be imported using a relative path.

Change line 1 from:

import { createAuth } from 'convex/auth'

To:

import { createAuth } from '../../convex/auth'

This makes the import consistent with server.ts:13, which correctly imports from the same local file using a relative path.

🤖 Prompt for AI Agents
In examples/solid/start-convex-better-auth/src/library/auth-server.ts around
lines 1 to 6, the import uses a non-existent package subpath 'convex/auth' —
replace that package import with a relative import to the local file (same path
style as server.ts) so it points to the local convex/auth.ts module; update the
import statement to use the correct relative path (../../convex/auth) and ensure
any path resolution matches the project directory structure.

Comment on lines +4 to +10
const CONVEX_URL = import.meta.env.VITE_CONVEX_URL
if (!CONVEX_URL) {
console.error('missing envar CONVEX_URL')
}

// Set up Convex client with auth
export const convexClient = setupConvex(CONVEX_URL)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Improve error handling for missing CONVEX_URL.

The code logs an error when CONVEX_URL is missing but continues to pass undefined to setupConvex(), which will likely cause runtime errors. Consider throwing an error or providing a more robust fallback.

Apply this diff to throw an error when the environment variable is missing:

 const CONVEX_URL = import.meta.env.VITE_CONVEX_URL
 if (!CONVEX_URL) {
-  console.error('missing envar CONVEX_URL')
+  throw new Error('Missing required environment variable: VITE_CONVEX_URL')
 }
🤖 Prompt for AI Agents
In examples/solid/start-convex-better-auth/src/library/convex-client.ts around
lines 4 to 10, the file currently logs an error when CONVEX_URL is missing but
still calls setupConvex(CONVEX_URL); change this so the code throws a clear
Error when CONVEX_URL is falsy (e.g., throw new Error('Missing required env
VITE_CONVEX_URL')) instead of only logging, and only call and export
setupConvex(CONVEX_URL) after the presence check succeeds; ensure the thrown
error stops initialization and provides a descriptive message for debugging.

@birkskyum birkskyum changed the title Start convex better auth example docs(solid-start): convex better auth example Nov 9, 2025
@birkskyum birkskyum changed the title docs(solid-start): convex better auth example docs(solid-start): convex + better-auth example Nov 9, 2025
@birkskyum birkskyum merged commit fa5d8d6 into TanStack:main Nov 9, 2025
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Everything documentation related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants