From 159947e69b4279a461ab5cbdcab1117a6189cb57 Mon Sep 17 00:00:00 2001 From: Abhishek Hegde Date: Thu, 23 Nov 2023 23:45:35 +0530 Subject: [PATCH] created clerk authentication. with clerk provider. added notes page , sign in and sign up. public route in clerk configuration. --- src/app/layout.tsx | 27 ++++++++++++++----------- src/app/notes/page.tsx | 9 +++++++++ src/app/sign-in/[[...sign-in]]/page.tsx | 14 +++++++++++++ src/app/sign-up/[[...sign-up]]/page.tsx | 14 +++++++++++++ src/middleware.ts | 12 +++++++++++ 5 files changed, 64 insertions(+), 12 deletions(-) create mode 100644 src/app/notes/page.tsx create mode 100644 src/app/sign-in/[[...sign-in]]/page.tsx create mode 100644 src/app/sign-up/[[...sign-up]]/page.tsx create mode 100644 src/middleware.ts diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 40e027f..5c017bb 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,22 +1,25 @@ -import type { Metadata } from 'next' -import { Inter } from 'next/font/google' -import './globals.css' +import type { Metadata } from "next"; +import { Inter } from "next/font/google"; +import "./globals.css"; +import { ClerkProvider } from "@clerk/nextjs"; -const inter = Inter({ subsets: ['latin'] }) +const inter = Inter({ subsets: ["latin"] }); export const metadata: Metadata = { - title: 'Create Next App', - description: 'Generated by create next app', -} + title: "Ai-Note-Taking-App", + description: "Intelligent note taking app", +}; export default function RootLayout({ children, }: { - children: React.ReactNode + children: React.ReactNode; }) { return ( - - {children} - - ) + + + {children} + + + ); } diff --git a/src/app/notes/page.tsx b/src/app/notes/page.tsx new file mode 100644 index 0000000..a7b6a5b --- /dev/null +++ b/src/app/notes/page.tsx @@ -0,0 +1,9 @@ +import { Metadata } from "next"; + +export const metadata: Metadata = { + title: "Ai - Notes", +}; + +export default function NotesPage() { + return
Here will be your notes
; +} diff --git a/src/app/sign-in/[[...sign-in]]/page.tsx b/src/app/sign-in/[[...sign-in]]/page.tsx new file mode 100644 index 0000000..c62b9f9 --- /dev/null +++ b/src/app/sign-in/[[...sign-in]]/page.tsx @@ -0,0 +1,14 @@ +import { SignIn } from "@clerk/nextjs"; +import { Metadata } from "next"; + +export const metadata: Metadata = { + title: "AI-noteTaker - Sign In", +}; + +export default function SignInPage() { + return ( +
+ +
+ ); +} diff --git a/src/app/sign-up/[[...sign-up]]/page.tsx b/src/app/sign-up/[[...sign-up]]/page.tsx new file mode 100644 index 0000000..b1209c6 --- /dev/null +++ b/src/app/sign-up/[[...sign-up]]/page.tsx @@ -0,0 +1,14 @@ +import { SignUp } from "@clerk/nextjs"; +import { Metadata } from "next"; + +export const metadata: Metadata = { + title: "AI-noteTaker - Sign Up", +}; + +export default function SignUpPage() { + return ( +
+ +
+ ); +} diff --git a/src/middleware.ts b/src/middleware.ts new file mode 100644 index 0000000..d40b232 --- /dev/null +++ b/src/middleware.ts @@ -0,0 +1,12 @@ +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({ + publicRoutes: ["/"], +}); + +export const config = { + matcher: ["/((?!.+\\.[\\w]+$|_next).*)", "/", "/(api|trpc)(.*)"], +};