abdellah0l-stack 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -31,17 +31,19 @@ abdellah0l-stack my-app
|
|
|
31
31
|
```bash
|
|
32
32
|
cd my-app
|
|
33
33
|
npm install
|
|
34
|
+
npm install babel-plugin-react-compiler --save-dev
|
|
34
35
|
|
|
35
36
|
# Set up your .env file with:
|
|
36
37
|
# - DATABASE_URL
|
|
38
|
+
# - BETTER_AUTH_URL
|
|
37
39
|
# - BETTER_AUTH_SECRET
|
|
38
40
|
# - GITHUB_CLIENT_ID & GITHUB_CLIENT_SECRET
|
|
39
41
|
# - GOOGLE_CLIENT_ID & GOOGLE_CLIENT_SECRET
|
|
40
|
-
# - ARCJET_KEY
|
|
42
|
+
# - ARCJET_KEY (if using rate limiting)
|
|
41
43
|
# - AI_GATEWAY_API_KEY (if using AI)
|
|
42
44
|
# - UPLOADTHING_TOKEN (if using uploads)
|
|
43
45
|
|
|
44
|
-
npm run
|
|
46
|
+
npm run build
|
|
45
47
|
npm run dev
|
|
46
48
|
```
|
|
47
49
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Database (Neon PostgreSQL)
|
|
2
|
+
DATABASE_URL=
|
|
3
|
+
|
|
4
|
+
# Better Auth
|
|
5
|
+
BETTER_AUTH_SECRET=
|
|
6
|
+
BETTER_AUTH_URL=http://localhost:3000
|
|
7
|
+
|
|
8
|
+
# GitHub OAuth
|
|
9
|
+
GITHUB_CLIENT_ID=
|
|
10
|
+
GITHUB_CLIENT_SECRET=
|
|
11
|
+
|
|
12
|
+
# Google OAuth
|
|
13
|
+
GOOGLE_CLIENT_ID=
|
|
14
|
+
GOOGLE_CLIENT_SECRET=
|
|
15
|
+
|
|
16
|
+
# Arcjet (Rate Limiting)
|
|
17
|
+
ARCJET_KEY=
|
|
18
|
+
|
|
19
|
+
# AI Configuration
|
|
20
|
+
AI_GATEWAY_API_KEY=
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# UploadThing (File Uploads)
|
|
24
|
+
UPLOADTHING_TOKEN=
|
package/template/package.json
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"db:migrate": "drizzle-kit migrate",
|
|
12
12
|
"db:studio": "drizzle-kit studio",
|
|
13
13
|
"db:push": "drizzle-kit push",
|
|
14
|
+
"auth:generate": "npx @better-auth/cli@latest generate --config ./src/lib/auth.ts --output ./src/drizzle/schema/new-auth-schema.ts --yes",
|
|
14
15
|
"lint": "eslint"
|
|
15
16
|
},
|
|
16
17
|
"dependencies": {
|
|
@@ -59,4 +60,4 @@
|
|
|
59
60
|
"tsx": "^4.20.6",
|
|
60
61
|
"typescript": "^5"
|
|
61
62
|
}
|
|
62
|
-
}
|
|
63
|
+
}
|
|
@@ -2,10 +2,10 @@ import Link from "next/link";
|
|
|
2
2
|
|
|
3
3
|
export default function Home() {
|
|
4
4
|
return (
|
|
5
|
-
<main className="min-h-screen bg-
|
|
5
|
+
<main className="min-h-screen bg-linear-to-b from-zinc-900 to-black text-white">
|
|
6
6
|
<div className="container mx-auto px-4 py-20">
|
|
7
7
|
<div className="text-center space-y-8">
|
|
8
|
-
<h1 className="text-5xl font-bold bg-
|
|
8
|
+
<h1 className="text-5xl font-bold bg-linear-to-r from-blue-400 to-purple-500 bg-clip-text text-transparent">
|
|
9
9
|
Welcome to Abdellah0l-Stack
|
|
10
10
|
</h1>
|
|
11
11
|
<p className="text-xl text-zinc-400 max-w-2xl mx-auto">
|
|
@@ -37,7 +37,7 @@ export const postsRouter = router({
|
|
|
37
37
|
.values({
|
|
38
38
|
title: input.title,
|
|
39
39
|
content: input.content,
|
|
40
|
-
userId: ctx.user.id,
|
|
40
|
+
userId: ctx.session.user.id,
|
|
41
41
|
})
|
|
42
42
|
.returning();
|
|
43
43
|
return post;
|
|
@@ -58,7 +58,7 @@ export const postsRouter = router({
|
|
|
58
58
|
.from(posts)
|
|
59
59
|
.where(eq(posts.id, input.id));
|
|
60
60
|
|
|
61
|
-
if (!existing || existing.userId !== ctx.user.id) {
|
|
61
|
+
if (!existing || existing.userId !== ctx.session.user.id) {
|
|
62
62
|
throw new Error("Not authorized");
|
|
63
63
|
}
|
|
64
64
|
|
|
@@ -83,7 +83,7 @@ export const postsRouter = router({
|
|
|
83
83
|
.from(posts)
|
|
84
84
|
.where(eq(posts.id, input.id));
|
|
85
85
|
|
|
86
|
-
if (!existing || existing.userId !== ctx.user.id) {
|
|
86
|
+
if (!existing || existing.userId !== ctx.session.user.id) {
|
|
87
87
|
throw new Error("Not authorized");
|
|
88
88
|
}
|
|
89
89
|
|
|
@@ -14,7 +14,7 @@ export const usersRouter = router({
|
|
|
14
14
|
const [profile] = await db
|
|
15
15
|
.select()
|
|
16
16
|
.from(user)
|
|
17
|
-
.where(eq(user.id, ctx.user.id));
|
|
17
|
+
.where(eq(user.id, ctx.session.user.id));
|
|
18
18
|
return profile ?? null;
|
|
19
19
|
}),
|
|
20
20
|
|
|
@@ -49,7 +49,7 @@ export const usersRouter = router({
|
|
|
49
49
|
...(input.name && { name: input.name }),
|
|
50
50
|
...(input.image && { image: input.image }),
|
|
51
51
|
})
|
|
52
|
-
.where(eq(user.id, ctx.user.id))
|
|
52
|
+
.where(eq(user.id, ctx.session.user.id))
|
|
53
53
|
.returning();
|
|
54
54
|
return updated;
|
|
55
55
|
}),
|