Skip to content

Commit f0cba67

Browse files
committed
clerk setup
1 parent 94a08e7 commit f0cba67

File tree

11 files changed

+81
-13
lines changed

11 files changed

+81
-13
lines changed

apps/dashboard/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.1.0",
44
"private": true,
55
"scripts": {
6-
"build": "npmr run with-env next build",
6+
"build": "npm run with-env next build",
77
"clean": "git clean -xdf .next .turbo node_modules",
88
"dev": "npm run with-env next dev",
99
"lint": "dotenv -v SKIP_ENV_VALIDATION=1 next lint",

apps/dashboard/src/app/layout.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import '../global.css';
2+
import { ClerkProvider } from "@clerk/nextjs";
23

34
export default function RootLayout({
45
children,
56
}: {
67
children: React.ReactNode;
78
}) {
89
return (
9-
<html lang="en">
10-
<body>{children}</body>
11-
</html>
10+
<ClerkProvider>
11+
<html lang="en">
12+
<body>{children}</body>
13+
</html>
14+
</ClerkProvider>
1215
);
1316
}

apps/dashboard/src/app/page.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1+
import { UserButton } from "@clerk/nextjs";
2+
3+
14
export default function Page() {
25
return (
36
<>
47
<div className="bg-red-500">Hello</div>
8+
<div>
9+
<h1>Page</h1>
10+
<p>Page content</p>
11+
<UserButton afterSignOutUrl="/" />
12+
</div>
513
</>
614
);
715
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { SignIn } from "@clerk/nextjs";
2+
3+
export default function Page() {
4+
return <SignIn />;
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { SignUp } from "@clerk/nextjs";
2+
3+
export default function Page() {
4+
return <SignUp />;
5+
}

apps/dashboard/src/env.mjs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,30 @@ export const env = createEnv({
66
* Specify your server-side environment variables schema here. This way you can ensure the app isn't
77
* built with invalid env vars.
88
*/
9-
server: {
9+
server: {
10+
CLERK_SECRET_KEY: z.string().nonempty(),
1011
},
1112
/**
1213
* Specify your client-side environment variables schema here.
1314
* For them to be exposed to the client, prefix them with `NEXT_PUBLIC_`.
1415
*/
1516
client: {
17+
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: z.string().nonempty(),
18+
NEXT_PUBLIC_CLERK_SIGN_IN_URL: z.string().nonempty(),
19+
NEXT_PUBLIC_CLERK_SIGN_UP_URL: z.string().nonempty(),
20+
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL: z.string().nonempty(),
21+
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL: z.string().nonempty(),
1622
},
1723
/**
1824
* Destructure all variables from `process.env` to make sure they aren't tree-shaken away.
1925
*/
2026
runtimeEnv: {
27+
CLERK_SECRET_KEY: process.env.CLERK_SECRET_KEY,
28+
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY,
29+
NEXT_PUBLIC_CLERK_SIGN_IN_URL: process.env.NEXT_PUBLIC_CLERK_SIGN_IN_URL,
30+
NEXT_PUBLIC_CLERK_SIGN_UP_URL: process.env.NEXT_PUBLIC_CLERK_SIGN_UP_URL,
31+
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL: process.env.NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL,
32+
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL: process.env.NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL,
2133
},
2234
skipValidation: !!process.env.CI || !!process.env.SKIP_ENV_VALIDATION,
2335
});

apps/dashboard/src/middleware.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { authMiddleware } from "@clerk/nextjs";
2+
3+
export default authMiddleware();
4+
5+
export const config = {
6+
matcher: ["/((?!.*\\..*|_next).*)", "/", "/(api|trpc)(.*)"],
7+
};

apps/dashboard/tsconfig.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
"exclude": [],
1111
"include": [
1212
"next-env.d.ts",
13-
"**/*.ts",
14-
"**/*.tsx",
15-
"**/*.cjs",
16-
"**/*.mjs",
13+
"src/**/*.ts",
14+
"src/**/*.ts",
15+
"src/**/*.tsx",
16+
"src/**/*.cjs",
17+
"src/**/*.mjs",
1718
".next/types/**/*.ts"
18-
]
19+
]
1920
}

apps/test-stack/package.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "@acme/test-stack",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"keywords": [],
10+
"author": "",
11+
"license": "ISC"
12+
}

package-lock.json

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)