Index: backend/controllers/taskController.js
===================================================================
--- backend/controllers/taskController.js	(revision 1f399913e2fcb2395d19692d69b98b779940ede9)
+++ backend/controllers/taskController.js	(revision ce371e5a1f811d4ff62f84fbd74dbef9a2b668f3)
@@ -4,11 +4,32 @@
 const getTaskByDate = async (req, res) => {
     const { date } = req.params;
-
+    
     try {
-        const tasks = await prisma.challenges.findMany({
+        let tasks = await prisma.challenges.findMany({
             where: {
-                date: new Date(date),
+                solving_date: {
+                    gte: new Date(new Date(date).setHours(0, 0, 0, 0)),
+                    lt: new Date(new Date(date).setHours(23, 59, 59, 999))
+                },
+            },
+            include: {
+                test_cases: true 
             },
         });
+        
+        if (tasks.length === 0) {
+            tasks = await prisma.challenges.findMany({
+                where: {
+                    expired: false
+                },
+                orderBy: {
+                    solving_date: 'desc'
+                },
+                take: 1,
+                include: {
+                    test_cases: true // Include test cases data
+                },
+            });
+        }
 
         if (tasks.length === 0) {
@@ -16,8 +37,41 @@
         }
 
-        res.status(200).json(tasks);
+        const safeSerialize = (data) => {
+            return JSON.parse(JSON.stringify(data, (key, value) => {
+                if (value instanceof Date) {
+                    return value.toISOString();
+                }
+                if (typeof value === 'bigint') {
+                    return value.toString();
+                }
+                return value;
+            }));
+        };
+        
+        const processedTasks = tasks.map(task => {
+            const safeTask = safeSerialize(task);
+            
+            if (safeTask.test_cases) {
+                safeTask.test_cases = safeTask.test_cases.map(testCase => ({
+                    id: testCase.id,
+                    input: testCase.input || '',
+                    output: testCase.output || '',
+                    post_id: testCase.post_id
+                }));
+            }
+            
+            return safeTask;
+        });
+        
+        res.setHeader('Content-Type', 'application/json');
+        res.status(200).json(processedTasks);
     } catch (error) {
         console.error('Error fetching tasks:', error);
-        res.status(500).json({ message: 'Internal server error' });
+        
+        res.status(500).json({ 
+            message: 'Internal server error', 
+            error: error.message,
+            stack: process.env.NODE_ENV === 'development' ? error.stack : undefined
+        });
     }
 }
@@ -27,13 +81,36 @@
 
     try {
+        // Check if id is a UUID (string) or numeric
+        const where = {};
+        if (id.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i)) {
+            where.id = id;
+        } else {
+            try {
+                where.id = parseInt(id);
+            } catch (e) {
+                where.id = id; // If parsing fails, use as is
+            }
+        }
+
         const updatedTask = await prisma.challenges.update({
-            where: { id: parseInt(id) },
-            data: { attempts: { increment: 1 } },
+            where: where,
+            data: { 
+                attempted_by: { increment: 1 } 
+            },
         });
 
-        res.status(200).json(updatedTask);
+        // Convert BigInt to string for JSON response
+        const result = { ...updatedTask };
+        if (typeof result.attempted_by === 'bigint') {
+            result.attempted_by = result.attempted_by.toString();
+        }
+        if (typeof result.solved_by === 'bigint') {
+            result.solved_by = result.solved_by.toString();
+        }
+
+        res.status(200).json(result);
     } catch (error) {
         console.error('Error updating task attempts:', error);
-        res.status(500).json({ message: 'Internal server error' });
+        res.status(500).json({ message: 'Internal server error', error: error.message });
     }
 }
@@ -43,13 +120,36 @@
 
     try {
+        // Check if id is a UUID (string) or numeric
+        const where = {};
+        if (id.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i)) {
+            where.id = id;
+        } else {
+            try {
+                where.id = parseInt(id);
+            } catch (e) {
+                where.id = id; // If parsing fails, use as is
+            }
+        }
+
         const updatedTask = await prisma.challenges.update({
-            where: { id: parseInt(id) },
-            data: { solved_by: { increment: 1 } },
+            where: where,
+            data: { 
+                solved_by: { increment: 1 } 
+            },
         });
 
-        res.status(200).json(updatedTask);
+        // Convert BigInt to string for JSON response
+        const result = { ...updatedTask };
+        if (typeof result.attempted_by === 'bigint') {
+            result.attempted_by = result.attempted_by.toString();
+        }
+        if (typeof result.solved_by === 'bigint') {
+            result.solved_by = result.solved_by.toString();
+        }
+
+        res.status(200).json(result);
     } catch (error) {
-        console.error('Error updating task attempts:', error);
-        res.status(500).json({ message: 'Internal server error' });
+        console.error('Error updating task solved count:', error);
+        res.status(500).json({ message: 'Internal server error', error: error.message });
     }
 }
Index: backend/prisma/schema.prisma
===================================================================
--- backend/prisma/schema.prisma	(revision 1f399913e2fcb2395d19692d69b98b779940ede9)
+++ backend/prisma/schema.prisma	(revision ce371e5a1f811d4ff62f84fbd74dbef9a2b668f3)
@@ -46,34 +46,33 @@
 
 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)
-  started_challenge_at DateTime?        @default(now()) @db.Timestamptz(6)
-  comments             comments[]
-  forum_posts          forum_posts[]
-  to_be_reviewed       to_be_reviewed[]
+  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)
+  attempts            Int?             @default(0) @db.SmallInt
+  comments            comments[]
+  forum_posts         forum_posts[]
+  to_be_reviewed      to_be_reviewed[]
 }
 
 /// This model contains row level security and requires additional setup for migrations. Visit https://pris.ly/d/row-level-security for more info.
 model challenges {
-  id             String       @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
-  solving_date   DateTime     @db.Timestamptz(6)
-  title          String?
-  content        String?
-  example_input  String?
-  example_output String?
-  attempted_by   Int?         @db.SmallInt
-  solved_by      Int?         @db.SmallInt
-  expired        Boolean?
-  test_cases     test_cases[]
+  id           String       @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
+  solving_date DateTime     @db.Date
+  title        String?
+  content      String?
+  attempted_by Int?         @db.SmallInt
+  solved_by    Int?         @db.SmallInt
+  expired      Boolean?
+  examples     Json?
+  test_cases   test_cases[]
 }
 
Index: backend/routers/taskRouter.js
===================================================================
--- backend/routers/taskRouter.js	(revision 1f399913e2fcb2395d19692d69b98b779940ede9)
+++ backend/routers/taskRouter.js	(revision ce371e5a1f811d4ff62f84fbd74dbef9a2b668f3)
@@ -3,5 +3,7 @@
 const taskController = require('../controllers/taskController');
 
-router.get('/task/:date', taskController.getTaskByDate);
-router.put('/task/:id', taskController.updateAttemptsTask);
-router.put('/task/:id', taskController.updateSolvedTask);
+router.get('/:date', taskController.getTaskByDate);
+router.put('/:id/attempts', taskController.updateAttemptsTask);
+router.put('/:id/solved', taskController.updateSolvedTask);
+
+module.exports = router;
Index: client/src/Dashboard/components/Task.jsx
===================================================================
--- client/src/Dashboard/components/Task.jsx	(revision 1f399913e2fcb2395d19692d69b98b779940ede9)
+++ client/src/Dashboard/components/Task.jsx	(revision ce371e5a1f811d4ff62f84fbd74dbef9a2b668f3)
@@ -1,15 +1,68 @@
-import React, { useState } from 'react';
-import Navbar from './Navbar';
-import {useNavigate} from "react-router-dom";
+import React, { useState } from "react";
+import Navbar from "./Navbar";
+import { useNavigate } from "react-router-dom";
 
 const Task = () => {
   const [showTask, setShowTask] = useState(false);
+  const [task, setTask] = useState(null);
   const today = new Date().toLocaleDateString();
-  const user = JSON.parse(localStorage.getItem('user')) || { attempts: 0 };
+  const user = JSON.parse(localStorage.getItem("user")) || { attempts: 0 };
   const navigate = useNavigate();
-  const userOutput = document.getElementById('userOutput')?.value || '';
-
-  function fetchTaskForToday(date) {
-
+  const userOutput = document.getElementById("userOutput")?.value || "";
+
+  async function fetchTaskForToday(date) {
+    try {
+      const formattedDate = new Date(date).toISOString().split("T")[0];
+      console.log("Fetching task for date:", formattedDate);
+
+      const response = await fetch(`/task/${formattedDate}`, {
+        headers: {
+          Accept: "application/json",
+          "Cache-Control": "no-cache",
+        },
+      });
+
+      if (!response.ok) {
+        throw new Error(`HTTP error! status: ${response.status}`);
+      }
+
+      const responseText = await response.text();
+
+      let data;
+      try {
+        data = JSON.parse(responseText);
+      } catch (parseError) {
+        throw new Error("Failed to parse server response as JSON");
+      }
+
+      if (Array.isArray(data) && data.length > 0) {
+        const taskData = data[0];
+        console.log("Processing task data:", taskData);
+
+        setTask({
+          id: taskData.id,
+          title: taskData.title || "Daily Challenge",
+          content: taskData.content || "No description available",
+          examples: taskData.examples || [], // Use examples directly from the API response
+        });
+
+        console.log("Fetched task:", taskData);
+      } else {
+        console.error("No tasks found for the date");
+        setTask({
+          title: "No Challenge Available",
+          content: "There is no challenge available for today.",
+          examples: [{ input: "N/A", output: "N/A" }],
+        });
+      }
+    } catch (error) {
+      console.error("Error fetching task:", error);
+      setTask({
+        title: "Error Loading Challenge",
+        content:
+          "There was an error loading today's challenge. Please try again later.",
+        examples: [{ input: "N/A", output: "N/A" }],
+      });
+    }
   }
 
@@ -23,8 +76,9 @@
       attempts: (user.attempts || 0) + 1,
     };
-
     localStorage.setItem("user", JSON.stringify(updatedUser));
-  }
-  function getMinutesSinceSevenAM(){
+    return updatedUser;
+  }
+
+  function getMinutesSinceSevenAM() {
     const now = new Date();
     const sevenAM = new Date();
@@ -33,19 +87,27 @@
     return Math.floor(diffMs / (1000 * 60)); // Convert to full minutes
   }
+
   function getTimeBonus() {
     const minutes = getMinutesSinceSevenAM();
     return Math.max(0, 60 - Math.floor(minutes * 0.0833));
   }
+
   function getAttemptScore(user) {
     const attempts = user.attempts || 0;
 
     switch (attempts) {
-      case 0: return 40;
-      case 1: return 30;
-      case 2: return 20;
-      case 3: return 10;
-      default: return 0;
-    }
-  }
+      case 0:
+        return 40;
+      case 1:
+        return 30;
+      case 2:
+        return 20;
+      case 3:
+        return 10;
+      default:
+        return 0;
+    }
+  }
+
   function resetAttempts(user) {
     const updatedUser = {
@@ -53,7 +115,8 @@
       attempts: 0,
     };
-
     localStorage.setItem("user", JSON.stringify(updatedUser));
-  }
+    return updatedUser;
+  }
+
   function calculateTotalScore(user) {
     return getTimeBonus() + getAttemptScore(user);
@@ -65,23 +128,79 @@
       points: (user.points || 0) + score,
     };
-
     localStorage.setItem("user", JSON.stringify(updatedUser));
-  }
-
-  function handleSubmit() {
-    if(userOutput === testCase.output){
-        incrementAttempts(user);
-        const score = calculateTotalScore(user);
-        incrementUserScore(user,score)
-        alert(`Correct! Your score is ${score} and your total points are now ${user.points}`);
-        resetAttempts(user);
-        navigate('/dashboard/forum');
-    }
-    else{
-        incrementAttempts(user);
-        alert(`Incorrect! Try again`);
-    }
-  }
-
+    return updatedUser;
+  }
+
+  async function updateTaskAttempts() {
+    if (!task || !task.id) return;
+
+    try {
+      // Update task attempts count on the server
+      await fetch(`/task/${task.id}/attempts`, {
+        method: "PUT",
+        headers: {
+          "Content-Type": "application/json",
+        },
+      });
+    } catch (error) {
+      console.error("Error updating task attempts:", error);
+    }
+  }
+
+  async function updateTaskSolved() {
+    if (!task || !task.id) return;
+
+    try {
+      await fetch(`/task/${task.id}/solved`, {
+        method: "PUT",
+        headers: {
+          "Content-Type": "application/json",
+        },
+      });
+    } catch (error) {
+      console.error("Error updating task solved count:", error);
+    }
+  }
+
+  async function handleSubmitSolution() {
+    if (!task || !task.examples || task.examples.length === 0) {
+      alert("No challenge is currently available");
+      return;
+    }
+
+    const userOutputElement = document.getElementById("userOutput");
+    const userOutputValue = userOutputElement ? userOutputElement.value : "";
+
+    const expectedOutput = task.examples[0].output;
+
+    let currentUser = JSON.parse(localStorage.getItem("user")) || {
+      attempts: 0,
+      points: 0,
+    };
+
+    await updateTaskAttempts();
+
+    if (userOutputValue === expectedOutput) {
+      currentUser = incrementAttempts(currentUser);
+
+      const score = calculateTotalScore(currentUser);
+
+      currentUser = incrementUserScore(currentUser, score);
+
+      await updateTaskSolved();
+
+      currentUser = resetAttempts(currentUser);
+
+      alert(
+        `Correct! Your score is ${score} points. Your total points are now ${currentUser.points}.`
+      );
+
+      navigate("/dashboard/forum");
+    } else {
+      currentUser = incrementAttempts(currentUser);
+
+      alert(`Incorrect! Try again. This is attempt #${currentUser.attempts}.`);
+    }
+  }
 
   return (
@@ -179,41 +298,51 @@
               </div>
 
-              <div className="card bg-base-300 mb-8">
-                <div className="card-body">
-                  <h2 className="card-title mb-4">Problem: String Reversal</h2>
-                  <p className="text-lg leading-relaxed">
-                    Write a function that takes a string as input and returns
-                    its reverse. You must implement this manually without using
-                    built-in reverse functions or shortcuts like Python's [::-1]
-                    slicing.
-                  </p>
-                </div>
-              </div>
-
-              <div className="grid grid-cols-1 md:grid-cols-2 gap-6 mb-8">
-                <div className="card bg-primary/5">
-                  <div className="card-body">
-                    <h3 className="card-title text-primary">Your Input</h3>
-                    <div className="text-2xl font-mono mt-2">"ANDREJ"</div>
-                    <p className="text-sm mt-2 text-base-content/70">
-                      Use this input in your local editor
-                    </p>
-                  </div>
-                </div>
-
-                <div className="card bg-base-300">
-                  <div className="card-body">
-                    <h3 className="card-title">Example</h3>
-                    <div className="space-y-2 mt-2">
-                      <p className="font-mono">
-                        Input: "hello" → Output: "olleh"
-                      </p>
-                      <p className="font-mono">
-                        Input: "world" → Output: "dlrow"
+              {task ? (
+                <>
+                  <div className="card bg-base-300 mb-8">
+                    <div className="card-body">
+                      <h2 className="card-title mb-4">
+                        Problem: {task.title || "Daily Challenge"}
+                      </h2>
+                      <p className="text-lg leading-relaxed">
+                        {task.content || "No description available"}
                       </p>
                     </div>
                   </div>
-                </div>
-              </div>
+
+                  <div className="grid grid-cols-1 md:grid-cols-2 gap-6 mb-8">
+                    <div className="card bg-primary/5">
+                      <div className="card-body">
+                        <h3 className="card-title text-primary">Your Input</h3>
+                        <div className="text-2xl font-mono mt-2">"ANDREJ"</div>
+                        <p className="text-sm mt-2 text-base-content/70">
+                          Use this input in your local editor
+                        </p>
+                      </div>
+                    </div>
+
+                    <div className="card bg-base-300">
+                      <div className="card-body">
+                        <h3 className="card-title">Example</h3>
+                        <div className="space-y-2 mt-2">
+                          {task.examples.map((element, index) => {
+                            console.log("Rendering example:", element);
+                            return (
+                              <p className="font-mono" key={index}>
+                                Input: "{element.input}" → Output: "
+                                {element.output}"
+                              </p>
+                            );
+                          })}
+                        </div>
+                      </div>
+                    </div>
+                  </div>
+                </>
+              ) : (
+                <div className="flex justify-center items-center py-12">
+                  <span className="loading loading-spinner loading-lg"></span>
+                </div>
+              )}
 
               <div className="card bg-base-300">
@@ -221,5 +350,5 @@
                   <h3 className="card-title mb-4">Submit Your Solution</h3>
                   <input
-                      id="userOutput"
+                    id="userOutput"
                     type="text"
                     placeholder="Enter your output here"
@@ -227,5 +356,8 @@
                   />
                   <div className="card-actions justify-end">
-                    <button className="btn border-amber-400 btn-lg" onClick={handleSubmit}>
+                    <button
+                      onClick={() => handleSubmitSolution()}
+                      className="btn border-amber-400 btn-lg"
+                    >
                       Submit Solution
                     </button>
