Index: frontend/src/App.js
===================================================================
--- frontend/src/App.js	(revision e5d5ff9cb218e6c76b1a61931d2095ae3dcf48b5)
+++ frontend/src/App.js	(revision 20468d38749c5a3ed89d6df4db22905a1d0c3df1)
@@ -2,4 +2,18 @@
 import './App.css';
 import React, { useEffect, useState } from 'react';
+import Navbar from './components/Navbar';
+import ProtectedRoute from './components/ProtectedRoute';
+import Login from './pages/Login';
+import PatientList from './pages/patients/PatientList';
+import PatientDetail from './pages/patients/PatientDetail';
+import PatientForm from './pages/patients/PatientForm';
+import DoctorList from './pages/doctors/DoctorList';
+import DoctorDetail from './pages/doctors/DoctorDetail';
+import DoctorForm from './pages/doctors/DoctorForm';v
+import AppointmentList from './pages/appointments/AppointmentList';
+import AppointmentForm from './pages/appointments/AppointmentForm';
+import DepartmentList from './pages/departments/DepartmentList';
+import DepartmentDetail from './pages/departments/DepartmentDetail';
+import DoctorsByDepartment from './pages/departments/DoctorsByDepartment';
 
 
@@ -13,4 +27,47 @@
     }
   }, []);
-}
+
+  return (
+      <Router>
+        <div className="min-h-screen bg-gray-50">
+          {user && <Navbar />}
+          <main className={user ? "container mx-auto px-4 py-8" : ""}>
+            <Routes>
+              <Route path="/login" element={<Login />} />
+
+              <Route path="/" element={
+                <ProtectedRoute>
+                  <Dashboard />
+                </ProtectedRoute>
+              } />
+
+              {/* Patient Routes */}
+              <Route path="/patients" element={<ProtectedRoute><PatientList /></ProtectedRoute>} />
+              <Route path="/patients/new" element={<ProtectedRoute><PatientForm /></ProtectedRoute>} />
+              <Route path="/patients/:id" element={<ProtectedRoute><PatientDetail /></ProtectedRoute>} />
+              <Route path="/patients/:id/edit" element={<ProtectedRoute><PatientForm /></ProtectedRoute>} />
+
+              {/* Doctor Routes */}
+              <Route path="/doctors" element={<ProtectedRoute><DoctorList /></ProtectedRoute>} />
+              <Route path="/doctors/new" element={<ProtectedRoute><DoctorForm /></ProtectedRoute>} />
+              <Route path="/doctors/:id" element={<ProtectedRoute><DoctorDetail /></ProtectedRoute>} />
+              <Route path="/doctors/:id/edit" element={<ProtectedRoute><DoctorForm /></ProtectedRoute>} />
+
+              {/* Department Routes */}
+              <Route path="/departments" element={<ProtectedRoute><DepartmentList /></ProtectedRoute>} />
+              <Route path="/departments/:departmentId" element={<ProtectedRoute><DepartmentDetail /></ProtectedRoute>} />
+              <Route path="/departments/:departmentId/doctors" element={<ProtectedRoute><DoctorsByDepartment /></ProtectedRoute>} />
+
+              {/* Appointment Routes */}
+              <Route path="/appointments" element={<ProtectedRoute><AppointmentList /></ProtectedRoute>} />
+              <Route path="/appointments/new" element={<ProtectedRoute><AppointmentForm /></ProtectedRoute>} />
+            </Routes>
+          </main>
+        </div>
+      </Router>
+  );
+
+
+
+              }
 export default App;
Index: frontend/src/pages/appointments/AppointmentForm.js
===================================================================
--- frontend/src/pages/appointments/AppointmentForm.js	(revision 20468d38749c5a3ed89d6df4db22905a1d0c3df1)
+++ frontend/src/pages/appointments/AppointmentForm.js	(revision 20468d38749c5a3ed89d6df4db22905a1d0c3df1)
@@ -0,0 +1,186 @@
+import React, { useState, useEffect } from 'react';
+import { useNavigate } from 'react-router-dom';
+import { appointmentService } from '../../services/appointmentService';
+import { patientService } from '../../services/patientService';
+import { doctorService } from '../../services/doctorService';
+import ErrorAlert from '../../components/ErrorAlert';
+import SuccessAlert from '../../components/SuccessAlert';
+
+function AppointmentForm() {
+  const navigate = useNavigate();
+  const user = JSON.parse(localStorage.getItem('user') || '{}');
+  const isPatient = user.role === 'PATIENT';
+  const isDoctor = user.role === 'DOCTOR';
+
+  const [formData, setFormData] = useState({
+    patientId: isPatient ? (user.patientId || '') : '',
+    doctorId: isDoctor ? (user.doctorId || '') : '',
+    appointmentDate: '',
+    appointmentTime: '',
+  });
+  const [patients, setPatients] = useState([]);
+  const [doctors, setDoctors] = useState([]);
+  const [error, setError] = useState(null);
+  const [success, setSuccess] = useState(null);
+  const [loading, setLoading] = useState(false);
+
+  useEffect(() => {
+    fetchData();
+  }, []);
+
+  const fetchData = async () => {
+    try {
+      // For patients, we don't need to fetch all patients
+      if (!isPatient) {
+        const patientsRes = await patientService.getAllPatients();
+        setPatients(patientsRes.data);
+      }
+
+      const doctorsRes = await doctorService.getAllDoctors();
+      setDoctors(doctorsRes.data);
+    } catch (err) {
+      setError('Failed to fetch doctors');
+    }
+  };
+
+  const handleChange = (e) => {
+    const { name, value } = e.target;
+    setFormData(prev => ({
+      ...prev,
+      [name]: value
+    }));
+  };
+
+  const handleSubmit = async (e) => {
+    e.preventDefault();
+
+    if (!formData.patientId || !formData.doctorId || !formData.appointmentDate || !formData.appointmentTime) {
+      setError('Please fill in all required fields');
+      return;
+    }
+
+    try {
+      setLoading(true);
+      await appointmentService.createAppointment({
+        patientId: parseInt(formData.patientId),
+        doctorId: parseInt(formData.doctorId),
+        appointmentDate: formData.appointmentDate,
+        appointmentTime: formData.appointmentTime,
+      });
+      setSuccess('Appointment created successfully!');
+      setTimeout(() => navigate('/appointments'), 1500);
+    } catch (err) {
+      setError(err.response?.data?.error || 'Failed to create appointment');
+    } finally {
+      setLoading(false);
+    }
+  };
+
+  return (
+    <div className="max-w-2xl mx-auto">
+      <h1 className="text-3xl font-bold mb-6">Create Appointment</h1>
+
+      {error && <ErrorAlert message={error} onClose={() => setError(null)} />}
+      {success && <SuccessAlert message={success} onClose={() => setSuccess(null)} />}
+
+      <form onSubmit={handleSubmit} className="bg-white rounded-lg shadow p-6 space-y-4">
+        {isPatient ? (
+          <div className="bg-blue-50 rounded-lg p-4 mb-4">
+            <p className="text-sm text-gray-700">
+              <strong>Patient:</strong> {user.firstName} {user.lastName} ({user.username})
+            </p>
+          </div>
+        ) : (
+          <div>
+            <label className="block text-sm font-semibold mb-2">Patient *</label>
+            <select
+              name="patientId"
+              value={formData.patientId}
+              onChange={handleChange}
+              className="w-full px-4 py-2 border rounded-lg"
+              required
+            >
+              <option value="">Select Patient</option>
+              {patients.map(patient => (
+                <option key={patient.patientId} value={patient.patientId}>
+                  {patient.firstName} {patient.lastName} ({patient.embg})
+                </option>
+              ))}
+            </select>
+          </div>
+        )}
+
+        {isDoctor ? (
+          <div>
+            <label className="block text-sm font-semibold mb-2">Doctor</label>
+            <p className="px-4 py-2 bg-gray-100 rounded-lg text-gray-700">
+              Dr. {user.firstName} {user.lastName}
+            </p>
+          </div>
+        ) : (
+          <div>
+            <label className="block text-sm font-semibold mb-2">Doctor *</label>
+            <select
+              name="doctorId"
+              value={formData.doctorId}
+              onChange={handleChange}
+              className="w-full px-4 py-2 border rounded-lg"
+              required
+            >
+              <option value="">Select Doctor</option>
+              {doctors.map(doctor => (
+                <option key={doctor.doctorId} value={doctor.doctorId}>
+                  Dr. {doctor.firstName} {doctor.lastName}
+                </option>
+              ))}
+            </select>
+          </div>
+        )}
+
+        <div className="grid grid-cols-2 gap-4">
+          <div>
+            <label className="block text-sm font-semibold mb-2">Appointment Date *</label>
+            <input
+              type="date"
+              name="appointmentDate"
+              value={formData.appointmentDate}
+              onChange={handleChange}
+              className="w-full px-4 py-2 border rounded-lg"
+              required
+            />
+          </div>
+          <div>
+            <label className="block text-sm font-semibold mb-2">Appointment Time *</label>
+            <input
+              type="time"
+              name="appointmentTime"
+              value={formData.appointmentTime}
+              onChange={handleChange}
+              className="w-full px-4 py-2 border rounded-lg"
+              required
+            />
+          </div>
+        </div>
+
+        <div className="flex gap-4 pt-4">
+          <button
+            type="submit"
+            disabled={loading}
+            className="bg-purple-600 text-white px-6 py-2 rounded hover:bg-purple-700 disabled:opacity-50"
+          >
+            {loading ? 'Creating...' : 'Create Appointment'}
+          </button>
+          <button
+            type="button"
+            onClick={() => navigate('/appointments')}
+            className="bg-gray-300 text-gray-700 px-6 py-2 rounded hover:bg-gray-400"
+          >
+            Cancel
+          </button>
+        </div>
+      </form>
+    </div>
+  );
+}
+
+export default AppointmentForm;
Index: frontend/src/pages/appointments/AppointmentList.js
===================================================================
--- frontend/src/pages/appointments/AppointmentList.js	(revision 20468d38749c5a3ed89d6df4db22905a1d0c3df1)
+++ frontend/src/pages/appointments/AppointmentList.js	(revision 20468d38749c5a3ed89d6df4db22905a1d0c3df1)
@@ -0,0 +1,128 @@
+import React, { useState, useEffect } from 'react';
+import { Link, useSearchParams } from 'react-router-dom';
+import { appointmentService } from '../../services/appointmentService';
+import Loading from '../../components/Loading';
+import ErrorAlert from '../../components/ErrorAlert';
+
+function AppointmentList() {
+  const [appointments, setAppointments] = useState([]);
+  const [loading, setLoading] = useState(true);
+  const [error, setError] = useState(null);
+  const [searchParams] = useSearchParams();
+  const doctorId = searchParams.get('doctorId');
+  const patientId = searchParams.get('patientId');
+  const user = JSON.parse(localStorage.getItem('user') || '{}');
+
+  useEffect(() => {
+    fetchAppointments();
+  }, [doctorId, patientId]);
+
+  const fetchAppointments = async () => {
+    try {
+      setLoading(true);
+      let response;
+      if (patientId) {
+        response = await appointmentService.getAppointmentsForPatient(patientId);
+      } else if (doctorId) {
+        response = await appointmentService.getAppointmentsForDoctor(doctorId);
+      } else if (user.role === 'PATIENT') {
+        response = await appointmentService.getAppointmentsForPatient(user.patientId);
+      } else if (user.role === 'DOCTOR') {
+        response = await appointmentService.getAppointmentsForDoctor(user.doctorId);
+      } else {
+        response = await appointmentService.getAllAppointments();
+      }
+      setAppointments(response.data);
+    } catch (err) {
+      setError('Failed to fetch appointments');
+      console.error(err);
+    } finally {
+      setLoading(false);
+    }
+  };
+
+  const handleCancelAppointment = async (id) => {
+    if (window.confirm('Are you sure you want to cancel this appointment?')) {
+      try {
+        await appointmentService.cancelAppointment(id);
+        setAppointments(appointments.map(apt =>
+          apt.appointmentId === id ? { ...apt, status: 'CANCELLED' } : apt
+        ));
+      } catch (err) {
+        setError('Failed to cancel appointment');
+      }
+    }
+  };
+
+  if (loading) return <Loading />;
+
+  return (
+    <div>
+      <div className="flex justify-between items-center mb-6">
+        <h1 className="text-3xl font-bold" style={{ color: '#7c3aed' }}>
+          {patientId ? 'Patient Appointments' : doctorId ? 'My Appointments' : 'All Appointments'}
+        </h1>
+        <Link to="/appointments/new" style={{
+          display: 'inline-block',
+          background: '#bfdbfe',
+          color: '#1e1035',
+          padding: '8px 16px',
+          borderRadius: '6px',
+          textDecoration: 'none',
+          fontSize: '14px',
+          fontWeight: '400'
+        }} onMouseEnter={(e) => e.currentTarget.style.background = '#93c5fd'} onMouseLeave={(e) => e.currentTarget.style.background = '#bfdbfe'}>
+          New Appointment
+        </Link>
+      </div>
+
+      {error && <ErrorAlert message={error} onClose={() => setError(null)} />}
+
+      <div className="bg-white rounded-lg shadow overflow-hidden">
+        <table className="w-full">
+          <thead className="bg-gray-100">
+            <tr>
+              <th className="px-6 py-3 text-left text-sm font-semibold">Patient</th>
+              <th className="px-6 py-3 text-left text-sm font-semibold">Doctor</th>
+              <th className="px-6 py-3 text-left text-sm font-semibold">Date</th>
+              <th className="px-6 py-3 text-left text-sm font-semibold">Time</th>
+              <th className="px-6 py-3 text-left text-sm font-semibold">Status</th>
+              <th className="px-6 py-3 text-left text-sm font-semibold">Actions</th>
+            </tr>
+          </thead>
+          <tbody>
+            {appointments.map(appointment => (
+              <tr key={appointment.appointmentId} className="border-t hover:bg-gray-50">
+                <td className="px-6 py-3">{appointment.patient?.firstName} {appointment.patient?.lastName}</td>
+                <td className="px-6 py-3">Dr. {appointment.doctor?.firstName} {appointment.doctor?.lastName}</td>
+                <td className="px-6 py-3">{appointment.appointmentDate}</td>
+                <td className="px-6 py-3">{appointment.appointmentTime}</td>
+                <td className="px-6 py-3">
+                  <span className={`px-3 py-1 rounded text-sm font-semibold ${
+                    appointment.status === 'SCHEDULED' ? 'bg-purple-100 text-purple-800' :
+                    appointment.status === 'COMPLETED' ? 'bg-green-100 text-green-800' :
+                    'bg-red-100 text-red-800'
+                  }`}>
+                    {appointment.status}
+                  </span>
+                </td>
+                <td className="px-6 py-3">
+                  {appointment.status === 'SCHEDULED' && (
+                    <button
+                      onClick={() => handleCancelAppointment(appointment.appointmentId)}
+                      className="text-red-600 hover:underline px-3 py-2 text-sm font-medium"
+                    >
+                      Cancel
+                    </button>
+                  )}
+                </td>
+              </tr>
+            ))}
+          </tbody>
+        </table>
+      </div>
+    </div>
+  );
+}
+
+export default AppointmentList;
Index: frontend/src/pages/departments/DepartmentDetail.js
===================================================================
--- frontend/src/pages/departments/DepartmentDetail.js	(revision 20468d38749c5a3ed89d6df4db22905a1d0c3df1)
+++ frontend/src/pages/departments/DepartmentDetail.js	(revision 20468d38749c5a3ed89d6df4db22905a1d0c3df1)
@@ -0,0 +1,137 @@
+import React, { useState, useEffect } from 'react';
+import { useParams, useNavigate } from 'react-router-dom';
+import { departmentService } from '../../services/departmentService';
+import Loading from '../../components/Loading';
+import ErrorAlert from '../../components/ErrorAlert';
+
+function DepartmentDetail() {
+  const formatDepartmentName = (name) => {
+    if (!name) return 'N/A';
+    return name.replace(/_DEPT$/, '').replace(/_/g, ' ').split(' ').map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(' ');
+  };
+
+  const { departmentId } = useParams();
+  const navigate = useNavigate();
+  const [department, setDepartment] = useState(null);
+  const [doctors, setDoctors] = useState([]);
+  const [loading, setLoading] = useState(true);
+  const [error, setError] = useState(null);
+
+  useEffect(() => {
+    fetchDepartmentAndDoctors();
+  }, [departmentId]);
+
+  const fetchDepartmentAndDoctors = async () => {
+    try {
+      setLoading(true);
+
+      // Fetch department details
+      const deptResponse = await departmentService.getDepartmentById(departmentId);
+      setDepartment(deptResponse.data);
+
+      // Fetch doctors for this department
+      const doctorsResponse = await departmentService.getDoctorsByDepartment(departmentId);
+      setDoctors(doctorsResponse.data);
+    } catch (err) {
+      setError('Failed to fetch data');
+      console.error(err);
+    } finally {
+      setLoading(false);
+    }
+  };
+
+  if (loading) return <Loading />;
+
+  if (!department) {
+    return (
+      <div>
+        <ErrorAlert message="Department not found" onClose={() => navigate('/departments')} />
+      </div>
+    );
+  }
+
+  return (
+    <div>
+      <div className="flex justify-between items-center mb-6">
+        <h1 className="text-3xl font-bold" style={{ color: '#7c3aed' }}>{formatDepartmentName(department.departmentName)}</h1>
+        <button
+          onClick={() => navigate('/departments')}
+          className="bg-gray-300 text-gray-700 px-4 py-2 rounded hover:bg-gray-400"
+        >
+          Back
+        </button>
+      </div>
+
+      {error && <ErrorAlert message={error} onClose={() => setError(null)} />}
+
+      <div className="grid grid-cols-1 md:grid-cols-3 gap-6">
+        <div className="bg-white rounded-lg shadow p-6">
+          <h2 className="text-xl font-bold mb-4">Department Information</h2>
+          <div className="space-y-3">
+            <div className="flex justify-between">
+              <span className="font-semibold text-gray-600">Department ID:</span>
+              <span className="text-gray-800">{department.departmentId}</span>
+            </div>
+            <div className="flex justify-between">
+              <span className="font-semibold text-gray-600">Name:</span>
+              <span className="text-gray-800">{formatDepartmentName(department.departmentName)}</span>
+            </div>
+            <div className="flex justify-between">
+              <span className="font-semibold text-gray-600">Total Doctors:</span>
+              <span className="text-gray-800 font-bold">{doctors.length}</span>
+            </div>
+          </div>
+        </div>
+
+        <div className="bg-blue-50 rounded-lg shadow p-6">
+          <h2 className="text-xl font-bold mb-4">Quick Actions</h2>
+          <div className="space-y-2">
+            <button
+              onClick={() => navigate(`/departments/${departmentId}/doctors`)}
+              className="w-full bg-purple-600 text-white px-4 py-2 rounded hover:bg-purple-700"
+            >
+              View All Doctors
+            </button>
+          </div>
+        </div>
+      </div>
+
+      <div className="bg-white rounded-lg shadow p-6 mt-6">
+        <h2 className="text-xl font-bold mb-4">Assigned Doctors</h2>
+        {doctors.length > 0 ? (
+          <table className="w-full">
+            <thead className="bg-gray-100">
+              <tr>
+                <th className="px-4 py-2 text-left">Name</th>
+                <th className="px-4 py-2 text-left">Email</th>
+                <th className="px-4 py-2 text-left">Actions</th>
+              </tr>
+            </thead>
+            <tbody>
+              {doctors.map((doctor) => (
+                <tr key={doctor.doctorId} className="border-t hover:bg-gray-50">
+                  <td className="px-4 py-2">
+                    {doctor.firstName} {doctor.lastName}
+                  </td>
+                  <td className="px-4 py-2">{doctor.emailAddress}</td>
+                  <td className="px-4 py-2">
+                    <button
+                      onClick={() => navigate(`/doctors/${doctor.doctorId}`)}
+                      className="text-purple-600 hover:underline text-sm"
+                    >
+                      View Profile
+                    </button>
+                  </td>
+                </tr>
+              ))}
+            </tbody>
+          </table>
+        ) : (
+          <p className="text-gray-500 text-center py-4">No doctors assigned to this department</p>
+        )}
+      </div>
+    </div>
+  );
+}
+
+export default DepartmentDetail;
Index: frontend/src/pages/departments/DepartmentList.js
===================================================================
--- frontend/src/pages/departments/DepartmentList.js	(revision 20468d38749c5a3ed89d6df4db22905a1d0c3df1)
+++ frontend/src/pages/departments/DepartmentList.js	(revision 20468d38749c5a3ed89d6df4db22905a1d0c3df1)
@@ -0,0 +1,127 @@
+import React, { useState, useEffect } from 'react';
+import { Link, useNavigate } from 'react-router-dom';
+import { departmentService } from '../../services/departmentService';
+import Loading from '../../components/Loading';
+import ErrorAlert from '../../components/ErrorAlert';
+
+function DepartmentList() {
+  const formatDepartmentName = (name) => {
+    if (!name) return 'N/A';
+    return name.replace(/_DEPT$/, '').replace(/_/g, ' ').split(' ').map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(' ');
+  };
+
+  const user = JSON.parse(localStorage.getItem('user') || '{}');
+  const isAdmin = user.role === 'ADMIN';
+  const [departments, setDepartments] = useState([]);
+  const [loading, setLoading] = useState(true);
+  const [error, setError] = useState(null);
+  const navigate = useNavigate();
+
+  useEffect(() => {
+    fetchDepartments();
+  }, []);
+
+  const fetchDepartments = async () => {
+    try {
+      setLoading(true);
+      const response = await departmentService.getAllDepartments();
+      setDepartments(response.data);
+    } catch (err) {
+      setError('Failed to fetch departments');
+      console.error(err);
+    } finally {
+      setLoading(false);
+    }
+  };
+
+  if (loading) return <Loading />;
+
+  return (
+    <div>
+      <div className="flex justify-between items-center mb-6">
+        <h1 style={{ fontSize: '36px', fontWeight: 'normal', color: '#7c3aed' }}>Hospital Departments</h1>
+        {isAdmin && (
+          <div className="space-x-2">
+            <button
+              onClick={() => navigate('/departments/new')}
+              style={{
+                background: '#bfdbfe',
+                color: '#1e1035',
+                padding: '8px 16px',
+                borderRadius: '6px',
+                border: 'none',
+                cursor: 'pointer',
+                fontSize: '14px',
+                fontWeight: '400'
+              }}
+              onMouseEnter={(e) => e.currentTarget.style.background = '#93c5fd'}
+              onMouseLeave={(e) => e.currentTarget.style.background = '#bfdbfe'}
+            >
+              Add Department
+            </button>
+          </div>
+        )}
+      </div>
+
+      {error && <ErrorAlert message={error} onClose={() => setError(null)} />}
+
+      <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
+        {departments.map((dept) => (
+          <div key={dept.departmentId} className="bg-white rounded-lg shadow p-6 hover:shadow-lg transition flex flex-col items-center">
+            <h2 style={{ fontSize: '28px', fontWeight: 'normal', marginBottom: '20px', textAlign: 'center' }}>{formatDepartmentName(dept.departmentName)}</h2>
+            <div className="flex gap-3 w-full">
+              <Link
+                to={`/departments/${dept.departmentId}/doctors`}
+                style={{
+                  flex: 1,
+                  display: 'flex',
+                  alignItems: 'center',
+                  justifyContent: 'center',
+                  background: '#9333ea',
+                  color: 'white',
+                  padding: '6px 10px',
+                  borderRadius: '50px',
+                  textDecoration: 'none',
+                  fontSize: '14px',
+                  fontWeight: '400'
+                }}
+                onMouseEnter={(e) => e.currentTarget.style.background = '#7e22ce'}
+                onMouseLeave={(e) => e.currentTarget.style.background = '#9333ea'}
+              >
+                View Doctors
+              </Link>
+              <Link
+                to={`/departments/${dept.departmentId}`}
+                style={{
+                  flex: 1,
+                  display: 'flex',
+                  alignItems: 'center',
+                  justifyContent: 'center',
+                  background: '#7c3aed',
+                  color: 'white',
+                  padding: '6px 10px',
+                  borderRadius: '50px',
+                  textDecoration: 'none',
+                  fontSize: '14px',
+                  fontWeight: '400'
+                }}
+                onMouseEnter={(e) => e.currentTarget.style.background = '#6d28d9'}
+                onMouseLeave={(e) => e.currentTarget.style.background = '#7c3aed'}
+              >
+                View Details
+              </Link>
+            </div>
+          </div>
+        ))}
+      </div>
+
+      {departments.length === 0 && (
+        <div className="text-center py-12">
+          <p className="text-gray-500">No departments found</p>
+        </div>
+      )}
+    </div>
+  );
+}
+
+export default DepartmentList;
Index: frontend/src/pages/departments/DoctorsByDepartment.js
===================================================================
--- frontend/src/pages/departments/DoctorsByDepartment.js	(revision 20468d38749c5a3ed89d6df4db22905a1d0c3df1)
+++ frontend/src/pages/departments/DoctorsByDepartment.js	(revision 20468d38749c5a3ed89d6df4db22905a1d0c3df1)
@@ -0,0 +1,109 @@
+import React, { useState, useEffect } from 'react';
+import { useParams, useNavigate } from 'react-router-dom';
+import { departmentService } from '../../services/departmentService';
+import Loading from '../../components/Loading';
+import ErrorAlert from '../../components/ErrorAlert';
+
+function DoctorsByDepartment() {
+  const formatDepartmentName = (name) => {
+    if (!name) return 'N/A';
+    return name.replace(/_DEPT$/, '').replace(/_/g, ' ').split(' ').map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(' ');
+  };
+
+  const { departmentId } = useParams();
+  const navigate = useNavigate();
+  const [department, setDepartment] = useState(null);
+  const [doctors, setDoctors] = useState([]);
+  const [loading, setLoading] = useState(true);
+  const [error, setError] = useState(null);
+
+  useEffect(() => {
+    fetchDepartmentAndDoctors();
+  }, [departmentId]);
+
+  const fetchDepartmentAndDoctors = async () => {
+    try {
+      setLoading(true);
+
+      // Fetch department details
+      const deptResponse = await departmentService.getDepartmentById(departmentId);
+      setDepartment(deptResponse.data);
+
+      // Fetch doctors for this department
+      const doctorsResponse = await departmentService.getDoctorsByDepartment(departmentId);
+      setDoctors(doctorsResponse.data);
+    } catch (err) {
+      setError('Failed to fetch data');
+      console.error(err);
+    } finally {
+      setLoading(false);
+    }
+  };
+
+  if (loading) return <Loading />;
+
+  if (!department) {
+    return (
+      <div>
+        <ErrorAlert message="Department not found" onClose={() => navigate('/departments')} />
+      </div>
+    );
+  }
+
+  return (
+    <div>
+      <div className="flex justify-between items-center mb-6">
+        <div>
+          <h1 className="text-3xl font-bold" style={{ color: '#7c3aed' }}>{formatDepartmentName(department.departmentName)}</h1>
+          <p className="text-gray-600">Doctors in this department: {doctors.length}</p>
+        </div>
+        <button
+          onClick={() => navigate('/departments')}
+          className="bg-gray-300 text-gray-700 px-4 py-2 rounded hover:bg-gray-400"
+        >
+          Back
+        </button>
+      </div>
+
+      {error && <ErrorAlert message={error} onClose={() => setError(null)} />}
+
+      <div className="bg-white rounded-lg shadow overflow-hidden">
+        {doctors.length > 0 ? (
+          <table className="w-full">
+            <thead className="bg-gray-100">
+              <tr>
+                <th className="px-6 py-3 text-left text-sm font-semibold">Name</th>
+                <th className="px-6 py-3 text-left text-sm font-semibold">Email</th>
+                <th className="px-6 py-3 text-left text-sm font-semibold">Actions</th>
+              </tr>
+            </thead>
+            <tbody>
+              {doctors.map((doctor) => (
+                <tr key={doctor.doctorId} className="border-t hover:bg-gray-50">
+                  <td className="px-6 py-3">
+                    {doctor.firstName} {doctor.lastName}
+                  </td>
+                  <td className="px-6 py-3">{doctor.emailAddress}</td>
+                  <td className="px-6 py-3">
+                    <button
+                      onClick={() => navigate(`/doctors/${doctor.doctorId}`)}
+                      className="text-purple-600 hover:underline"
+                    >
+                      View Profile
+                    </button>
+                  </td>
+                </tr>
+              ))}
+            </tbody>
+          </table>
+        ) : (
+          <div className="p-6 text-center">
+            <p className="text-gray-500">No doctors assigned to this department</p>
+          </div>
+        )}
+      </div>
+    </div>
+  );
+}
+
+export default DoctorsByDepartment;
Index: frontend/src/pages/doctors/DoctorDetail.js
===================================================================
--- frontend/src/pages/doctors/DoctorDetail.js	(revision 20468d38749c5a3ed89d6df4db22905a1d0c3df1)
+++ frontend/src/pages/doctors/DoctorDetail.js	(revision 20468d38749c5a3ed89d6df4db22905a1d0c3df1)
@@ -0,0 +1,108 @@
+import React, { useState, useEffect } from 'react';
+import { useParams, Link, useNavigate } from 'react-router-dom';
+import { doctorService } from '../../services/doctorService';
+import Loading from '../../components/Loading';
+import ErrorAlert from '../../components/ErrorAlert';
+
+function DoctorDetail() {
+  const formatDepartmentName = (name) => {
+    if (!name) return 'N/A';
+    return name.replace(/_DEPT$/, '').replace(/_/g, ' ').split(' ').map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(' ');
+  };
+
+  const { id } = useParams();
+  const navigate = useNavigate();
+  const user = JSON.parse(localStorage.getItem('user') || '{}');
+  const isPatient = user.role === 'PATIENT';
+  const isAdmin = user.role === 'ADMIN';
+  const isLabTechnician = user.role === 'LAB_TECHNICIAN';
+  const isBillingAdmin = user.role === 'BILLING_ADMIN';
+
+  const [doctor, setDoctor] = useState(null);
+  const [loading, setLoading] = useState(true);
+  const [error, setError] = useState(null);
+
+  useEffect(() => {
+    fetchDoctor();
+  }, [id]);
+
+  const fetchDoctor = async () => {
+    try {
+      setLoading(true);
+      const response = await doctorService.getDoctorById(id);
+      setDoctor(response.data);
+    } catch (err) {
+      setError('Failed to fetch doctor details');
+      console.error(err);
+    } finally {
+      setLoading(false);
+    }
+  };
+
+  if (loading) return <Loading />;
+
+  if (!doctor) {
+    return (
+      <div>
+        <ErrorAlert message="Doctor not found" onClose={() => navigate('/doctors')} />
+      </div>
+    );
+  }
+
+  return (
+    <div>
+      <div className="flex justify-between items-center mb-6">
+        <h1 className="text-3xl font-bold" style={{ color: '#7c3aed' }}>Dr. {doctor.firstName} {doctor.lastName}</h1>
+        <div className="space-x-2">
+          {isAdmin && (
+            <Link to={`/doctors/${id}/edit`} className="bg-purple-600 text-white px-4 py-2 rounded hover:bg-purple-700">
+              Edit
+            </Link>
+          )}
+          <button onClick={() => navigate('/doctors')} className="bg-gray-300 text-gray-700 px-4 py-2 rounded hover:bg-gray-400">
+            Back
+          </button>
+        </div>
+      </div>
+
+      {error && <ErrorAlert message={error} onClose={() => setError(null)} />}
+
+      <div className="grid grid-cols-1 md:grid-cols-2 gap-6">
+        <div className="bg-white rounded-lg shadow p-6">
+          <h2 className="text-xl font-bold mb-4">Professional Information</h2>
+          <div className="space-y-3">
+            <InfoRow label="Email" value={doctor.emailAddress} />
+            <InfoRow label="Specialization" value={doctor.specialization?.specializationName} />
+            <InfoRow label="Level" value={doctor.level?.level} />
+            <InfoRow label="Department" value={formatDepartmentName(doctor.department?.departmentName)} />
+          </div>
+        </div>
+
+        {!isPatient && !isLabTechnician && !isBillingAdmin && (
+          <div className="bg-white rounded-lg shadow p-6">
+            <h2 className="text-xl font-bold mb-4">Quick Links</h2>
+            <div className="space-y-2">
+              <Link to={`/appointments?doctorId=${id}`} className="block p-3 bg-blue-50 hover:bg-purple-100 rounded text-purple-600">
+                View My Appointments
+              </Link>
+              <Link to="/patients" className="block p-3 bg-green-50 hover:bg-green-100 rounded text-green-600">
+                View Patients
+              </Link>
+            </div>
+          </div>
+        )}
+      </div>
+    </div>
+  );
+}
+
+function InfoRow({ label, value }) {
+  return (
+    <div className="flex justify-between">
+      <span className="text-gray-800">{label}:</span>
+      <span className="text-gray-800">{value || 'N/A'}</span>
+    </div>
+  );
+}
+
+export default DoctorDetail;
Index: frontend/src/pages/doctors/DoctorForm.js
===================================================================
--- frontend/src/pages/doctors/DoctorForm.js	(revision 20468d38749c5a3ed89d6df4db22905a1d0c3df1)
+++ frontend/src/pages/doctors/DoctorForm.js	(revision 20468d38749c5a3ed89d6df4db22905a1d0c3df1)
@@ -0,0 +1,184 @@
+import React, { useState, useEffect } from 'react';
+import { useNavigate, useParams } from 'react-router-dom';
+import { doctorService } from '../../services/doctorService';
+import ErrorAlert from '../../components/ErrorAlert';
+import SuccessAlert from '../../components/SuccessAlert';
+
+function DoctorForm() {
+  const { id } = useParams();
+  const navigate = useNavigate();
+  const [formData, setFormData] = useState({
+    firstName: '',
+    lastName: '',
+    emailAddress: '',
+    levelId: '',
+    specializationId: '',
+    departmentId: '',
+  });
+  const [error, setError] = useState(null);
+  const [success, setSuccess] = useState(null);
+  const [loading, setLoading] = useState(false);
+
+  useEffect(() => {
+    if (id) {
+      fetchDoctor();
+    }
+  }, [id]);
+
+  const fetchDoctor = async () => {
+    try {
+      setLoading(true);
+      const response = await doctorService.getDoctorById(id);
+      setFormData({
+        firstName: response.data.firstName,
+        lastName: response.data.lastName,
+        emailAddress: response.data.emailAddress,
+        levelId: response.data.level?.levelId || '',
+        specializationId: response.data.specialization?.specializationId || '',
+        departmentId: response.data.department?.departmentId || '',
+      });
+    } catch (err) {
+      setError('Failed to fetch doctor');
+    } finally {
+      setLoading(false);
+    }
+  };
+
+  const handleChange = (e) => {
+    const { name, value } = e.target;
+    setFormData(prev => ({
+      ...prev,
+      [name]: value
+    }));
+  };
+
+  const handleSubmit = async (e) => {
+    e.preventDefault();
+
+    if (!formData.firstName || !formData.lastName || !formData.emailAddress) {
+      setError('Please fill in all required fields');
+      return;
+    }
+
+    try {
+      setLoading(true);
+      if (id) {
+        await doctorService.updateDoctor(id, formData);
+        setSuccess('Doctor updated successfully!');
+      } else {
+        await doctorService.createDoctor(formData);
+        setSuccess('Doctor created successfully!');
+      }
+      setTimeout(() => navigate('/doctors'), 1500);
+    } catch (err) {
+      setError(err.response?.data?.error || 'Failed to save doctor');
+    } finally {
+      setLoading(false);
+    }
+  };
+
+  return (
+    <div className="max-w-2xl mx-auto">
+      <h1 className="text-3xl font-bold mb-6">
+        {id ? 'Edit Doctor' : 'Add New Doctor'}
+      </h1>
+
+      {error && <ErrorAlert message={error} onClose={() => setError(null)} />}
+      {success && <SuccessAlert message={success} onClose={() => setSuccess(null)} />}
+
+      <form onSubmit={handleSubmit} className="bg-white rounded-lg shadow p-6 space-y-4">
+        <div className="grid grid-cols-2 gap-4">
+          <div>
+            <label className="block text-sm font-semibold mb-2">First Name *</label>
+            <input
+              type="text"
+              name="firstName"
+              value={formData.firstName}
+              onChange={handleChange}
+              className="w-full px-4 py-2 border rounded-lg"
+              required
+            />
+          </div>
+          <div>
+            <label className="block text-sm font-semibold mb-2">Last Name *</label>
+            <input
+              type="text"
+              name="lastName"
+              value={formData.lastName}
+              onChange={handleChange}
+              className="w-full px-4 py-2 border rounded-lg"
+              required
+            />
+          </div>
+        </div>
+
+        <div>
+          <label className="block text-sm font-semibold mb-2">Email *</label>
+          <input
+            type="email"
+            name="emailAddress"
+            value={formData.emailAddress}
+            onChange={handleChange}
+            className="w-full px-4 py-2 border rounded-lg"
+            required
+          />
+        </div>
+
+        <div className="grid grid-cols-3 gap-4">
+          <div>
+            <label className="block text-sm font-semibold mb-2">Level</label>
+            <input
+              type="number"
+              name="levelId"
+              value={formData.levelId}
+              onChange={handleChange}
+              placeholder="Level ID"
+              className="w-full px-4 py-2 border rounded-lg"
+            />
+          </div>
+          <div>
+            <label className="block text-sm font-semibold mb-2">Specialization</label>
+            <input
+              type="number"
+              name="specializationId"
+              value={formData.specializationId}
+              onChange={handleChange}
+              placeholder="Spec. ID"
+              className="w-full px-4 py-2 border rounded-lg"
+            />
+          </div>
+          <div>
+            <label className="block text-sm font-semibold mb-2">Department</label>
+            <input
+              type="number"
+              name="departmentId"
+              value={formData.departmentId}
+              onChange={handleChange}
+              placeholder="Dept. ID"
+              className="w-full px-4 py-2 border rounded-lg"
+            />
+          </div>
+        </div>
+
+        <div className="flex gap-4 pt-4">
+          <button
+            type="submit"
+            disabled={loading}
+            className="bg-purple-600 text-white px-6 py-2 rounded hover:bg-purple-700 disabled:opacity-50"
+          >
+            {loading ? 'Saving...' : 'Save Doctor'}
+          </button>
+          <button
+            type="button"
+            onClick={() => navigate('/doctors')}
+            className="bg-gray-300 text-gray-700 px-6 py-2 rounded hover:bg-gray-400"
+          >
+            Cancel
+          </button>
+        </div>
+      </form>
+    </div>
+  );
+}
+
+export default DoctorForm;
Index: frontend/src/pages/doctors/DoctorList.js
===================================================================
--- frontend/src/pages/doctors/DoctorList.js	(revision 20468d38749c5a3ed89d6df4db22905a1d0c3df1)
+++ frontend/src/pages/doctors/DoctorList.js	(revision 20468d38749c5a3ed89d6df4db22905a1d0c3df1)
@@ -0,0 +1,106 @@
+import React, { useState, useEffect } from 'react';
+import { Link } from 'react-router-dom';
+import { doctorService } from '../../services/doctorService';
+import Loading from '../../components/Loading';
+import ErrorAlert from '../../components/ErrorAlert';
+
+function DoctorList() {
+  const user = JSON.parse(localStorage.getItem('user') || '{}');
+  const isAdmin = user.role === 'ADMIN';
+  const [doctors, setDoctors] = useState([]);
+  const [loading, setLoading] = useState(true);
+  const [error, setError] = useState(null);
+  const [searchTerm, setSearchTerm] = useState('');
+
+  useEffect(() => {
+    fetchDoctors();
+  }, []);
+
+  const fetchDoctors = async () => {
+    try {
+      setLoading(true);
+      const response = await doctorService.getAllDoctors();
+      setDoctors(response.data);
+    } catch (err) {
+      setError('Failed to fetch doctors');
+      console.error(err);
+    } finally {
+      setLoading(false);
+    }
+  };
+
+  const filteredDoctors = doctors.filter(doctor =>
+    doctor.firstName.toLowerCase().includes(searchTerm.toLowerCase()) ||
+    doctor.lastName.toLowerCase().includes(searchTerm.toLowerCase()) ||
+    doctor.emailAddress.includes(searchTerm)
+  );
+
+  if (loading) return <Loading />;
+
+  return (
+    <div>
+      <div className="flex justify-between items-center mb-6">
+        <h1 className="text-3xl font-bold" style={{ color: '#7c3aed' }}>Doctors</h1>
+        {isAdmin && (
+          <Link to="/doctors/new" style={{
+            display: 'inline-block',
+            background: '#bfdbfe',
+            color: '#1e1035',
+            padding: '8px 16px',
+            borderRadius: '6px',
+            textDecoration: 'none',
+            fontSize: '14px',
+            fontWeight: '400'
+          }} onMouseEnter={(e) => e.currentTarget.style.background = '#93c5fd'} onMouseLeave={(e) => e.currentTarget.style.background = '#bfdbfe'}>
+            Add Doctor
+          </Link>
+        )}
+      </div>
+
+      {error && <ErrorAlert message={error} onClose={() => setError(null)} />}
+
+      <div className="mb-6">
+        <input
+          type="text"
+          placeholder="Search by name or email..."
+          className="w-full px-4 py-2 border rounded-lg"
+          value={searchTerm}
+          onChange={(e) => setSearchTerm(e.target.value)}
+        />
+      </div>
+
+      <div className="bg-white rounded-lg shadow overflow-hidden">
+        <table className="w-full">
+          <thead className="bg-gray-100">
+            <tr>
+              <th className="px-6 py-3 text-left text-sm font-semibold">Name</th>
+              <th className="px-6 py-3 text-left text-sm font-semibold">Email</th>
+              <th className="px-6 py-3 text-left text-sm font-semibold">Specialization</th>
+              <th className="px-6 py-3 text-left text-sm font-semibold">Level</th>
+              <th className="px-6 py-3 text-left text-sm font-semibold">Department</th>
+              <th className="px-6 py-3 text-left text-sm font-semibold">Actions</th>
+            </tr>
+          </thead>
+          <tbody>
+            {filteredDoctors.map(doctor => (
+              <tr key={doctor.doctorId} className="border-t hover:bg-gray-50">
+                <td className="px-6 py-3">{doctor.firstName} {doctor.lastName}</td>
+                <td className="px-6 py-3">{doctor.emailAddress}</td>
+                <td className="px-6 py-3">{doctor.specialization?.specializationName || 'N/A'}</td>
+                <td className="px-6 py-3">{doctor.level?.level || 'N/A'}</td>
+                <td className="px-6 py-3">{doctor.department?.departmentName ? doctor.department.departmentName.replace(/_DEPT$/, '').replace(/_/g, ' ').split(' ').map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(' ') : 'N/A'}</td>
+                <td className="px-6 py-3">
+                  <Link to={`/doctors/${doctor.doctorId}`} style={{ color: '#7c3aed', textDecoration: 'none', fontWeight: '400' }} onMouseEnter={(e) => e.currentTarget.style.textDecoration = 'underline'} onMouseLeave={(e) => e.currentTarget.style.textDecoration = 'none'}>
+                    View
+                  </Link>
+                </td>
+              </tr>
+            ))}
+          </tbody>
+        </table>
+      </div>
+    </div>
+  );
+}
+
+export default DoctorList;
Index: frontend/src/services/appointmentService.js
===================================================================
--- frontend/src/services/appointmentService.js	(revision 20468d38749c5a3ed89d6df4db22905a1d0c3df1)
+++ frontend/src/services/appointmentService.js	(revision 20468d38749c5a3ed89d6df4db22905a1d0c3df1)
@@ -0,0 +1,23 @@
+import apiClient from './api';
+
+const ENDPOINT = '/appointments';
+
+export const appointmentService = {
+  getAllAppointments: () => apiClient.get(ENDPOINT),
+
+  getAppointmentById: (id) => apiClient.get(`${ENDPOINT}/${id}`),
+
+  getAppointmentsForPatient: (patientId) => apiClient.get(`${ENDPOINT}/patient/${patientId}`),
+
+  getAppointmentsForDoctor: (doctorId) => apiClient.get(`${ENDPOINT}/doctor/${doctorId}`),
+
+  getDoctorSchedule: (doctorId, date) => apiClient.get(`${ENDPOINT}/doctor/${doctorId}/schedule`, {
+    params: { date }
+  }),
+
+  createAppointment: (appointment) => apiClient.post(ENDPOINT, appointment),
+
+  cancelAppointment: (id) => apiClient.patch(`${ENDPOINT}/${id}/cancel`),
+
+  completeAppointment: (id) => apiClient.patch(`${ENDPOINT}/${id}/complete`),
+};
Index: frontend/src/services/departmentService.js
===================================================================
--- frontend/src/services/departmentService.js	(revision 20468d38749c5a3ed89d6df4db22905a1d0c3df1)
+++ frontend/src/services/departmentService.js	(revision 20468d38749c5a3ed89d6df4db22905a1d0c3df1)
@@ -0,0 +1,15 @@
+import apiClient from './api';
+
+const ENDPOINT = '/departments';
+
+export const departmentService = {
+  getAllDepartments: () => apiClient.get(ENDPOINT),
+
+  getDepartmentById: (id) => apiClient.get(`${ENDPOINT}/${id}`),
+
+  getDoctorsByDepartment: (departmentId) => apiClient.get(`${ENDPOINT}/${departmentId}/doctors`),
+
+  createDepartment: (departmentData) => apiClient.post(ENDPOINT, departmentData),
+
+  updateDepartment: (id, departmentData) => apiClient.put(`${ENDPOINT}/${id}`, departmentData),
+};
Index: frontend/src/services/doctorService.js
===================================================================
--- frontend/src/services/doctorService.js	(revision 20468d38749c5a3ed89d6df4db22905a1d0c3df1)
+++ frontend/src/services/doctorService.js	(revision 20468d38749c5a3ed89d6df4db22905a1d0c3df1)
@@ -0,0 +1,21 @@
+import apiClient from './api';
+
+const ENDPOINT = '/doctors';
+
+export const doctorService = {
+  getAllDoctors: () => apiClient.get(ENDPOINT),
+
+  getDoctorById: (id) => apiClient.get(`${ENDPOINT}/${id}`),
+
+  getDoctorByEmail: (email) => apiClient.get(`${ENDPOINT}/email/${email}`),
+
+  getDoctorsByDepartment: (departmentId) => apiClient.get(`${ENDPOINT}/department/${departmentId}`),
+
+  getDoctorsBySpecialization: (specializationId) => apiClient.get(`${ENDPOINT}/specialization/${specializationId}`),
+
+  getDoctorsByLevel: (levelId) => apiClient.get(`${ENDPOINT}/level/${levelId}`),
+
+  createDoctor: (doctor) => apiClient.post(ENDPOINT, doctor),
+
+  updateDoctor: (id, doctor) => apiClient.put(`${ENDPOINT}/${id}`, doctor),
+};
Index: frontend/src/services/patientService.js
===================================================================
--- frontend/src/services/patientService.js	(revision 20468d38749c5a3ed89d6df4db22905a1d0c3df1)
+++ frontend/src/services/patientService.js	(revision 20468d38749c5a3ed89d6df4db22905a1d0c3df1)
@@ -0,0 +1,17 @@
+import apiClient from './api';
+
+const ENDPOINT = '/patients';
+
+export const patientService = {
+  getAllPatients: () => apiClient.get(ENDPOINT),
+
+  getPatientById: (id) => apiClient.get(`${ENDPOINT}/${id}`),
+
+  getPatientByEmbg: (embg) => apiClient.get(`${ENDPOINT}/embg/${embg}`),
+
+  getPatientByEmail: (email) => apiClient.get(`${ENDPOINT}/email/${email}`),
+
+  createPatient: (patient) => apiClient.post(ENDPOINT, patient),
+
+  updatePatient: (id, patient) => apiClient.put(`${ENDPOINT}/${id}`, patient),
+};
