Index: backend/controllers/forumController.js
===================================================================
--- backend/controllers/forumController.js	(revision 77de066dd2d6073aad3a748111f649eed086b4c9)
+++ backend/controllers/forumController.js	(revision 10b8857ea302c5035ed7a0b075edf17d5aadb7cc)
@@ -62,4 +62,5 @@
           authorName: post.author_name,
           dateCreated: post.date_created,
+          commentCount: post.comment_count,
         })
     );
@@ -147,8 +148,9 @@
     // Create domain object first
     const comment = new Comment({
-      content,
-      authorName,
-    });
-
+      content: content,
+      authorName: authorName,
+      authorId: authorId,
+    });
+    console.log(comment);
     // Store in database using Prisma
     const savedComment = await prisma.comments.create({
@@ -160,4 +162,8 @@
       },
     });
+    await prisma.forum_posts.update({
+      where: { id: post_id },
+      data: { comment_count: { increment: 1 } },
+    });
 
     // Update the domain object with the generated ID
@@ -200,5 +206,6 @@
           content: comment.content,
           authorName: comment.author_name,
-          dateCreated: comment.date_created,
+          dateCreated: comment.dateCreated,
+          authorId: comment.author_id,
         })
     );
@@ -247,8 +254,26 @@
 
   try {
-    // Delete using Prisma
+    // First get the comment to find its post_id
+    const comment = await prisma.comments.findUnique({
+      where: { id: commentId },
+      select: { post_id: true },
+    });
+
+    if (!comment) {
+      return res.status(404).json({ error: 'Comment not found' });
+    }
+
+    // Delete the comment
     await prisma.comments.delete({
       where: { id: commentId },
     });
+
+    // Update comment count if post_id exists
+    if (comment.post_id) {
+      await prisma.forum_posts.update({
+        where: { id: comment.post_id },
+        data: { comment_count: { decrement: 1 } },
+      });
+    }
 
     res.status(204).send();
Index: backend/models/Comment.js
===================================================================
--- backend/models/Comment.js	(revision 77de066dd2d6073aad3a748111f649eed086b4c9)
+++ backend/models/Comment.js	(revision 10b8857ea302c5035ed7a0b075edf17d5aadb7cc)
@@ -5,4 +5,5 @@
     this.authorName = data.authorName;
     this.dateCreated = new Date();
+    this.authorId = data.authorId;
   }
 }
Index: backend/models/ForumPost.js
===================================================================
--- backend/models/ForumPost.js	(revision 77de066dd2d6073aad3a748111f649eed086b4c9)
+++ backend/models/ForumPost.js	(revision 10b8857ea302c5035ed7a0b075edf17d5aadb7cc)
@@ -7,4 +7,5 @@
     this.dateCreated = new Date();
     this.comments = [];
+    this.comment_count = data.commentCount || 0;
   }
 }
Index: backend/prisma/schema.prisma
===================================================================
--- backend/prisma/schema.prisma	(revision 77de066dd2d6073aad3a748111f649eed086b4c9)
+++ backend/prisma/schema.prisma	(revision 10b8857ea302c5035ed7a0b075edf17d5aadb7cc)
@@ -29,4 +29,5 @@
   author_name  String?
   date_created DateTime?  @default(now()) @db.Date
+  comment_count Int       @default(0) 
   comments     comments[]
   users        users?     @relation(fields: [author_id], references: [id], onDelete: Restrict, onUpdate: Restrict)
Index: client/src/CreatePost/CreatePost.jsx
===================================================================
--- client/src/CreatePost/CreatePost.jsx	(revision 77de066dd2d6073aad3a748111f649eed086b4c9)
+++ client/src/CreatePost/CreatePost.jsx	(revision 10b8857ea302c5035ed7a0b075edf17d5aadb7cc)
@@ -33,5 +33,5 @@
           content,
           authorId: user.id,
-          authorName: user.name,
+          authorName: user.username,
         }),
       });
Index: client/src/Dashboard/Dashboard.jsx
===================================================================
--- client/src/Dashboard/Dashboard.jsx	(revision 77de066dd2d6073aad3a748111f649eed086b4c9)
+++ client/src/Dashboard/Dashboard.jsx	(revision 10b8857ea302c5035ed7a0b075edf17d5aadb7cc)
@@ -165,5 +165,5 @@
             />
             <div className="flex flex-col items-start">
-              <span className="font-medium text-left">{user.username}</span>
+              <span className="font-medium text-left">{user.name}</span>
               <span className="text-sm text-base-content/70">{user.rank}</span>
             </div>
Index: client/src/Dashboard/components/Forum.jsx
===================================================================
--- client/src/Dashboard/components/Forum.jsx	(revision 77de066dd2d6073aad3a748111f649eed086b4c9)
+++ client/src/Dashboard/components/Forum.jsx	(revision 10b8857ea302c5035ed7a0b075edf17d5aadb7cc)
@@ -2,5 +2,5 @@
 import { useNavigate } from 'react-router-dom';
 import commentIcon from '../../assets/images/comment.svg';
-import trashIcon from '../../assets/images/delete.svg'; // Add this import
+import trashIcon from '../../assets/images/delete.svg';
 
 const Forum = ({ setActivePage, onPostClick }) => {
@@ -137,4 +137,5 @@
                 }}
               >
+                <p className="mr-4">{post.comment_count}</p>
                 <img
                   src={commentIcon}
@@ -159,5 +160,5 @@
         <div className="flex flex-row justify-end p-6 rounded-lg shadow-md">
           <button
-            onClick={() => navigate('/create-post')}
+            onClick={() => setActivePage('createPost')}
             className="cursor-pointer px-6 py-3 bg-yellow-500 text-black rounded hover:bg-yellow-600"
           >
Index: client/src/Dashboard/components/ForumPostDetail.jsx
===================================================================
--- client/src/Dashboard/components/ForumPostDetail.jsx	(revision 77de066dd2d6073aad3a748111f649eed086b4c9)
+++ client/src/Dashboard/components/ForumPostDetail.jsx	(revision 10b8857ea302c5035ed7a0b075edf17d5aadb7cc)
@@ -1,4 +1,4 @@
 import React, { useEffect, useState } from 'react';
-
+import trashIcon from '../../assets/images/delete.svg';
 const ForumPostDetail = ({ post, onBack }) => {
   const [comments, setComments] = useState([]);
@@ -7,4 +7,5 @@
   const [commentText, setCommentText] = useState('');
   const [posting, setPosting] = useState(false);
+  const user = JSON.parse(localStorage.getItem('user'));
 
   useEffect(() => {
@@ -26,5 +27,24 @@
       });
   }, [post]);
-
+  const handleDeleteComment = async (commentId) => {
+    try {
+      const response = await fetch(`/forum/comments/${commentId}`, {
+        method: 'DELETE',
+        headers: {
+          'Content-Type': 'application/json',
+        },
+      });
+      if (!response.ok) {
+        throw new Error(`HTTP error! status: ${response.status}`);
+      }
+      // Remove the deleted post from the state
+      setComments((prevComments) =>
+        prevComments.filter((comment) => comment.id !== commentId)
+      );
+      console.log('Post deleted successfully');
+    } catch (error) {
+      console.error('Error deleting post:', error);
+    }
+  };
   const handleSubmit = async (e) => {
     e.preventDefault();
@@ -41,6 +61,6 @@
           post_id: post.id,
           content: commentText,
-          authorId: user?.id,
-          authorName: user?.username,
+          authorId: user.id,
+          authorName: user.username,
         }),
       });
@@ -115,23 +135,53 @@
                 <div className="text-red-500 p-3">{error}</div>
               ) : comments.length > 0 ? (
-                comments.map((comment, idx) => (
-                  <div
-                    key={comment.id || idx}
-                    className="p-4 rounded-lg bg-base-200 border border-base-300"
-                  >
-                    <div className="flex items-center gap-2 mb-1">
-                      <span className="font-semibold text-base-content">
-                        {comment.authorName}
-                      </span>
-                      <span className="text-xs text-base-content/60">
-                        {comment.dateCreated
-                          ? new Date(comment.dateCreated).toLocaleString()
-                          : ''}
-                      </span>
-                    </div>
-                    <div className="text-base-content/80 text-base break-words">
-                      {comment.content}
-                    </div>
-                  </div>
+                (console.log(comments),
+                comments.map(
+                  (comment, idx) => (
+                    console.log(comment),
+                    (
+                      <div
+                        key={comment.id || idx}
+                        className="p-4 rounded-lg bg-base-200 border border-base-300"
+                      >
+                        <div className="flex relative items-center gap-2 mb-1">
+                          {comment.authorId === user.id && (
+                            <button
+                              className=" absolute top-2 right-2 p-1.5 cursor-pointer rounded-full hover:bg-gray-600 transition-colors"
+                              onClick={(e) => {
+                                e.stopPropagation();
+                                // Here you would add the delete confirmation and logic
+                                if (
+                                  window.confirm(
+                                    'Are you sure you want to delete this comment?'
+                                  )
+                                ) {
+                                  // Call your delete comment function here
+                                  console.log('Delete comment:', comment.id);
+                                }
+                                handleDeleteComment(comment.id);
+                              }}
+                            >
+                              <img
+                                src={trashIcon}
+                                alt="Delete"
+                                className="w-6 h-6"
+                              />
+                            </button>
+                          )}
+                          <span className="font-semibold text-base-content">
+                            {comment.authorName}
+                          </span>
+                          <span className="text-xs text-base-content/60">
+                            {comment.dateCreated
+                              ? new Date(comment.dateCreated).toLocaleString()
+                              : ''}
+                          </span>
+                        </div>
+                        <div className="text-base-content/80 text-base break-words">
+                          {comment.content}
+                        </div>
+                      </div>
+                    )
+                  )
                 ))
               ) : (
