Skip to content
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
1 change: 0 additions & 1 deletion apps/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"@astrojs/check": "^0.9.8",
"@astrojs/node": "^10.0.2",
"@astrojs/react": "^5.0.0",
"@aura-stack/auth": "workspace:*",
"@aura-stack/react": "workspace:*",
"@radix-ui/react-slot": "^1.2.4",
"astro": "^6.0.5",
Expand Down
6 changes: 0 additions & 6 deletions apps/astro/src/@types/props.ts

This file was deleted.

10 changes: 0 additions & 10 deletions apps/astro/src/@types/types.ts

This file was deleted.

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

export const AuthProvider = ({ children, initialSession }: Omit<AuthProviderProps, "client">) => {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createAuthClient } from "@aura-stack/auth/client"
import { createAuthClient } from "@aura-stack/react"

export const authClient = createAuthClient({
basePath: "/api/auth",
Expand Down
4 changes: 2 additions & 2 deletions apps/astro/src/auth.ts → apps/astro/src/lib/auth.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createAuth } from "@aura-stack/auth"
import { builtInOAuthProviders, type BuiltInOAuthProvider } from "@aura-stack/auth/oauth/index"
import { createAuth } from "@aura-stack/react/server"
import { builtInOAuthProviders, type BuiltInOAuthProvider } from "@aura-stack/react/oauth"

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

Expand Down
5 changes: 3 additions & 2 deletions apps/astro/src/lib/server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { api } from "@/auth"
import type { Session, SignOutAPIOptions, GetSessionAPIOptions } from "@aura-stack/auth"
import { api } from "@/lib/auth"
import type { Session } from "@aura-stack/react"
import type { SignOutAPIOptions, GetSessionAPIOptions } from "@aura-stack/react/types"

export const getSession = async (request: Request, options?: GetSessionAPIOptions): Promise<Session | null> => {
try {
Expand Down
2 changes: 1 addition & 1 deletion apps/astro/src/pages/api/auth/[...all].ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { handlers } from "@/auth"
import { handlers } from "@/lib/auth"
import type { APIRoute } from "astro"

export const GET: APIRoute = async ({ request }) => {
Expand Down
2 changes: 1 addition & 1 deletion apps/elysia/src/lib/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ export const auth = createAuth({
basePath: "/api/auth",
})

export const { api, jose, toHandler, withAuth } = auth
export const { api, jose, handlers, toHandler, withAuth } = auth
6 changes: 0 additions & 6 deletions apps/elysia/src/lib/handler.ts

This file was deleted.

1 change: 0 additions & 1 deletion apps/express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"format:check": "oxfmt --check"
},
"dependencies": {
"@aura-stack/auth": "workspace:*",
"@aura-stack/express": "workspace:*",
"express": "catalog:express"
},
Expand Down
3 changes: 2 additions & 1 deletion apps/express/src/lib/auth.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createAuth, builtInOAuthProviders, type BuiltInOAuthProvider } from "@aura-stack/express"
import { createAuth } from "@aura-stack/express"
import { builtInOAuthProviders, type BuiltInOAuthProvider } from "@aura-stack/express/oauth"

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

Expand Down
2 changes: 2 additions & 0 deletions apps/express/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"extends": "@aura-stack/tsconfig/tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist",
"paths": {
"@/*": ["./src/*"]
}
Expand Down
3 changes: 1 addition & 2 deletions apps/nextjs/app-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
"format:check": "oxfmt --check"
},
"dependencies": {
"@aura-stack/auth": "workspace:*",
"@aura-stack/react": "workspace:*",
"@aura-stack/next": "workspace:*",
"@radix-ui/react-slot": "^1.2.4",
"lucide-react": "catalog:lucide-react",
"next": "catalog:next",
Expand Down
7 changes: 1 addition & 6 deletions apps/nextjs/app-router/src/@types/props.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import type { ComponentProps, PropsWithChildren } from "react"
import type { Session } from "@aura-stack/auth/types"

export interface AuthProviderProps extends PropsWithChildren {
session?: Session | null
}
import type { ComponentProps } from "react"

export interface ButtonProps extends ComponentProps<"button"> {
variant?: "default" | "outline"
Expand Down
10 changes: 0 additions & 10 deletions apps/nextjs/app-router/src/@types/types.ts

This file was deleted.

4 changes: 2 additions & 2 deletions apps/nextjs/app-router/src/app/api/auth/[...aura]/route.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { handlers } from "@/lib/auth"
import { core } from "@/lib/auth"

export const { GET, POST, PATCH } = handlers
export const { GET, POST, PATCH } = core.handlers
6 changes: 3 additions & 3 deletions apps/nextjs/app-router/src/components/auth-client.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use client"

import { LayoutDashboard } from "lucide-react"
import { Button } from "./ui/button"
import { useAuth } from "@aura-stack/react/hooks"
import { Button } from "@/components/ui/button"
import { useAuth } from "@aura-stack/next/client"

export const AuthClient = () => {
const { session, status, isPending, signIn, signOut } = useAuth()
Expand All @@ -14,7 +14,7 @@ export const AuthClient = () => {
<span className="px-2 text-xs font-mono italic absolute -top-2 left-3 bg-green-600">Client Component</span>
{isAuthenticated ? (
<div className="space-y-6 animate-in fade-in slide-in-from-bottom-4 duration-500">
<div className="py-3 px-2 border border-muted rounded-md space-y-3">
<div className="py-3 px-2 border border-muted space-y-3">
<div className="flex items-center justify-between">
<span className="text-xs font-mono italic">client session active</span>
<LayoutDashboard className="size-4 text-foreground" />
Expand Down
12 changes: 6 additions & 6 deletions apps/nextjs/app-router/src/components/auth-server.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { api } from "@/lib/auth"
import { LayoutDashboard } from "lucide-react"
import { Button } from "./ui/button"
import { getSession, signIn, signOut } from "@/lib/server"
import { Button } from "@/components/ui/button"

export const AuthServer = async () => {
const session = await getSession()
const session = await api.getSession()
const isAuthenticated = Boolean(session && session?.user)

const signInAction = async (oauth: string) => {
"use server"
await signIn(oauth)
await api.signIn(oauth)
}

const signOutAction = async () => {
"use server"
await signOut()
await api.signOut()
}

return (
Expand All @@ -23,7 +23,7 @@ export const AuthServer = async () => {
{isAuthenticated ? (
<>
<div className="space-y-6 animate-in fade-in slide-in-from-bottom-4 duration-500">
<div className="py-3 px-2 border border-muted rounded-md space-y-3">
<div className="py-3 px-2 border border-muted space-y-3">
<div className="flex items-center justify-between">
<span className="text-xs font-mono italic">server session active</span>
<LayoutDashboard className="size-4 text-foreground" />
Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs/app-router/src/components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Link from "next/link"
import { useState } from "react"
import { Menu, X } from "lucide-react"
import { Button } from "@/components/ui/button"
import { useAuth } from "@aura-stack/react"
import { useAuth } from "@aura-stack/next/client"

export const Header = () => {
const [mobileMenuOpen, setMobileMenuOpen] = useState(false)
Expand Down
6 changes: 3 additions & 3 deletions apps/nextjs/app-router/src/components/ui/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Slot } from "@radix-ui/react-slot"
export const Button = ({ className, variant = "default", size = "default", asChild, ...props }: ButtonProps) => {
const Component = asChild ? Slot : "button"
const defaultClasses =
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive"
"inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive"

const variants = {
variant: {
Expand All @@ -15,8 +15,8 @@ export const Button = ({ className, variant = "default", size = "default", asChi
},
size: {
default: "h-9 px-4 py-2 has-[>svg]:px-3",
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
sm: "h-8 gap-1.5 px-3 has-[>svg]:px-2.5",
lg: "h-10 px-6 has-[>svg]:px-4",
icon: "size-9",
"icon-sm": "size-8",
"icon-lg": "size-10",
Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs/app-router/src/contexts/auth.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use client"
import { AuthProvider as AuraAuthProvider, type AuthProviderProps } from "@aura-stack/react"
import { AuthProvider as AuraAuthProvider, type AuthProviderProps } from "@aura-stack/next/client"
import { authClient } from "@/lib/auth-client"

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

export const authClient = createAuthClient({
basePath: "/api/auth",
Expand Down
6 changes: 3 additions & 3 deletions apps/nextjs/app-router/src/lib/auth.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { createAuth } from "@aura-stack/auth"
import { builtInOAuthProviders, type BuiltInOAuthProvider } from "@aura-stack/auth/oauth/index"
import { createAuth } from "@aura-stack/next"
import { builtInOAuthProviders, type BuiltInOAuthProvider } from "@aura-stack/next/oauth"

export const oauth = Object.keys(builtInOAuthProviders) as BuiltInOAuthProvider[]
export const providers = [builtInOAuthProviders.github(), builtInOAuthProviders.gitlab(), builtInOAuthProviders.bitbucket()]

export const { handlers, jose, api } = createAuth({
export const { api, core } = createAuth({
oauth,
basePath: "/api/auth",
baseURL: "http://localhost:3000",
Expand Down
66 changes: 0 additions & 66 deletions apps/nextjs/app-router/src/lib/server.ts

This file was deleted.

1 change: 0 additions & 1 deletion apps/nextjs/pages-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"format:check": "oxfmt --check"
},
"dependencies": {
"@aura-stack/auth": "workspace:*",
"@aura-stack/react": "workspace:*",
"@radix-ui/react-slot": "^1.2.4",
"lucide-react": "catalog:lucide-react",
Expand Down
7 changes: 1 addition & 6 deletions apps/nextjs/pages-router/src/@types/props.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import type { Session } from "@aura-stack/auth"
import type { ComponentProps, PropsWithChildren } from "react"
import type { ComponentProps } from "react"

export interface ButtonProps extends ComponentProps<"button"> {
variant?: "default" | "outline"
size?: "default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg"
asChild?: boolean
}

export interface AuthProviderProps extends PropsWithChildren {
session?: Session | null
}
10 changes: 0 additions & 10 deletions apps/nextjs/pages-router/src/@types/types.ts

This file was deleted.

2 changes: 1 addition & 1 deletion apps/nextjs/pages-router/src/components/auth-client.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LayoutDashboard } from "lucide-react"
import { Button } from "./ui/button"
import { Button } from "@/components/ui/button"
import { useAuth } from "@aura-stack/react"

export const AuthClient = () => {
Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs/pages-router/src/contexts/auth.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AuthProvider as AuraAuthProvider, type AuthProviderProps } from "@aura-stack/react"
import { authClient } from "@/lib/client"
import { authClient } from "@/lib/auth-client"

export const AuthProvider = ({ children, initialSession }: Omit<AuthProviderProps, "client">) => {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createAuthClient } from "@aura-stack/auth"
import { createAuthClient } from "@aura-stack/react"

export const authClient = createAuthClient({
baseURL: "http://localhost:3000",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { type AuthInstance, createAuth } from "@aura-stack/auth"
import { builtInOAuthProviders, type BuiltInOAuthProvider } from "@aura-stack/auth/oauth/index"
import { createAuth } from "@aura-stack/react/server"
import { builtInOAuthProviders, type BuiltInOAuthProvider } from "@aura-stack/react/oauth"

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

export const { handlers, jose, api }: AuthInstance = createAuth({
export const { api, handlers } = createAuth({
oauth,
basePath: "/api/auth",
})
2 changes: 1 addition & 1 deletion apps/nextjs/pages-router/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "@/styles/globals.css"

export default function App({ Component, pageProps }: AppProps) {
return (
<AuthProvider initialSession={pageProps?.session ?? null}>
<AuthProvider>
<Layout>
<Component {...pageProps} />
</Layout>
Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs/pages-router/src/pages/api/auth/[...aura].ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { handlers } from "@/auth"
import { handlers } from "@/lib/auth"
import type { NextApiRequest, NextApiResponse } from "next"

const getBaseURL = (request: NextApiRequest) => {
Expand Down
Loading
Loading