Skip to content

Commit

Permalink
wrapped app in clerk provider
Browse files Browse the repository at this point in the history
  • Loading branch information
dabarcenas6921 committed Oct 4, 2023
1 parent 4220530 commit 2f31587
Show file tree
Hide file tree
Showing 8 changed files with 1,035 additions and 16 deletions.
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@
# Prisma
# https://www.prisma.io/docs/reference/database-reference/connection-urls#env
DATABASE_URL="file:./db.sqlite"

#Clerk
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="put clerk secret here"
CLERK_SECRET_KEY="put clerk secret here"
1,010 changes: 1,006 additions & 4 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"start": "next start"
},
"dependencies": {
"@clerk/nextjs": "^4.25.1",
"@prisma/client": "^5.1.1",
"@t3-oss/env-nextjs": "^0.6.0",
"@tanstack/react-query": "^4.32.6",
Expand Down
16 changes: 8 additions & 8 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ datasource db {
provider = "sqlite"
url = env("DATABASE_URL")
}
//Example for reference:
// model Example {
// id Int @id @default(autoincrement())
// name String
// createdAt DateTime @default(now())
// updatedAt DateTime @updatedAt

model Example {
id Int @id @default(autoincrement())
name String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([name])
}
// @@index([name])
// }
Binary file removed public/favicon.ico
Binary file not shown.
10 changes: 10 additions & 0 deletions src/middleware.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
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)(.*)"],
};
9 changes: 6 additions & 3 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { type AppType } from "next/app";

import { api } from "~/utils/api";

import "~/styles/globals.css";
import { ClerkProvider } from "@clerk/nextjs";

const MyApp: AppType = ({ Component, pageProps }) => {
return <Component {...pageProps} />;
return (
<ClerkProvider>
<Component {...pageProps} />
</ClerkProvider>
);
};

export default api.withTRPC(MyApp);
1 change: 0 additions & 1 deletion src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export default function Home() {
<Head>
<title>Init Dashboard</title>
<meta name="description" content="Website for Init" />
<link rel="icon" href="/favicon.ico" />
</Head>
<main className="bg-primary flex min-h-screen flex-col items-center justify-center"></main>
</>
Expand Down

0 comments on commit 2f31587

Please sign in to comment.