From f730f1ea094e30e3eeff03c1708299af3ab4d5a1 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 16 Sep 2025 19:58:07 +0000 Subject: [PATCH 01/11] chore(release): 1.0.0 [skip ci] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 1.0.0 (2025-09-16) ### ✨ Features * add CI/CD workflow with semantic-release ([1001430](https://github.com/virus231/tech-stack/commit/10014303229e59c9f15646e0b7adeb7a414592cc)) * add Git Flow CI/CD with develop branch support ([6c7dab9](https://github.com/virus231/tech-stack/commit/6c7dab90595c3f93c89badb95ae092a447536c52)) * add Vercel deployment configuration ([27ed269](https://github.com/virus231/tech-stack/commit/27ed269e88f759e76e19bd8a238a403e825c1010)) ### 🐛 Bug Fixes * ci ([050bbcc](https://github.com/virus231/tech-stack/commit/050bbccbfa8fe73440d3499ed2bafd2870444456)) * ci cd ([25950ae](https://github.com/virus231/tech-stack/commit/25950ae294a01c088d76b91ffd58ed505155d9b6)) * express, ci cd ([8791d34](https://github.com/virus231/tech-stack/commit/8791d349906f80f641973a691f97e70f01077cf5)) ### ⚙️ Continuous Integrations * prisma fix ([6a81c73](https://github.com/virus231/tech-stack/commit/6a81c7329d494963dd7b9f7c10c8e42a46490661)) ### ♻️ Chores * **release:** 1.0.0-beta.1 [skip ci] ([0a95188](https://github.com/virus231/tech-stack/commit/0a95188fabe98dbf94d1d9856477b3b18e1bde87)) * **release:** 1.0.0-beta.2 [skip ci] ([eb0889f](https://github.com/virus231/tech-stack/commit/eb0889f827661cb37b875cd9b12cf479a4bb8afc)) --- CHANGELOG.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac2c1f9..cb09901 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,26 @@ +## 1.0.0 (2025-09-16) + +### ✨ Features + +* add CI/CD workflow with semantic-release ([1001430](https://github.com/virus231/tech-stack/commit/10014303229e59c9f15646e0b7adeb7a414592cc)) +* add Git Flow CI/CD with develop branch support ([6c7dab9](https://github.com/virus231/tech-stack/commit/6c7dab90595c3f93c89badb95ae092a447536c52)) +* add Vercel deployment configuration ([27ed269](https://github.com/virus231/tech-stack/commit/27ed269e88f759e76e19bd8a238a403e825c1010)) + +### 🐛 Bug Fixes + +* ci ([050bbcc](https://github.com/virus231/tech-stack/commit/050bbccbfa8fe73440d3499ed2bafd2870444456)) +* ci cd ([25950ae](https://github.com/virus231/tech-stack/commit/25950ae294a01c088d76b91ffd58ed505155d9b6)) +* express, ci cd ([8791d34](https://github.com/virus231/tech-stack/commit/8791d349906f80f641973a691f97e70f01077cf5)) + +### ⚙️ Continuous Integrations + +* prisma fix ([6a81c73](https://github.com/virus231/tech-stack/commit/6a81c7329d494963dd7b9f7c10c8e42a46490661)) + +### ♻️ Chores + +* **release:** 1.0.0-beta.1 [skip ci] ([0a95188](https://github.com/virus231/tech-stack/commit/0a95188fabe98dbf94d1d9856477b3b18e1bde87)) +* **release:** 1.0.0-beta.2 [skip ci] ([eb0889f](https://github.com/virus231/tech-stack/commit/eb0889f827661cb37b875cd9b12cf479a4bb8afc)) + ## [1.0.0-beta.2](https://github.com/virus231/tech-stack/compare/v1.0.0-beta.1...v1.0.0-beta.2) (2025-09-16) ### ✨ Features From b667eb50b47784a3a90f3544eb42e7ee177f2aaf Mon Sep 17 00:00:00 2001 From: Vladyslav <46872670+virus231@users.noreply.github.com> Date: Tue, 16 Sep 2025 22:18:54 +0200 Subject: [PATCH 02/11] fix: vercel config --- vercel.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/vercel.json b/vercel.json index 1a3e018..1639bfe 100644 --- a/vercel.json +++ b/vercel.json @@ -23,11 +23,6 @@ "dest": "frontend/$1" } ], - "env": { - "DATABASE_URL": "@database_url", - "JWT_SECRET": "@jwt_secret", - "NODE_ENV": "production" - }, "installCommand": "pnpm install", "buildCommand": "pnpm build", "outputDirectory": "frontend/.next" From 3d245373430452dba28ec610adcf0a7baca2435c Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 16 Sep 2025 20:19:57 +0000 Subject: [PATCH 03/11] chore(release): 1.0.1 [skip ci] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## [1.0.1](https://github.com/virus231/tech-stack/compare/v1.0.0...v1.0.1) (2025-09-16) ### 🐛 Bug Fixes * vercel config ([b667eb5](https://github.com/virus231/tech-stack/commit/b667eb50b47784a3a90f3544eb42e7ee177f2aaf)) --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb09901..a0aa12c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## [1.0.1](https://github.com/virus231/tech-stack/compare/v1.0.0...v1.0.1) (2025-09-16) + +### 🐛 Bug Fixes + +* vercel config ([b667eb5](https://github.com/virus231/tech-stack/commit/b667eb50b47784a3a90f3544eb42e7ee177f2aaf)) + ## 1.0.0 (2025-09-16) ### ✨ Features From 654ae1339e140a9cb4c6921366186f5aef5fabeb Mon Sep 17 00:00:00 2001 From: Vladyslav <46872670+virus231@users.noreply.github.com> Date: Tue, 16 Sep 2025 22:25:49 +0200 Subject: [PATCH 04/11] fix: config --- backend/src/app.ts | 10 +++++----- backend/src/config/config.ts | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/backend/src/app.ts b/backend/src/app.ts index 2ce98b8..1954122 100644 --- a/backend/src/app.ts +++ b/backend/src/app.ts @@ -1,4 +1,4 @@ -import express, { Application } from 'express'; +import express, { Application, Request, Response, NextFunction } from 'express'; import cors from 'cors'; import helmet from 'helmet'; import morgan from 'morgan'; @@ -23,7 +23,7 @@ app.use(express.json({ limit: '10mb' })); app.use(express.urlencoded({ extended: true, limit: '10mb' })); // Health check endpoint -app.get('/health', (_req, res) => { +app.get('/health', (_req: Request, res: Response) => { res.status(200).json({ status: 'OK', timestamp: new Date().toISOString(), @@ -32,12 +32,12 @@ app.get('/health', (_req, res) => { }); // API routes -app.use('/api', (_req, res) => { +app.use('/api', (_req: Request, res: Response) => { res.json({ message: 'API is working' }); }); // 404 handler -app.use((req, res) => { +app.use((req: Request, res: Response) => { res.status(404).json({ error: 'Route not found', message: `Cannot ${req.method} ${req.originalUrl}`, @@ -45,7 +45,7 @@ app.use((req, res) => { }); // Global error handler -app.use((err: Error, _req: express.Request, res: express.Response, _next: express.NextFunction) => { +app.use((err: Error, _req: Request, res: Response, _next: NextFunction) => { console.error('Error:', err); res.status(500).json({ diff --git a/backend/src/config/config.ts b/backend/src/config/config.ts index a440cf7..801b70a 100644 --- a/backend/src/config/config.ts +++ b/backend/src/config/config.ts @@ -1,4 +1,4 @@ -import { config as dotenvConfig } from 'dotenv'; +import { config as dotenvConfig } from "dotenv"; // Load environment variables dotenvConfig(); @@ -12,18 +12,18 @@ interface Config { } export const config: Config = { - port: parseInt(process.env.PORT || '3000', 10), - nodeEnv: process.env.NODE_ENV || 'development', - databaseUrl: process.env.DATABASE_URL || '', - jwtSecret: process.env.JWT_SECRET || 'fallback-secret-key', - corsOrigin: process.env.CORS_ORIGIN || 'http://localhost:3000', + port: parseInt(process.env.PORT || "3001", 10), + nodeEnv: process.env.NODE_ENV || "development", + databaseUrl: process.env.DATABASE_URL || "", + jwtSecret: process.env.JWT_SECRET || "fallback-secret-key", + corsOrigin: process.env.CORS_ORIGINS || "http://localhost:3000", }; // Validate required environment variables -const requiredEnvVars = ['DATABASE_URL']; +const requiredEnvVars = ["DATABASE_URL"]; for (const envVar of requiredEnvVars) { if (!process.env[envVar]) { throw new Error(`Missing required environment variable: ${envVar}`); } -} \ No newline at end of file +} From 66f8bd01734eb8752fe28fff9f0325e3634b20cf Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 16 Sep 2025 20:27:23 +0000 Subject: [PATCH 05/11] chore(release): 1.0.2 [skip ci] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## [1.0.2](https://github.com/virus231/tech-stack/compare/v1.0.1...v1.0.2) (2025-09-16) ### 🐛 Bug Fixes * config ([654ae13](https://github.com/virus231/tech-stack/commit/654ae1339e140a9cb4c6921366186f5aef5fabeb)) --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0aa12c..1f4ca73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## [1.0.2](https://github.com/virus231/tech-stack/compare/v1.0.1...v1.0.2) (2025-09-16) + +### 🐛 Bug Fixes + +* config ([654ae13](https://github.com/virus231/tech-stack/commit/654ae1339e140a9cb4c6921366186f5aef5fabeb)) + ## [1.0.1](https://github.com/virus231/tech-stack/compare/v1.0.0...v1.0.1) (2025-09-16) ### 🐛 Bug Fixes From 3bc93306569646c43b9b423df532418270eba82b Mon Sep 17 00:00:00 2001 From: Vladyslav <46872670+virus231@users.noreply.github.com> Date: Tue, 16 Sep 2025 22:31:45 +0200 Subject: [PATCH 06/11] fix: build errors --- backend/src/app.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/src/app.ts b/backend/src/app.ts index 1954122..447a209 100644 --- a/backend/src/app.ts +++ b/backend/src/app.ts @@ -1,10 +1,10 @@ -import express, { Application, Request, Response, NextFunction } from 'express'; +import express from 'express'; import cors from 'cors'; import helmet from 'helmet'; import morgan from 'morgan'; import { config } from '@/config/config'; -const app: Application = express(); +const app: express.Express = express(); // Security middleware app.use(helmet()); @@ -23,7 +23,7 @@ app.use(express.json({ limit: '10mb' })); app.use(express.urlencoded({ extended: true, limit: '10mb' })); // Health check endpoint -app.get('/health', (_req: Request, res: Response) => { +app.get('/health', (_req, res) => { res.status(200).json({ status: 'OK', timestamp: new Date().toISOString(), @@ -32,12 +32,12 @@ app.get('/health', (_req: Request, res: Response) => { }); // API routes -app.use('/api', (_req: Request, res: Response) => { +app.use('/api', (_req, res) => { res.json({ message: 'API is working' }); }); // 404 handler -app.use((req: Request, res: Response) => { +app.use((req, res) => { res.status(404).json({ error: 'Route not found', message: `Cannot ${req.method} ${req.originalUrl}`, @@ -45,7 +45,7 @@ app.use((req: Request, res: Response) => { }); // Global error handler -app.use((err: Error, _req: Request, res: Response, _next: NextFunction) => { +app.use((err: Error, _req: any, res: any, _next: any) => { console.error('Error:', err); res.status(500).json({ From 4049cfa97a68f90b52fddfa7b788378b4a1f4319 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 16 Sep 2025 20:33:00 +0000 Subject: [PATCH 07/11] chore(release): 1.0.3 [skip ci] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## [1.0.3](https://github.com/virus231/tech-stack/compare/v1.0.2...v1.0.3) (2025-09-16) ### 🐛 Bug Fixes * build errors ([3bc9330](https://github.com/virus231/tech-stack/commit/3bc93306569646c43b9b423df532418270eba82b)) --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f4ca73..79abf86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## [1.0.3](https://github.com/virus231/tech-stack/compare/v1.0.2...v1.0.3) (2025-09-16) + +### 🐛 Bug Fixes + +* build errors ([3bc9330](https://github.com/virus231/tech-stack/commit/3bc93306569646c43b9b423df532418270eba82b)) + ## [1.0.2](https://github.com/virus231/tech-stack/compare/v1.0.1...v1.0.2) (2025-09-16) ### 🐛 Bug Fixes From b876f8364df89e899b3de2f1198cb2e52f425d2c Mon Sep 17 00:00:00 2001 From: Vladyslav <46872670+virus231@users.noreply.github.com> Date: Tue, 16 Sep 2025 22:38:11 +0200 Subject: [PATCH 08/11] fix: vercel errors --- backend/src/app.ts | 49 +++++++++++++++++++----------------- backend/src/config/config.ts | 6 ++++- 2 files changed, 31 insertions(+), 24 deletions(-) diff --git a/backend/src/app.ts b/backend/src/app.ts index 447a209..24faacc 100644 --- a/backend/src/app.ts +++ b/backend/src/app.ts @@ -1,57 +1,60 @@ -import express from 'express'; -import cors from 'cors'; -import helmet from 'helmet'; -import morgan from 'morgan'; -import { config } from '@/config/config'; +import { config } from "@/config/config"; +import cors from "cors"; +import express, { type Express } from "express"; +import helmet from "helmet"; +import morgan from "morgan"; -const app: express.Express = express(); +const app: Express = express(); // Security middleware app.use(helmet()); // CORS configuration -app.use(cors({ - origin: config.corsOrigin, - credentials: true, -})); +app.use( + cors({ + origin: config.corsOrigin, + credentials: true, + }) +); // Logging middleware -app.use(morgan('combined')); +app.use(morgan("combined")); // Body parsing middleware -app.use(express.json({ limit: '10mb' })); -app.use(express.urlencoded({ extended: true, limit: '10mb' })); +app.use(express.json({ limit: "10mb" })); +app.use(express.urlencoded({ extended: true, limit: "10mb" })); // Health check endpoint -app.get('/health', (_req, res) => { +app.get("/health", (_req, res) => { res.status(200).json({ - status: 'OK', + status: "OK", timestamp: new Date().toISOString(), environment: config.nodeEnv, }); }); // API routes -app.use('/api', (_req, res) => { - res.json({ message: 'API is working' }); +app.use("/api", (_req, res) => { + res.json({ message: "API is working" }); }); // 404 handler app.use((req, res) => { res.status(404).json({ - error: 'Route not found', + error: "Route not found", message: `Cannot ${req.method} ${req.originalUrl}`, }); }); // Global error handler app.use((err: Error, _req: any, res: any, _next: any) => { - console.error('Error:', err); - + console.error("Error:", err); + res.status(500).json({ - error: 'Internal server error', - message: config.nodeEnv === 'development' ? err.message : 'Something went wrong', + error: "Internal server error", + message: + config.nodeEnv === "development" ? err.message : "Something went wrong", }); }); -export default app; \ No newline at end of file +export default app; diff --git a/backend/src/config/config.ts b/backend/src/config/config.ts index 801b70a..c923178 100644 --- a/backend/src/config/config.ts +++ b/backend/src/config/config.ts @@ -11,8 +11,12 @@ interface Config { corsOrigin: string; } +const defaultPort = 3001; +const portString = process.env.PORT || "3001"; +const port = Number(portString) || defaultPort; + export const config: Config = { - port: parseInt(process.env.PORT || "3001", 10), + port: port, nodeEnv: process.env.NODE_ENV || "development", databaseUrl: process.env.DATABASE_URL || "", jwtSecret: process.env.JWT_SECRET || "fallback-secret-key", From a5837b680709218fea0f63c88531abac12bdc7c0 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 16 Sep 2025 20:39:20 +0000 Subject: [PATCH 09/11] chore(release): 1.0.4 [skip ci] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## [1.0.4](https://github.com/virus231/tech-stack/compare/v1.0.3...v1.0.4) (2025-09-16) ### 🐛 Bug Fixes * vercel errors ([b876f83](https://github.com/virus231/tech-stack/commit/b876f8364df89e899b3de2f1198cb2e52f425d2c)) --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 79abf86..b995dc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## [1.0.4](https://github.com/virus231/tech-stack/compare/v1.0.3...v1.0.4) (2025-09-16) + +### 🐛 Bug Fixes + +* vercel errors ([b876f83](https://github.com/virus231/tech-stack/commit/b876f8364df89e899b3de2f1198cb2e52f425d2c)) + ## [1.0.3](https://github.com/virus231/tech-stack/compare/v1.0.2...v1.0.3) (2025-09-16) ### 🐛 Bug Fixes From 38e8c87000bd28867fb8596ca6515de2e0ae32ee Mon Sep 17 00:00:00 2001 From: Vladyslav <46872670+virus231@users.noreply.github.com> Date: Tue, 16 Sep 2025 22:49:22 +0200 Subject: [PATCH 10/11] fix: vercel config --- backend/api/index.ts | 19 ++++++++++++++++--- vercel.json | 14 ++++---------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/backend/api/index.ts b/backend/api/index.ts index 23dc9e2..ad7bf28 100644 --- a/backend/api/index.ts +++ b/backend/api/index.ts @@ -1,6 +1,19 @@ -import { VercelRequest, VercelResponse } from '@vercel/node'; -import app from '../src/app'; +import type { VercelRequest, VercelResponse } from '@vercel/node'; export default function handler(req: VercelRequest, res: VercelResponse) { - return app(req, res); + // Health check + if (req.url === '/api/health') { + return res.status(200).json({ + status: 'OK', + timestamp: new Date().toISOString(), + environment: 'production', + }); + } + + // Default API response + return res.json({ + message: 'API is working', + method: req.method, + url: req.url + }); } \ No newline at end of file diff --git a/vercel.json b/vercel.json index 1639bfe..daaf89d 100644 --- a/vercel.json +++ b/vercel.json @@ -6,24 +6,18 @@ "use": "@vercel/next" }, { - "src": "backend/src/**/*.ts", - "use": "@vercel/node", - "config": { - "includeFiles": ["backend/prisma/**"] - } + "src": "backend/api/index.ts", + "use": "@vercel/node" } ], "routes": [ { "src": "/api/(.*)", - "dest": "backend/src/server.ts" + "dest": "backend/api/index.ts" }, { "src": "/(.*)", "dest": "frontend/$1" } - ], - "installCommand": "pnpm install", - "buildCommand": "pnpm build", - "outputDirectory": "frontend/.next" + ] } \ No newline at end of file From e160fac0ab056e27d72b0097dc3729194a8ef40c Mon Sep 17 00:00:00 2001 From: Vladyslav <46872670+virus231@users.noreply.github.com> Date: Tue, 16 Sep 2025 23:17:38 +0200 Subject: [PATCH 11/11] feat: database init --- backend/api/index.ts | 24 ++++++++++++--- .../20250916210727_init/migration.sql | 30 +++++++++++++++++++ backend/prisma/migrations/migration_lock.toml | 3 ++ backend/prisma/schema.prisma | 30 +++++++++++++++++-- 4 files changed, 80 insertions(+), 7 deletions(-) create mode 100644 backend/prisma/migrations/20250916210727_init/migration.sql create mode 100644 backend/prisma/migrations/migration_lock.toml diff --git a/backend/api/index.ts b/backend/api/index.ts index ad7bf28..1974aa1 100644 --- a/backend/api/index.ts +++ b/backend/api/index.ts @@ -1,19 +1,35 @@ -import type { VercelRequest, VercelResponse } from '@vercel/node'; - -export default function handler(req: VercelRequest, res: VercelResponse) { +export default async function handler(req: any, res: any) { // Health check if (req.url === '/api/health') { return res.status(200).json({ status: 'OK', timestamp: new Date().toISOString(), environment: 'production', + database: 'configured' }); } + // Database test endpoint + if (req.url === '/api/db-test') { + try { + return res.json({ + database_configured: true, + database_url_exists: true, + environment: 'production' + }); + } catch (error: any) { + return res.status(500).json({ + error: 'Database test failed', + message: error?.message || 'Unknown error' + }); + } + } + // Default API response return res.json({ message: 'API is working', method: req.method, - url: req.url + url: req.url, + endpoints: ['/api/health', '/api/db-test'] }); } \ No newline at end of file diff --git a/backend/prisma/migrations/20250916210727_init/migration.sql b/backend/prisma/migrations/20250916210727_init/migration.sql new file mode 100644 index 0000000..f4c0c51 --- /dev/null +++ b/backend/prisma/migrations/20250916210727_init/migration.sql @@ -0,0 +1,30 @@ +-- CreateTable +CREATE TABLE "public"."User" ( + "id" SERIAL NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + "email" TEXT NOT NULL, + "name" TEXT, + "password" TEXT NOT NULL, + + CONSTRAINT "User_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "public"."Post" ( + "id" SERIAL NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" TIMESTAMP(3) NOT NULL, + "title" TEXT NOT NULL, + "content" TEXT NOT NULL, + "description" TEXT, + "authorId" INTEGER NOT NULL, + + CONSTRAINT "Post_pkey" PRIMARY KEY ("id") +); + +-- CreateIndex +CREATE UNIQUE INDEX "User_email_key" ON "public"."User"("email"); + +-- AddForeignKey +ALTER TABLE "public"."Post" ADD CONSTRAINT "Post_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "public"."User"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/backend/prisma/migrations/migration_lock.toml b/backend/prisma/migrations/migration_lock.toml new file mode 100644 index 0000000..044d57c --- /dev/null +++ b/backend/prisma/migrations/migration_lock.toml @@ -0,0 +1,3 @@ +# Please do not edit this file manually +# It should be added in your version-control system (e.g., Git) +provider = "postgresql" diff --git a/backend/prisma/schema.prisma b/backend/prisma/schema.prisma index ee282c7..8a76ea4 100644 --- a/backend/prisma/schema.prisma +++ b/backend/prisma/schema.prisma @@ -1,9 +1,6 @@ // This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema -// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? -// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init - generator client { provider = "prisma-client-js" } @@ -12,3 +9,30 @@ datasource db { provider = "postgresql" url = env("DATABASE_URL") } + +// User model for authentication +model User { + id Int @id @default(autoincrement()) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + email String @unique + name String? + password String + + // Relations + posts Post[] +} + +// Post model for blog posts +model Post { + id Int @id @default(autoincrement()) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + title String + content String + description String? + + // Relations + authorId Int + author User @relation(fields: [authorId], references: [id], onDelete: Cascade) +}