Skip to content
Draft
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
2 changes: 1 addition & 1 deletion .oxfmtrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
}
],
"sortPackageJson": false,
"ignorePatterns": ["pnpm-lock.yaml", "deno.lock", "bun.lock", "dist", "node_modules", "coverage"]
"ignorePatterns": ["pnpm-lock.yaml", "deno.lock", "bun.lock", "dist", "node_modules", "coverage", "routeTree.gen.ts"]
}
12 changes: 0 additions & 12 deletions apps/tanstack-start/.cta.json

This file was deleted.

24 changes: 10 additions & 14 deletions apps/tanstack-start/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,23 @@
"format:check": "oxfmt --check"
},
"dependencies": {
"@aura-stack/react": "workspace:*",
"@aura-stack/tanstack-start": "workspace:*",
"@hookform/resolvers": "^5.2.2",
"@radix-ui/react-label": "^2.1.8",
"@radix-ui/react-slot": "^1.2.4",
"@radix-ui/react-tabs": "^1.1.13",
"@tailwindcss/vite": "catalog:@tailwindcss/vite",
"@tanstack/react-devtools": "^0.10.5",
"@tanstack/react-router": "^1.170.15",
"@tanstack/react-router-devtools": "^1.167.0",
"@tanstack/react-router-ssr-query": "^1.167.1",
"@tanstack/react-start": "^1.168.25",
"@tanstack/router-plugin": "^1.168.18",
"@tanstack/react-devtools": "^0.10.9",
"@tanstack/react-router": "^1.170.24",
"@tanstack/react-router-devtools": "^1.167.1",
"@tanstack/react-start": "^1.168.41",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"lucide-react": "catalog:lucide-react",
"nitro": "npm:nitro-nightly@latest",
"react": "catalog:react",
"react-dom": "catalog:react",
"react-hook-form": "^7.71.1",
"tailwind-merge": "^3.4.0",
"tailwindcss": "catalog:tailwindcss",
"vite-tsconfig-paths": "^6.0.2",
"zod": "catalog:zod-v4"
"tailwind-merge": "^3.4.0"
},
"devDependencies": {
"@aura-stack/tsconfig": "workspace:*",
Expand All @@ -43,11 +37,13 @@
"@types/node": "catalog:node",
"@types/react": "catalog:react",
"@types/react-dom": "catalog:react",
"@vitejs/plugin-react": "^5.0.4",
"@vitejs/plugin-react": "^5.2.0",
"jsdom": "^27.0.0",
"nitro": "^3.0.260610-beta",
"tailwindcss": "catalog:tailwindcss",
"tw-animate-css": "^1.4.0",
"typescript": "catalog:typescript",
"vite": "catalog:vite",
"vite": "catalog:vite-v8",
"web-vitals": "^5.1.0"
}
}
5 changes: 3 additions & 2 deletions apps/tanstack-start/src/components/header.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { useState } from "react"
import { Link } from "@tanstack/react-router"
import { Menu, X } from "lucide-react"
import { useAuth } from "@aura-stack/react"
import { useAuthActions, useSession } from "@aura-stack/tanstack-start/client"
import { Button } from "@/components/ui/button"

export const Header = () => {
const { status, isPending, signOut, signIn } = useAuth()
const { status } = useSession()
const { isPending, signOut, signIn } = useAuthActions()
const isAuthenticated = status === "authenticated"
const [mobileMenuOpen, setMobileMenuOpen] = useState(false)

Expand Down
2 changes: 1 addition & 1 deletion apps/tanstack-start/src/contexts/auth.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AuthProvider as AuraAuthProvider, type AuthProviderProps } from "@aura-stack/react"
import { AuthProvider as AuraAuthProvider, type AuthProviderProps } from "@aura-stack/tanstack-start/client"
import { authClient } from "@/lib/auth-client"

export const AuthProvider = ({ children, initialSession }: Omit<AuthProviderProps, "client">) => {
Expand Down
2 changes: 1 addition & 1 deletion apps/tanstack-start/src/lib/auth-client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createAuthClient } from "@aura-stack/react"
import { createAuthClient } from "@aura-stack/tanstack-start/client"

export const authClient = createAuthClient({
basePath: "/api/auth",
Expand Down
18 changes: 9 additions & 9 deletions apps/tanstack-start/src/lib/auth-server.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { api } from "@/lib/auth"
import { core } from "@/lib/auth"
import { redirect } from "@tanstack/react-router"
import { createServerFn } from "@tanstack/react-start"
import { getRequest, getRequestHeaders } from "@tanstack/react-start/server"

export const getSession = createServerFn({ method: "GET" }).handler(async () => {
try {
const session = await api.getSession({
const session = await core.api.getSession({
headers: getRequestHeaders(),
})
if (!session.success) return null
Expand All @@ -17,7 +17,7 @@ export const getSession = createServerFn({ method: "GET" }).handler(async () =>
})

export const signOutFn = createServerFn({ method: "POST" }).handler(async () => {
const response = await api
const response = await core.api
.signOut({
headers: getRequestHeaders(),
})
Expand All @@ -29,14 +29,14 @@ export const signOutFn = createServerFn({ method: "POST" }).handler(async () =>
})

export const signInFn = createServerFn({ method: "POST" })
.inputValidator((data: { provider: string }) => {
.validator((data: { provider: string }) => {
if (!data || typeof data.provider !== "string" || !data.provider.trim()) {
throw new Error("provider must be a non-empty string")
}
return data
})
.handler(async ({ data }) => {
const response = await api
const response = await core.api
.signIn(data.provider, {
request: getRequest(),
redirect: false,
Expand All @@ -51,14 +51,14 @@ export const signInFn = createServerFn({ method: "POST" })
})

export const signInCredentialsFn = createServerFn({ method: "POST" })
.inputValidator((data: { username: string; password: string }) => {
.validator((data: { username: string; password: string }) => {
if (!data || typeof data.username !== "string" || typeof data.password !== "string") {
throw new Error("credentials payload is invalid")
}
return data
})
.handler(async ({ data }) => {
const response = await api
const response = await core.api
.signInCredentials({
payload: {
username: data.username,
Expand All @@ -84,7 +84,7 @@ export const signInCredentialsFn = createServerFn({ method: "POST" })
})

export const updateSessionFn = createServerFn({ method: "POST" })
.inputValidator((data: { username?: string; email?: string }) => {
.validator((data: { username?: string; email?: string }) => {
if (!data || typeof data !== "object") {
throw new Error("update session payload is invalid")
}
Expand All @@ -97,7 +97,7 @@ export const updateSessionFn = createServerFn({ method: "POST" })
return data
})
.handler(async ({ data }) => {
const response = await api
const response = await core.api
.updateSession({
session: {
user: {
Expand Down
13 changes: 5 additions & 8 deletions apps/tanstack-start/src/lib/auth.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import { createAuth } from "@aura-stack/react/server"
import { createSecretValue } from "@aura-stack/react/crypto"
import { builtInOAuthProviders, type BuiltInOAuthProvider } from "@aura-stack/react/oauth"
import { createAuth } from "@aura-stack/tanstack-start"
import { createSecretValue } from "@aura-stack/tanstack-start/crypto"

export const oauth = Object.keys(builtInOAuthProviders) as BuiltInOAuthProvider[]

export const { handlers, jose, api } = createAuth({
oauth,
export const auth = createAuth({
oauth: ["github", "google", "gitlab"],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Keep the enabled provider list consistent with the demo controls.

This configuration excludes bitbucket. apps/tanstack-start/src/routes/client.tsx and apps/tanstack-start/src/routes/server.tsx still submit signIn("bitbucket"). That sign-in path will fail. Enable Bitbucket or remove its controls and related user-facing text.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/tanstack-start/src/lib/auth.ts` at line 12, Update the provider
configuration near oauth to match the demo controls: either add bitbucket to the
enabled provider list so signIn("bitbucket") succeeds, or remove the Bitbucket
controls and related user-facing text from the client and server routes. Keep
the configuration and available sign-in options consistent.

basePath: "/api/auth",
trustedProxyHeaders: true,
credentials: {
authorize: (ctx) => {
const { username, password } = ctx.credentials
Expand All @@ -21,3 +17,4 @@ export const { handlers, jose, api } = createAuth({
},
},
})
export const { handlers, api, core, __unstable_fn } = auth
170 changes: 86 additions & 84 deletions apps/tanstack-start/src/routeTree.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,113 +8,115 @@
// You should NOT make any changes in this file as it will be overwritten.
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.

import { Route as rootRouteImport } from "./routes/__root"
import { Route as ServerRouteImport } from "./routes/server"
import { Route as ClientRouteImport } from "./routes/client"
import { Route as IndexRouteImport } from "./routes/index"
import { Route as ApiAuthSplatRouteImport } from "./routes/api/auth.$"
import { Route as rootRouteImport } from './routes/__root'
import { Route as IndexRouteImport } from './routes/index'
import { Route as ClientRouteImport } from './routes/client'
import { Route as ServerRouteImport } from './routes/server'
import { Route as ApiAuthSplatRouteImport } from './routes/api/auth.$'

const ServerRoute = ServerRouteImport.update({
id: "/server",
path: "/server",
getParentRoute: () => rootRouteImport,
const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => rootRouteImport,
} as any)
const ClientRoute = ClientRouteImport.update({
id: "/client",
path: "/client",
getParentRoute: () => rootRouteImport,
id: '/client',
path: '/client',
getParentRoute: () => rootRouteImport,
} as any)
const IndexRoute = IndexRouteImport.update({
id: "/",
path: "/",
getParentRoute: () => rootRouteImport,
const ServerRoute = ServerRouteImport.update({
id: '/server',
path: '/server',
getParentRoute: () => rootRouteImport,
} as any)
const ApiAuthSplatRoute = ApiAuthSplatRouteImport.update({
id: "/api/auth/$",
path: "/api/auth/$",
getParentRoute: () => rootRouteImport,
id: '/api/auth/$',
path: '/api/auth/$',
getParentRoute: () => rootRouteImport,
} as any)

export interface FileRoutesByFullPath {
"/": typeof IndexRoute
"/client": typeof ClientRoute
"/server": typeof ServerRoute
"/api/auth/$": typeof ApiAuthSplatRoute
'/': typeof IndexRoute
'/client': typeof ClientRoute
'/server': typeof ServerRoute
'/api/auth/$': typeof ApiAuthSplatRoute
}
export interface FileRoutesByTo {
"/": typeof IndexRoute
"/client": typeof ClientRoute
"/server": typeof ServerRoute
"/api/auth/$": typeof ApiAuthSplatRoute
'/': typeof IndexRoute
'/client': typeof ClientRoute
'/server': typeof ServerRoute
'/api/auth/$': typeof ApiAuthSplatRoute
}
export interface FileRoutesById {
__root__: typeof rootRouteImport
"/": typeof IndexRoute
"/client": typeof ClientRoute
"/server": typeof ServerRoute
"/api/auth/$": typeof ApiAuthSplatRoute
__root__: typeof rootRouteImport
'/': typeof IndexRoute
'/client': typeof ClientRoute
'/server': typeof ServerRoute
'/api/auth/$': typeof ApiAuthSplatRoute
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
fullPaths: "/" | "/client" | "/server" | "/api/auth/$"
fileRoutesByTo: FileRoutesByTo
to: "/" | "/client" | "/server" | "/api/auth/$"
id: "__root__" | "/" | "/client" | "/server" | "/api/auth/$"
fileRoutesById: FileRoutesById
fileRoutesByFullPath: FileRoutesByFullPath
fullPaths: '/' | '/client' | '/server' | '/api/auth/$'
fileRoutesByTo: FileRoutesByTo
to: '/' | '/client' | '/server' | '/api/auth/$'
id: '__root__' | '/' | '/client' | '/server' | '/api/auth/$'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
IndexRoute: typeof IndexRoute
ClientRoute: typeof ClientRoute
ServerRoute: typeof ServerRoute
ApiAuthSplatRoute: typeof ApiAuthSplatRoute
IndexRoute: typeof IndexRoute
ClientRoute: typeof ClientRoute
ServerRoute: typeof ServerRoute
ApiAuthSplatRoute: typeof ApiAuthSplatRoute
}

declare module "@tanstack/react-router" {
interface FileRoutesByPath {
"/server": {
id: "/server"
path: "/server"
fullPath: "/server"
preLoaderRoute: typeof ServerRouteImport
parentRoute: typeof rootRouteImport
}
"/client": {
id: "/client"
path: "/client"
fullPath: "/client"
preLoaderRoute: typeof ClientRouteImport
parentRoute: typeof rootRouteImport
}
"/": {
id: "/"
path: "/"
fullPath: "/"
preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
"/api/auth/$": {
id: "/api/auth/$"
path: "/api/auth/$"
fullPath: "/api/auth/$"
preLoaderRoute: typeof ApiAuthSplatRouteImport
parentRoute: typeof rootRouteImport
}
declare module '@tanstack/react-router' {
interface FileRoutesByPath {
'/': {
id: '/'
path: '/'
fullPath: '/'
preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
'/client': {
id: '/client'
path: '/client'
fullPath: '/client'
preLoaderRoute: typeof ClientRouteImport
parentRoute: typeof rootRouteImport
}
'/server': {
id: '/server'
path: '/server'
fullPath: '/server'
preLoaderRoute: typeof ServerRouteImport
parentRoute: typeof rootRouteImport
}
'/api/auth/$': {
id: '/api/auth/$'
path: '/api/auth/$'
fullPath: '/api/auth/$'
preLoaderRoute: typeof ApiAuthSplatRouteImport
parentRoute: typeof rootRouteImport
}
}
}

const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
ClientRoute: ClientRoute,
ServerRoute: ServerRoute,
ApiAuthSplatRoute: ApiAuthSplatRoute,
IndexRoute: IndexRoute,
ClientRoute: ClientRoute,
ServerRoute: ServerRoute,
ApiAuthSplatRoute: ApiAuthSplatRoute,
}
export const routeTree = rootRouteImport._addFileChildren(rootRouteChildren)._addFileTypes<FileRouteTypes>()
export const routeTree = rootRouteImport
._addFileChildren(rootRouteChildren)
._addFileTypes<FileRouteTypes>()

import type { getRouter } from "./router.tsx"
import type { createStart } from "@tanstack/react-start"
declare module "@tanstack/react-start" {
interface Register {
ssr: true
router: Awaited<ReturnType<typeof getRouter>>
}
import type { getRouter } from './router.tsx'
import type { createStart } from '@tanstack/react-start'
declare module '@tanstack/react-start' {
interface Register {
ssr: true
router: Awaited<ReturnType<typeof getRouter>>
}
}
Loading
Loading