Skip to content

Commit e95b92b

Browse files
authored
Merge pull request #6 from 100XEnginners/v1/t3chat
feat: cloudflare turnstile, preference customization route
2 parents ea03d9b + b4eb84c commit e95b92b

78 files changed

Lines changed: 5192 additions & 848 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bun.lock

Lines changed: 109 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

eslint.config.js

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
1-
import { FlatCompat } from "@eslint/eslintrc";
2-
import tseslint from "typescript-eslint";
1+
// import { FlatCompat } from "@eslint/eslintrc";
2+
// import tseslint from "typescript-eslint";
33

4-
const compat = new FlatCompat({
5-
baseDirectory: import.meta.dirname,
6-
});
4+
// const compat = new FlatCompat({
5+
// baseDirectory: import.meta.dirname,
6+
// });
77

8-
export default tseslint.config(
9-
{
10-
ignores: [".next"],
11-
},
12-
...compat.extends("next/core-web-vitals"),
13-
{
14-
files: ["**/*.ts", "**/*.tsx"],
15-
extends: [
16-
...tseslint.configs.recommended,
17-
...tseslint.configs.recommendedTypeChecked,
18-
...tseslint.configs.stylisticTypeChecked,
19-
],
20-
rules: {
21-
"@typescript-eslint/array-type": "off",
22-
"@typescript-eslint/consistent-type-definitions": "off",
23-
"@typescript-eslint/consistent-type-imports": [
24-
"warn",
25-
{ prefer: "type-imports", fixStyle: "inline-type-imports" },
26-
],
27-
"@typescript-eslint/no-unused-vars": [
28-
"warn",
29-
{ argsIgnorePattern: "^_" },
30-
],
31-
"@typescript-eslint/require-await": "off",
32-
"@typescript-eslint/no-misused-promises": [
33-
"error",
34-
{ checksVoidReturn: { attributes: false } },
35-
],
36-
},
37-
},
38-
{
39-
linterOptions: {
40-
reportUnusedDisableDirectives: true,
41-
},
42-
languageOptions: {
43-
parserOptions: {
44-
projectService: true,
45-
},
46-
},
47-
},
48-
);
8+
// export default tseslint.config(
9+
// {
10+
// ignores: [".next"],
11+
// },
12+
// ...compat.extends("next/core-web-vitals"),
13+
// {
14+
// files: ["**/*.ts", "**/*.tsx"],
15+
// extends: [
16+
// ...tseslint.configs.recommended,
17+
// ...tseslint.configs.recommendedTypeChecked,
18+
// ...tseslint.configs.stylisticTypeChecked,
19+
// ],
20+
// rules: {
21+
// "@typescript-eslint/array-type": "off",
22+
// "@typescript-eslint/consistent-type-definitions": "off",
23+
// "@typescript-eslint/consistent-type-imports": [
24+
// "warn",
25+
// { prefer: "type-imports", fixStyle: "inline-type-imports" },
26+
// ],
27+
// "@typescript-eslint/no-unused-vars": [
28+
// "warn",
29+
// { argsIgnorePattern: "^_" },
30+
// ],
31+
// "@typescript-eslint/require-await": "off",
32+
// "@typescript-eslint/no-misused-promises": [
33+
// "error",
34+
// { checksVoidReturn: { attributes: false } },
35+
// ],
36+
// },
37+
// },
38+
// {
39+
// linterOptions: {
40+
// reportUnusedDisableDirectives: true,
41+
// },
42+
// languageOptions: {
43+
// parserOptions: {
44+
// projectService: true,
45+
// },
46+
// },
47+
// },
48+
// );

package.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,37 +31,50 @@
3131
"@radix-ui/react-collapsible": "^1.1.11",
3232
"@radix-ui/react-dialog": "^1.1.14",
3333
"@radix-ui/react-dropdown-menu": "^2.1.15",
34+
"@radix-ui/react-icons": "^1.3.2",
3435
"@radix-ui/react-label": "^2.1.7",
3536
"@radix-ui/react-select": "^2.2.5",
3637
"@radix-ui/react-separator": "^1.1.7",
3738
"@radix-ui/react-slot": "^1.2.3",
3839
"@radix-ui/react-switch": "^1.2.5",
3940
"@radix-ui/react-tabs": "^1.1.12",
4041
"@radix-ui/react-tooltip": "^1.2.7",
42+
"@stripe/stripe-js": "^7.3.1",
4143
"@t3-oss/env-nextjs": "^0.12.0",
4244
"@tanstack/react-query": "^5.69.0",
4345
"@trpc/client": "^11.0.0",
4446
"@trpc/react-query": "^11.0.0",
4547
"@trpc/server": "^11.0.0",
48+
"@types/nodemailer": "^6.4.17",
49+
"@types/react-speech-kit": "^3.0.0",
50+
"@types/react-speech-recognition": "^3.9.6",
4651
"@types/react-syntax-highlighter": "^15.5.13",
52+
"@upstash/ratelimit": "^2.0.5",
4753
"ai": "^4.3.16",
4854
"axios": "^1.9.0",
4955
"class-variance-authority": "^0.7.1",
5056
"clsx": "^2.1.1",
57+
"cmdk": "^1.1.1",
5158
"framer-motion": "^12.16.0",
5259
"lucide-react": "^0.514.0",
5360
"next": "^15.2.3",
5461
"next-auth": "5.0.0-beta.25",
5562
"next-themes": "^0.4.6",
63+
"nodemailer": "^7.0.3",
5664
"openai": "^5.1.1",
5765
"react": "^19.0.0",
5866
"react-dom": "^19.0.0",
5967
"react-hook-form": "^7.57.0",
6068
"react-markdown": "^10.1.0",
69+
"react-speech-kit": "^3.0.1",
70+
"react-speech-recognition": "^4.0.1",
6171
"react-syntax-highlighter": "^15.6.1",
72+
"react-text-to-speech": "^2.0.3",
73+
"react-turnstile": "^1.1.4",
6274
"remark-gfm": "^4.0.1",
6375
"server-only": "^0.0.1",
6476
"sonner": "^2.0.5",
77+
"stripe": "^18.2.1",
6578
"superjson": "^2.2.1",
6679
"tailwind-merge": "^3.3.1",
6780
"zod": "^3.24.2"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
-- CreateEnum
2+
CREATE TYPE "Plan" AS ENUM ('FREE', 'PRO');
3+
4+
-- AlterTable
5+
ALTER TABLE "User" ADD COLUMN "about" TEXT,
6+
ADD COLUMN "customTraits" TEXT[],
7+
ADD COLUMN "nickname" TEXT,
8+
ADD COLUMN "plan" "Plan" DEFAULT 'FREE',
9+
ADD COLUMN "planCreatedAt" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP,
10+
ADD COLUMN "planExpiresAt" TIMESTAMP(3),
11+
ADD COLUMN "planUpdatedAt" TIMESTAMP(3),
12+
ADD COLUMN "whatDoYouDo" TEXT;
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
Warnings:
3+
4+
- You are about to drop the column `planCreatedAt` on the `User` table. All the data in the column will be lost.
5+
- You are about to drop the column `planExpiresAt` on the `User` table. All the data in the column will be lost.
6+
- You are about to drop the column `planUpdatedAt` on the `User` table. All the data in the column will be lost.
7+
8+
*/
9+
-- CreateEnum
10+
CREATE TYPE "TransactionStatus" AS ENUM ('PENDING', 'SUCCESS', 'FAILED');
11+
12+
-- AlterTable
13+
ALTER TABLE "User" DROP COLUMN "planCreatedAt",
14+
DROP COLUMN "planExpiresAt",
15+
DROP COLUMN "planUpdatedAt";
16+
17+
-- CreateTable
18+
CREATE TABLE "Subscription" (
19+
"id" TEXT NOT NULL,
20+
"userId" TEXT NOT NULL,
21+
"plan" "Plan" NOT NULL,
22+
"paymentId" TEXT NOT NULL,
23+
"orderId" TEXT NOT NULL,
24+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
25+
"updatedAt" TIMESTAMP(3) NOT NULL,
26+
27+
CONSTRAINT "Subscription_pkey" PRIMARY KEY ("id")
28+
);
29+
30+
-- CreateTable
31+
CREATE TABLE "Transaction" (
32+
"id" TEXT NOT NULL,
33+
"userId" TEXT NOT NULL,
34+
"amount" INTEGER NOT NULL,
35+
"currency" TEXT NOT NULL,
36+
"paymentId" TEXT NOT NULL,
37+
"orderId" TEXT NOT NULL,
38+
"plan" "Plan" NOT NULL,
39+
"status" "TransactionStatus" NOT NULL DEFAULT 'PENDING',
40+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
41+
"updatedAt" TIMESTAMP(3) NOT NULL,
42+
43+
CONSTRAINT "Transaction_pkey" PRIMARY KEY ("id")
44+
);
45+
46+
-- CreateIndex
47+
CREATE INDEX "Transaction_userId_idx" ON "Transaction"("userId");
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
Warnings:
3+
4+
- Added the required column `expiresAt` to the `Subscription` table without a default value. This is not possible if the table is not empty.
5+
6+
*/
7+
-- AlterTable
8+
ALTER TABLE "Subscription" ADD COLUMN "expiresAt" TIMESTAMP(3) NOT NULL;
9+
10+
-- CreateIndex
11+
CREATE INDEX "Subscription_userId_idx" ON "Subscription"("userId");
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
Warnings:
3+
4+
- You are about to drop the column `plan` on the `User` table. All the data in the column will be lost.
5+
6+
*/
7+
-- AlterTable
8+
ALTER TABLE "User" DROP COLUMN "plan";
9+
10+
-- AddForeignKey
11+
ALTER TABLE "Subscription" ADD CONSTRAINT "Subscription_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
Warnings:
3+
4+
- A unique constraint covering the columns `[userId]` on the table `Subscription` will be added. If there are existing duplicate values, this will fail.
5+
- Changed the type of `role` on the `Message` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required.
6+
7+
*/
8+
-- CreateEnum
9+
CREATE TYPE "MessageRole" AS ENUM ('USER', 'ASSISTANT');
10+
11+
-- AlterTable
12+
ALTER TABLE "Message" DROP COLUMN "role",
13+
ADD COLUMN "role" "MessageRole" NOT NULL;
14+
15+
-- CreateIndex
16+
CREATE UNIQUE INDEX "Subscription_userId_key" ON "Subscription"("userId");
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- AlterTable
2+
ALTER TABLE "Chat" ADD COLUMN "isSaved" BOOLEAN NOT NULL DEFAULT false;

prisma/schema.prisma

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,50 @@ model User {
4747
name String?
4848
email String? @unique
4949
emailVerified DateTime?
50+
about String?
51+
nickname String?
52+
customTraits String[]
53+
whatDoYouDo String?
5054
image String?
5155
accounts Account[]
5256
sessions Session[]
5357
chats Chat[]
58+
subscription Subscription? @relation("user_subscription")
59+
}
60+
61+
model Subscription {
62+
id String @id @default(cuid())
63+
userId String @unique
64+
plan Plan
65+
paymentId String
66+
orderId String
67+
createdAt DateTime @default(now())
68+
updatedAt DateTime @updatedAt
69+
expiresAt DateTime
70+
user User @relation("user_subscription", fields: [userId], references: [id], onDelete: Cascade)
71+
@@index([userId])
72+
}
73+
74+
75+
model Transaction {
76+
id String @id @default(cuid())
77+
userId String
78+
amount Int
79+
currency String
80+
paymentId String
81+
orderId String
82+
plan Plan
83+
status TransactionStatus @default(PENDING)
84+
createdAt DateTime @default(now())
85+
updatedAt DateTime @updatedAt
86+
87+
@@index([userId])
5488
}
5589

5690
model Chat {
5791
id String @id @default(cuid())
5892
userId String
93+
isSaved Boolean @default(false)
5994
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
6095
messages Message[]
6196
createdAt DateTime @default(now())
@@ -68,7 +103,7 @@ model Message {
68103
chatId String
69104
chat Chat @relation(fields: [chatId], references: [id], onDelete: Cascade)
70105
content String
71-
role String
106+
role MessageRole
72107
createdAt DateTime @default(now())
73108
updatedAt DateTime @updatedAt
74109
@@index([chatId])
@@ -81,3 +116,19 @@ model VerificationToken {
81116
82117
@@unique([identifier, token])
83118
}
119+
120+
enum Plan {
121+
FREE
122+
PRO
123+
}
124+
125+
enum TransactionStatus {
126+
PENDING
127+
SUCCESS
128+
FAILED
129+
}
130+
131+
enum MessageRole {
132+
USER
133+
ASSISTANT
134+
}

0 commit comments

Comments
 (0)