Index: backend/.gitignore
===================================================================
--- backend/.gitignore	(revision 074a70e4190d3d24571f1f134621f2dde3572fdd)
+++ backend/.gitignore	(revision 074a70e4190d3d24571f1f134621f2dde3572fdd)
@@ -0,0 +1,5 @@
+node_modules
+# Keep environment variables out of version control
+.env
+
+/generated/prisma
Index: backend/controllers/apiController.js
===================================================================
--- backend/controllers/apiController.js	(revision cd1607eacc1ded866289d91af60680023b374572)
+++ backend/controllers/apiController.js	(revision 074a70e4190d3d24571f1f134621f2dde3572fdd)
@@ -1,86 +1,58 @@
 const supabase = require('../supabaseClient');
 const Student = require('../models/Student');
-
-async function createUserInSupabase(studentInstance) {
-  const { data, error } = await supabase.from('users').insert([
-    {
-      id: studentInstance.id,
-      username: studentInstance.username,
-      email: studentInstance.email,
-      name: studentInstance.name,
-      solved_problems: studentInstance.solvedProblems,
-      rank: studentInstance.rank,
-      points: studentInstance.points,
-      commentCounter: studentInstance.commentCounter,
-      commentCheckCounter: studentInstance.commentCheckCounter,
-      postCounter: studentInstance.postCounter,
-      postCheckCounter: studentInstance.postCheckCounter,
-      isModerator: studentInstance.isModerator,
-    },
-  ]);
-  return { studentInstance, error };
-}
+const prisma = require('../lib/prisma');
 
 const registerPOST = async (req, res) => {
   try {
-    const { username, name, email, password } = req.body;
+    const { username, email, password, name } = req.body;
 
-    const studentModel = new Student({ username, email, name });
-
-    const validationErrors = studentModel.validate();
-
-    if (validationErrors) {
+    // Validate input
+    if (!username || !email || !password || !name) {
       return res.status(400).json({
-        message: 'Validation failed',
-        errors: validationErrors,
+        message: 'Username, email, password and name are required',
         success: false,
       });
     }
 
-    if (!password) {
-      return res.status(400).json({
-        message: 'Password is required',
-        success: false,
+    try {
+      // Step 1: Create auth user in Supabase
+      const { data: authUser, error: authError } =
+        await supabase.auth.admin.createUser({
+          email,
+          password,
+          user_metadata: { username, name },
+        });
+
+      if (authError) throw new Error(authError.message);
+
+      // Step 2: Create Student instance
+      const student = new Student({
+        id: authUser.user.id,
+        username,
+        email,
+        name,
+        // Add other properties as needed
       });
-    }
 
-    const { data, error } = await supabase.auth.admin.createUser({
-      email,
-      password,
-      user_metadata: { username },
-      email_confirm: true,
-    });
+      // Step 3: Use the Student instance to create the database record
+      const { studentInstance, error } = await createUserInSupabase(student);
 
-    if (error) {
-      if (error.message.includes('already registered')) {
-        return res.status(409).json({
-          message: 'Email already exists',
-          success: false,
-        });
-      }
-      return res.status(500).json({
+      if (error) throw new Error(error.message);
+
+      // Success response
+      res.status(201).json({
+        message: 'Registration successful',
+        success: true,
+        user: studentInstance,
+      });
+    } catch (error) {
+      console.error('Registration error:', error);
+      res.status(400).json({
         message: error.message,
         success: false,
       });
     }
-
-    studentModel.id = data.user.id;
-
-    const { error: dbError } = await createUserInSupabase(studentModel);
-    if (dbError) {
-      console.error('Database insert error:', dbError);
-      return res.status(500).json({
-        message: 'Failed to save user in database',
-        success: false,
-      });
-    }
-
-    res.status(200).json({
-      message: 'Registration successful',
-      success: true,
-      user: studentModel.toJSON(),
-    });
   } catch (error) {
-    console.error('Registration error:', error);
+    console.error('Server error:', error);
     res.status(500).json({
       message: 'An error occurred during registration',
@@ -90,4 +62,30 @@
 };
 
+// Replace your createUserInSupabase function
+async function createUserInSupabase(studentInstance) {
+  try {
+    const newUser = await prisma.users.create({
+      data: {
+        id: studentInstance.id, // Use ID from Supabase Auth
+        username: studentInstance.username,
+        email: studentInstance.email,
+        name: studentInstance.name,
+        solved_problems: studentInstance.solvedProblems || 0,
+        rank: studentInstance.rank || 'Novice',
+        points: studentInstance.points || 0,
+        commentCounter: studentInstance.commentCounter || 3,
+        commentCheckCounter: studentInstance.commentCheckCounter || 0,
+        postCounter: studentInstance.postCounter || 3,
+        postCheckCounter: studentInstance.postCheckCounter || 0,
+        isModerator: studentInstance.isModerator || false,
+      },
+    });
+    return { studentInstance, error: null };
+  } catch (error) {
+    return { studentInstance, error };
+  }
+}
+
+// Update your loginPOST function
 const loginPOST = async (req, res) => {
   try {
@@ -95,10 +93,10 @@
 
     if (!email || !password) {
-      return res.status(400).json({
-        message: 'Email and password are required',
-        success: false,
-      });
+      return res
+        .status(400)
+        .json({ message: 'Email and password are required', success: false });
     }
 
+    // Still use Supabase for authentication
     const { data, error } = await supabase.auth.signInWithPassword({
       email,
@@ -107,37 +105,37 @@
 
     if (error) {
-      return res.status(401).json({
-        message: error.message,
-        success: false,
-      });
+      return res.status(401).json({ message: error.message, success: false });
     }
 
-    // Fetch user from users table
-    const { data: userData, error: userError } = await supabase
-      .from('users')
-      .select('*')
-      .eq('email', email)
-      .single();
+    // But use Prisma to fetch the user data
+    try {
+      const userData = await prisma.users.findUnique({
+        where: { email: email },
+      });
 
-    if (userError || !userData) {
-      return res.status(404).json({
-        message: 'User not found in database',
-        success: false,
-      });
+      if (!userData) {
+        return res
+          .status(404)
+          .json({ message: 'User not found in database', success: false });
+      }
+
+      res
+        .status(200)
+        .json({ message: 'Login successful', success: true, user: userData });
+    } catch (dbError) {
+      console.error('Database error:', dbError);
+      return res
+        .status(500)
+        .json({ message: 'Database error', success: false });
     }
-
-    res.status(200).json({
-      message: 'Login successful',
-      success: true,
-      user: userData,
-    });
   } catch (error) {
     console.error('Login error:', error);
-    res.status(500).json({
-      message: 'An error occurred during login',
-      success: false,
-    });
+    res
+      .status(500)
+      .json({ message: 'An error occurred during login', success: false });
   }
 };
+
+// The rest of your controller remains similar
 
 module.exports = {
Index: backend/controllers/forumController.js
===================================================================
--- backend/controllers/forumController.js	(revision cd1607eacc1ded866289d91af60680023b374572)
+++ backend/controllers/forumController.js	(revision 074a70e4190d3d24571f1f134621f2dde3572fdd)
@@ -1,24 +1,35 @@
-const supabase = require('../supabaseClient');
-
-// Placeholder for forum post functions
+const prisma = require('../lib/prisma');
+const ForumPost = require('../models/ForumPost');
+const Comment = require('../models/Comment');
+
+// Forum Post Functions
 const createForumPost = async (req, res) => {
   const { title, content, authorId, authorName } = req.body;
 
   try {
-    const { data, error } = await supabase
-      .from('forum_posts')
-      .insert([
-        { title, content, author_id: authorId, author_name: authorName },
-      ])
-      .select();
-
-    if (error) {
-      console.error('Error creating forum post:', error);
-      return res.status(500).json({ error: error.message });
-    }
-
-    res
-      .status(201)
-      .json({ message: 'Forum post created successfully', post: data[0] });
+    // Create domain object first
+    const post = new ForumPost({
+      title,
+      content,
+      authorName,
+    });
+
+    // Store in database using Prisma
+    const savedPost = await prisma.forum_posts.create({
+      data: {
+        title: post.title,
+        content: post.content,
+        author_id: authorId,
+        author_name: post.authorName,
+      },
+    });
+
+    // Update the domain object with the generated ID
+    post.id = savedPost.id;
+
+    res.status(201).json({
+      message: 'Forum post created successfully',
+      post: savedPost,
+    });
   } catch (err) {
     console.error('Server error:', err);
@@ -31,18 +42,28 @@
     const page = parseInt(req.query.page) || 0;
     const limit = parseInt(req.query.limit) || 5;
-    const offset = page * limit;
-
-    const { data, error } = await supabase
-      .from('forum_posts')
-      .select('*')
-      .order('date_created', { ascending: false })
-      .range(offset, offset + limit - 1); // Supabase range is inclusive
-
-    if (error) {
-      console.error('Error fetching forum posts:', error);
-      return res.status(500).json({ error: error.message });
-    }
-
-    res.status(200).json(data);
+    const skip = page * limit;
+
+    // Use Prisma to fetch posts with pagination
+    const posts = await prisma.forum_posts.findMany({
+      skip,
+      take: limit,
+      orderBy: {
+        date_created: 'desc',
+      },
+    });
+
+    // Convert to domain objects
+    const forumPosts = posts.map(
+      (post) =>
+        new ForumPost({
+          id: post.id,
+          title: post.title,
+          content: post.content,
+          authorName: post.author_name,
+          dateCreated: post.date_created,
+        })
+    );
+
+    res.status(200).json(forumPosts);
   } catch (err) {
     console.error('Server error:', err);
@@ -56,23 +77,35 @@
 
   try {
-    const { data, error } = await supabase
-      .from('forum_posts')
-      .update({ title, content })
-      .eq('id', id)
-      .select();
-
-    if (error) {
-      console.error('Error updating forum post:', error);
-      return res.status(500).json({ error: error.message });
-    }
-
-    if (!data || data.length === 0) {
+    // Update using Prisma
+    const updatedPost = await prisma.forum_posts.update({
+      where: { id },
+      data: {
+        title,
+        content,
+      },
+    });
+
+    if (!updatedPost) {
       return res.status(404).json({ error: 'Forum post not found' });
     }
 
-    res
-      .status(200)
-      .json({ message: 'Forum post updated successfully', post: data[0] });
-  } catch (err) {
+    // Create domain object from updated data
+    const post = new ForumPost({
+      id: updatedPost.id,
+      title: updatedPost.title,
+      content: updatedPost.content,
+      authorName: updatedPost.author_name,
+      dateCreated: updatedPost.date_created,
+    });
+
+    res.status(200).json({
+      message: 'Forum post updated successfully',
+      post,
+    });
+  } catch (err) {
+    // Prisma throws when record not found
+    if (err.code === 'P2025') {
+      return res.status(404).json({ error: 'Forum post not found' });
+    }
     console.error('Server error:', err);
     res.status(500).json({ error: 'Internal server error' });
@@ -84,19 +117,21 @@
 
   try {
-    const { error } = await supabase.from('forum_posts').delete().eq('id', id);
-
-    if (error) {
-      console.error('Error deleting forum post:', error);
-      return res.status(500).json({ error: error.message });
-    }
-
-    res.status(204).send(); // No content to send back on successful deletion
-  } catch (err) {
-    console.error('Server error:', err);
-    res.status(500).json({ error: 'Internal server error' });
-  }
-};
-
-// Placeholder for comment functions
+    // Delete using Prisma
+    await prisma.forum_posts.delete({
+      where: { id },
+    });
+
+    res.status(204).send();
+  } catch (err) {
+    // Prisma throws when record not found
+    if (err.code === 'P2025') {
+      return res.status(404).json({ error: 'Forum post not found' });
+    }
+    console.error('Server error:', err);
+    res.status(500).json({ error: 'Internal server error' });
+  }
+};
+
+// Comment Functions
 const createComment = async (req, res) => {
   const { postId } = req.params;
@@ -104,24 +139,27 @@
 
   try {
-    const { data, error } = await supabase
-      .from('comments')
-      .insert([
-        {
-          post_id: postId,
-          content,
-          author_id: authorId,
-          author_name: authorName,
-        },
-      ])
-      .select();
-
-    if (error) {
-      console.error('Error creating comment:', error);
-      return res.status(500).json({ error: error.message });
-    }
-
-    res
-      .status(201)
-      .json({ message: 'Comment created successfully', comment: data[0] });
+    // Create domain object first
+    const comment = new Comment({
+      content,
+      authorName,
+    });
+
+    // Store in database using Prisma
+    const savedComment = await prisma.comments.create({
+      data: {
+        post_id: postId,
+        content: comment.content,
+        author_id: authorId,
+        author_name: comment.authorName,
+      },
+    });
+
+    // Update the domain object with the generated ID
+    comment.id = savedComment.id;
+
+    res.status(201).json({
+      message: 'Comment created successfully',
+      comment: savedComment,
+    });
   } catch (err) {
     console.error('Server error:', err);
@@ -134,16 +172,26 @@
 
   try {
-    const { data, error } = await supabase
-      .from('comments')
-      .select('*')
-      .eq('post_id', postId)
-      .order('date_created', { ascending: false });
-
-    if (error) {
-      console.error('Error fetching comments:', error);
-      return res.status(500).json({ error: error.message });
-    }
-
-    res.status(200).json(data);
+    // Use Prisma to fetch comments
+    const dbComments = await prisma.comments.findMany({
+      where: {
+        post_id: postId,
+      },
+      orderBy: {
+        dateCreated: 'desc',
+      },
+    });
+
+    // Convert to domain objects
+    const comments = dbComments.map(
+      (comment) =>
+        new Comment({
+          id: comment.id,
+          content: comment.content,
+          authorName: comment.author_name,
+          dateCreated: comment.dateCreated,
+        })
+    );
+
+    res.status(200).json(comments);
   } catch (err) {
     console.error('Server error:', err);
@@ -157,23 +205,26 @@
 
   try {
-    const { data, error } = await supabase
-      .from('comments')
-      .update({ content })
-      .eq('id', commentId)
-      .select();
-
-    if (error) {
-      console.error('Error updating comment:', error);
-      return res.status(500).json({ error: error.message });
-    }
-
-    if (!data || data.length === 0) {
+    // Update using Prisma
+    const updatedComment = await prisma.comments.update({
+      where: { id: commentId },
+      data: { content },
+    });
+
+    // Create domain object from updated data
+    const comment = new Comment({
+      id: updatedComment.id,
+      content: updatedComment.content,
+      authorName: updatedComment.author_name,
+      dateCreated: updatedComment.dateCreated,
+    });
+
+    res.status(200).json({
+      message: 'Comment updated successfully',
+      comment,
+    });
+  } catch (err) {
+    if (err.code === 'P2025') {
       return res.status(404).json({ error: 'Comment not found' });
     }
-
-    res
-      .status(200)
-      .json({ message: 'Comment updated successfully', comment: data[0] });
-  } catch (err) {
     console.error('Server error:', err);
     res.status(500).json({ error: 'Internal server error' });
@@ -185,16 +236,14 @@
 
   try {
-    const { error } = await supabase
-      .from('comments')
-      .delete()
-      .eq('id', commentId);
-
-    if (error) {
-      console.error('Error deleting comment:', error);
-      return res.status(500).json({ error: error.message });
-    }
-
-    res.status(204).send(); // No content to send back on successful deletion
-  } catch (err) {
+    // Delete using Prisma
+    await prisma.comments.delete({
+      where: { id: commentId },
+    });
+
+    res.status(204).send();
+  } catch (err) {
+    if (err.code === 'P2025') {
+      return res.status(404).json({ error: 'Comment not found' });
+    }
     console.error('Server error:', err);
     res.status(500).json({ error: 'Internal server error' });
Index: backend/lib/prisma.js
===================================================================
--- backend/lib/prisma.js	(revision 074a70e4190d3d24571f1f134621f2dde3572fdd)
+++ backend/lib/prisma.js	(revision 074a70e4190d3d24571f1f134621f2dde3572fdd)
@@ -0,0 +1,3 @@
+const { PrismaClient } = require('../generated/prisma');
+const prisma = new PrismaClient();
+module.exports = prisma;
Index: backend/prisma/schema.prisma
===================================================================
--- backend/prisma/schema.prisma	(revision 074a70e4190d3d24571f1f134621f2dde3572fdd)
+++ backend/prisma/schema.prisma	(revision 074a70e4190d3d24571f1f134621f2dde3572fdd)
@@ -0,0 +1,50 @@
+generator client {
+  provider = "prisma-client-js"
+  output   = "../generated/prisma"
+}
+
+datasource db {
+  provider = "postgresql"
+  url      = env("DATABASE_URL")
+}
+
+/// This model contains row level security and requires additional setup for migrations. Visit https://pris.ly/d/row-level-security for more info.
+model comments {
+  id          String       @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
+  dateCreated DateTime     @default(now()) @db.Timestamptz(6)
+  post_id     String?      @default(dbgenerated("gen_random_uuid()")) @db.Uuid
+  content     String?      @default("")
+  author_id   String?      @default(dbgenerated("gen_random_uuid()")) @db.Uuid
+  author_name String?
+  users       users?       @relation(fields: [author_id], references: [id], onDelete: Cascade)
+  forum_posts forum_posts? @relation(fields: [post_id], references: [id], onDelete: Cascade)
+}
+
+/// This model contains row level security and requires additional setup for migrations. Visit https://pris.ly/d/row-level-security for more info.
+model forum_posts {
+  id           String     @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
+  title        String     @default("")
+  content      String?    @default("")
+  author_id    String?    @default(dbgenerated("gen_random_uuid()")) @db.Uuid
+  author_name  String?
+  date_created DateTime?  @default(now()) @db.Date
+  comments     comments[]
+  users        users?     @relation(fields: [author_id], references: [id], onDelete: Restrict, onUpdate: Restrict)
+}
+
+model users {
+  id                  String        @id @default(dbgenerated("auth.uid()")) @db.Uuid
+  username            String        @unique
+  email               String        @unique
+  name                String?
+  solved_problems     BigInt?       @default(0)
+  rank                String?       @default("Novice")
+  points              BigInt?       @default(0)
+  commentCounter      Int?          @default(3) @db.SmallInt
+  commentCheckCounter Int?          @default(0) @db.SmallInt
+  postCounter         Int?          @default(3) @db.SmallInt
+  postCheckCounter    Int?          @default(0) @db.SmallInt
+  isModerator         Boolean       @default(false)
+  comments            comments[]
+  forum_posts         forum_posts[]
+}
Index: client/src/Dashboard/components/Forum.jsx
===================================================================
--- client/src/Dashboard/components/Forum.jsx	(revision cd1607eacc1ded866289d91af60680023b374572)
+++ client/src/Dashboard/components/Forum.jsx	(revision 074a70e4190d3d24571f1f134621f2dde3572fdd)
@@ -1,6 +1,6 @@
-import React, { useState, useEffect } from "react";
-import { useNavigate } from "react-router-dom";
-import commentIcon from "../../assets/images/comment.svg";
-import likeIcon from "../../assets/images/like.svg";
+import React, { useState, useEffect } from 'react';
+import { useNavigate } from 'react-router-dom';
+import commentIcon from '../../assets/images/comment.svg';
+import likeIcon from '../../assets/images/like.svg';
 
 const Forum = ({ setActivePage }) => {
@@ -33,5 +33,5 @@
       }
     } catch (error) {
-      console.error("Error fetching forum posts:", error);
+      console.error('Error fetching forum posts:', error);
     }
   };
@@ -42,5 +42,5 @@
 
   return (
-    <div className="flex flex-col md:flex-row gap-6 p-6">
+    <div className="flex flex-col md:flex-row gap-6 p-6 h-full overflow-y-auto">
       {/* Forum Posts */}
       <div className="flex-1">
@@ -83,5 +83,5 @@
         <div className=" flex items-center justify-center">
           <button
-            onClick={() => navigate("/create-post")}
+            onClick={() => navigate('/create-post')}
             className="cursor-pointer px-6 py-3 bg-yellow-500 text-black rounded hover:bg-yellow-600"
           >
