diff --git a/apps/client/drizzle.config.ts b/apps/client/drizzle.config.ts new file mode 100644 index 0000000..37b5ca8 --- /dev/null +++ b/apps/client/drizzle.config.ts @@ -0,0 +1,26 @@ +// import { config } from "dotenv"; +// import { defineConfig } from "drizzle-kit"; + +// config({ path: ".env" }); + +// export default defineConfig({ +// schema: "./src/db/schema.ts", +// out: "./migrations", +// dialect: "postgresql", +// dbCredentials: { +// url: process.env.DATABASE_URL!, +// }, +// }); + +import "dotenv/config"; +import { defineConfig } from "drizzle-kit"; + +export default defineConfig({ + out: "./drizzle", + schema: "./src/db/schema.ts", + dialect: "turso", + dbCredentials: { + url: process.env.TURSO_DATABASE_URL!, + authToken: process.env.TURSO_AUTH_TOKEN!, + }, +}); diff --git a/apps/client/drizzle/0000_narrow_iron_fist.sql b/apps/client/drizzle/0000_narrow_iron_fist.sql new file mode 100644 index 0000000..121d098 --- /dev/null +++ b/apps/client/drizzle/0000_narrow_iron_fist.sql @@ -0,0 +1,14 @@ +CREATE TABLE `posts_table` ( + `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, + `title` text NOT NULL, + `content` text NOT NULL +); +--> statement-breakpoint +CREATE TABLE `users_table` ( + `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, + `name` text NOT NULL, + `age` integer NOT NULL, + `email` text NOT NULL +); +--> statement-breakpoint +CREATE UNIQUE INDEX `users_table_email_unique` ON `users_table` (`email`); \ No newline at end of file diff --git a/apps/client/drizzle/meta/0000_snapshot.json b/apps/client/drizzle/meta/0000_snapshot.json new file mode 100644 index 0000000..78da980 --- /dev/null +++ b/apps/client/drizzle/meta/0000_snapshot.json @@ -0,0 +1,95 @@ +{ + "version": "6", + "dialect": "sqlite", + "id": "3df1e1e6-13eb-4b16-acb7-a1bc6c632530", + "prevId": "00000000-0000-0000-0000-000000000000", + "tables": { + "posts_table": { + "name": "posts_table", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "users_table": { + "name": "users_table", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "age": { + "name": "age", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "users_table_email_unique": { + "name": "users_table_email_unique", + "columns": [ + "email" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + } + }, + "views": {}, + "enums": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + }, + "internal": { + "indexes": {} + } +} \ No newline at end of file diff --git a/apps/client/drizzle/meta/_journal.json b/apps/client/drizzle/meta/_journal.json new file mode 100644 index 0000000..823207f --- /dev/null +++ b/apps/client/drizzle/meta/_journal.json @@ -0,0 +1,13 @@ +{ + "version": "7", + "dialect": "sqlite", + "entries": [ + { + "idx": 0, + "version": "6", + "when": 1740026199088, + "tag": "0000_narrow_iron_fist", + "breakpoints": true + } + ] +} \ No newline at end of file diff --git a/apps/client/package.json b/apps/client/package.json index 19592e4..b37fe3e 100644 --- a/apps/client/package.json +++ b/apps/client/package.json @@ -7,9 +7,17 @@ "build": "next build", "start": "next start", "lint": "next lint --max-warnings 0", - "check-types": "tsc --noEmit" + "check-types": "tsc --noEmit", + "db:generate": "npx drizzle-kit generate", + "db:push": "npx drizzle-kit push", + "db:studio": "npx drizzle-kit studio", + "db:migrate": "npx drizzle-kit migrate", + "db:seed": "npx tsx src/db/drizzle.ts" }, "dependencies": { + "@clerk/nextjs": "^6.11.3", + "@libsql/client": "^0.14.0", + "@metafest/pushyplayer": "^0.1.26", "@radix-ui/react-avatar": "^1.1.3", "@radix-ui/react-collapsible": "^1.1.3", "@radix-ui/react-dialog": "^1.1.6", @@ -22,7 +30,8 @@ "@vercel/speed-insights": "^1.2.0", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", - "@clerk/nextjs": "^6.11.3", + "dotenv": "^16.4.7", + "drizzle-orm": "^0.39.3", "framer-motion": "^12.3.1", "lucide-react": "^0.474.0", "motion": "^12.3.1", @@ -41,8 +50,10 @@ "@types/react": "^19", "@types/react-dom": "^19", "autoprefixer": "^10.4.20", + "drizzle-kit": "^0.30.4", "postcss": "^8.5.1", "tailwindcss": "^3.4.17", + "tsx": "^4.19.3", "typescript": "^5" } } diff --git a/apps/client/src/app/api/route.ts b/apps/client/src/app/api/route.ts new file mode 100644 index 0000000..387d798 --- /dev/null +++ b/apps/client/src/app/api/route.ts @@ -0,0 +1,5 @@ +export async function GET() { + return Response.json({ + message: "Hello, world!", + }); +} diff --git a/apps/client/src/app/api/test/route.ts b/apps/client/src/app/api/test/route.ts new file mode 100644 index 0000000..4b39f49 --- /dev/null +++ b/apps/client/src/app/api/test/route.ts @@ -0,0 +1,13 @@ +import { usersTable } from "@/db/schema"; +import { getDbClient } from "@/utils/drizzle"; + +export const dynamic = 'force-dynamic'; + +export async function GET() { + const db = getDbClient(); + const users = await db.select().from(usersTable); + + return Response.json({ + users, + }); +} diff --git a/apps/client/src/app/home/gallery/page.tsx b/apps/client/src/app/home/gallery/page.tsx index e25897b..d99ad78 100644 --- a/apps/client/src/app/home/gallery/page.tsx +++ b/apps/client/src/app/home/gallery/page.tsx @@ -3,6 +3,8 @@ import { FileVideo } from "lucide-react"; import GalleryCard, { Video } from "@/components/home/videoCard"; import { fetchUserObjects } from "@/utils"; +export const dynamic = 'force-dynamic'; + const EmptyState = () => (