Skip to content

Commit

Permalink
Add clerk auth
Browse files Browse the repository at this point in the history
  • Loading branch information
gramliu committed Dec 3, 2023
1 parent faab667 commit a2f5915
Show file tree
Hide file tree
Showing 4 changed files with 344 additions and 24 deletions.
27 changes: 15 additions & 12 deletions apps/web/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import "@ui/styles/globals.css";
import { Inter, JetBrains_Mono } from "next/font/google";
import { cn } from "@ui/lib/utils";
import { ClerkProvider } from "@clerk/nextjs";

export const inter = Inter({
subsets: ["latin"],
Expand All @@ -10,7 +11,7 @@ export const inter = Inter({
export const jetbrainsMono = JetBrains_Mono({
subsets: ["latin"],
variable: "--font-mono",
})
});

export const metadata = {
title: "Web Spinner",
Expand All @@ -23,16 +24,18 @@ export default function RootLayout({
children: React.ReactNode;
}) {
return (
<html lang="en">
<body
className={cn(
"min-h-screen bg-background font-sans antialiased",
inter.variable,
jetbrainsMono.variable
)}
>
{children}
</body>
</html>
<ClerkProvider>
<html lang="en">
<body
className={cn(
"min-h-screen bg-background font-sans antialiased",
inter.variable,
jetbrainsMono.variable
)}
>
{children}
</body>
</html>
</ClerkProvider>
);
}
11 changes: 11 additions & 0 deletions apps/web/middleware.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { authMiddleware } from "@clerk/nextjs";

// This example protects all routes including api/trpc routes
// Please edit this to allow other routes to be public as needed.
// See https://clerk.com/docs/references/nextjs/auth-middleware for more information about configuring your Middleware
export default authMiddleware({});

export const config = {
matcher: ['/((?!.+\\.[\\w]+$|_next).*)', '/', '/(api|trpc)(.*)'],
};

1 change: 1 addition & 0 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"@clerk/nextjs": "^4.27.2",
"@t3-oss/env-nextjs": "^0.7.1",
"@tldraw/tldraw": "2.0.0-canary.699502d8c479",
"axios": "^1.5.1",
Expand Down
Loading

0 comments on commit a2f5915

Please sign in to comment.