MedTun is a comprehensive web application that revolutionizes healthcare access in Tunisia by connecting patients with doctors, specialists, and medical facilities. The platform provides a complete ecosystem for medical appointment management, user administration, and healthcare services discovery.
- Patients: Complete profile management with medical history
- Doctors: Professional profiles with specialties, qualifications, and clinic information
- Administrators: Full system control and management capabilities
- Flexible Booking: Book appointments with preferred doctors
- Status Tracking: Real-time appointment status (En attente, Confirmรฉ, Terminรฉ, Annulรฉ)
- Cancellation System: Cancel appointments with detailed reasons
- Complete History: View all past and upcoming appointments
- Comprehensive Directory: Search doctors by specialty, location, or name
- Detailed Profiles: View doctor qualifications, experience, and clinic information
- Specialty Icons: Consistent visual representation for all medical specialties
- Location-based Search: Find doctors in specific cities
- Interactive Map: Find nearby pharmacies with precise locations
- Contact Information: Access pharmacy details and contact info
- Geographic Coverage: Comprehensive pharmacy database across Tunisia
- JWT Authentication: Secure token-based authentication system
- Role-based Access Control: Different permissions for patients, doctors, and admins
- Protected Routes: Secure access to sensitive areas
- Complete System Control: Manage all users, appointments, and system data
- User Management: Create, edit, and delete users of any role
- Appointment Oversight: Monitor and manage all appointments
- Statistics Dashboard: Real-time insights and system analytics
- Bulk Operations: Efficient management of large datasets
- Framework: React 18 with TypeScript for type safety
- Styling: Bootstrap 5 for responsive design and modern UI
- Routing: React Router for seamless navigation
- State Management: React Context for authentication and global state
- API Integration: Axios for HTTP requests with interceptors
- Form Handling: Controlled components with validation
- Framework: Spring Boot 3.x with Java
- Security: Spring Security with JWT authentication
- Database: JPA/Hibernate with MySQL
- API Design: RESTful APIs with proper HTTP status codes
- Architecture: Layered architecture (Controller โ Service โ Repository)
- Password Security: BCrypt encryption for secure password storage
- Relational Model: Well-structured MySQL database
- Entity Relationships: Proper foreign key relationships
- Data Integrity: Constraints and validations
- Performance: Optimized queries and indexing
frontend/
โโโ public/ # Static assets
โโโ src/
โ โโโ components/ # Reusable UI components
โ โ โโโ admin/ # Admin-specific components
โ โ โ โโโ AdminDashboard.tsx
โ โ โ โโโ AdminUsersManagement.tsx
โ โ โ โโโ AdminAppointmentsManagement.tsx
โ โ โ โโโ AdminCreateUser.tsx
โ โ โโโ layout/ # Layout components
โ โ โ โโโ Header.tsx
โ โ โ โโโ Footer.tsx
โ โ โ โโโ Layout.tsx
โ โ โโโ common/ # Shared components
โ โโโ contexts/ # React contexts
โ โ โโโ AuthContext.tsx # Authentication state management
โ โโโ pages/ # Page components
โ โ โโโ admin/ # Admin pages
โ โ โโโ auth/ # Authentication pages
โ โ โโโ HomePage.tsx
โ โ โโโ DoctorsPage.tsx
โ โ โโโ AppointmentsPage.tsx
โ โ โโโ DashboardPage.tsx
โ โ โโโ PharmaciesPage.tsx
โ โโโ styles/ # Global styles
โ โโโ types/ # TypeScript definitions
โโโ package.json
โโโ tsconfig.json
backend/
โโโ src/
โ โโโ main/
โ โ โโโ java/com/example/backend/
โ โ โ โโโ controller/ # REST endpoints
โ โ โ โ โโโ AuthController.java
โ โ โ โ โโโ UserController.java
โ โ โ โ โโโ AppointmentController.java
โ โ โ โ โโโ DoctorController.java
โ โ โ โ โโโ AdminController.java
โ โ โ โโโ model/ # Entity classes
โ โ โ โ โโโ User.java
โ โ โ โ โโโ Patient.java
โ โ โ โ โโโ Doctor.java
โ โ โ โ โโโ Admin.java
โ โ โ โ โโโ Appointment.java
โ โ โ โ โโโ Specialty.java
โ โ โ โ โโโ Pharmacy.java
โ โ โ โโโ repository/ # Data access layer
โ โ โ โโโ service/ # Business logic
โ โ โ โโโ config/ # Configuration
โ โ โ โโโ security/ # Authentication & authorization
โ โ โ โโโ enums/ # Enumerations
โ โ โโโ resources/
โ โ โโโ application.properties
โ โ โโโ sample-data/ # Initial data scripts
โ โโโ test/ # Test classes
โโโ pom.xml
โโโ mvnw.cmd
- Node.js 16+ and npm
- Java 11 or higher
- MySQL 8.0+
- Maven (included via wrapper)
- Create MySQL database:
CREATE DATABASE medtun_db;- Update database configuration in
backend/src/main/resources/application.properties:
spring.datasource.url=jdbc:mysql://localhost:3306/medtun_db
spring.datasource.username=your_username
spring.datasource.password=your_passwordcd backend
./mvnw clean install
./mvnw spring-boot:runThe API will be available at http://localhost:8080/api
cd frontend
npm install
npm startThe application will be available at http://localhost:3000
- Start the backend server
- Use your database management tool to insert an admin user:
INSERT INTO users (email, password, role, first_name, last_name, phone_number, created_at, updated_at)
VALUES ('admin@medtun.com', '$2a$10$encoded_password_hash', 'ADMIN', 'Admin', 'User', '+216 XX XXX XXX', NOW(), NOW());- Login with admin credentials at
http://localhost:3000/login - Navigate to
http://localhost:3000/adminor click the "Administration" link in the navigation - Access complete system management features
- System Statistics: Total users, appointments, and system metrics
- Real-time Data: Live updates of system status
- Quick Actions: Fast access to common administrative tasks
- View All Users: Paginated list with role filtering
- Edit Users: Modify user information and roles
- Delete Users: Remove users from the system
- Create Users: Add new patients, doctors, or admins
- View All Appointments: Complete appointment oversight
- Status Management: Change appointment statuses
- Filter & Search: Find specific appointments quickly
- Bulk Operations: Manage multiple appointments efficiently
-
Appointment Cancellation System
- Added cancellation reasons tracking
- Display cancellation details in appointment history
- Status management for cancelled appointments
-
Visual Consistency
- Standardized specialty icons across the platform
- Consistent UI/UX design patterns
- Responsive design for all devices
-
Form Optimization
- Removed duplicate fields in patient registration
- Streamlined user input processes
- Enhanced form validation
-
Complete Admin System
- Full CRUD operations for all entities
- Role-based access control
- Comprehensive system monitoring
- JWT Authentication: Secure token-based authentication
- Password Encryption: BCrypt hashing for all passwords
- Role-based Authorization: Different access levels for each user type
- Protected API Endpoints: Secure backend routes
- Input Validation: Frontend and backend validation
- CORS Configuration: Secure cross-origin requests
POST /api/auth/login- User loginPOST /api/auth/register- User registration
GET /api/users/profile- Get current user profilePUT /api/users/profile- Update user profile
GET /api/appointments- Get user appointmentsPOST /api/appointments- Create new appointmentPUT /api/appointments/{id}/cancel- Cancel appointment
GET /api/admin/dashboard- Get system statisticsGET /api/admin/users- Get all users with paginationPOST /api/admin/users- Create new userDELETE /api/admin/users/{id}- Delete userGET /api/admin/appointments- Get all appointments
- Responsive Design: Works on desktop, tablet, and mobile
- Modern Interface: Clean and intuitive user interface
- Accessibility: WCAG compliant design elements
- Loading States: User feedback during API calls
- Error Handling: Graceful error messages and recovery
- Consistent Branding: Unified design language throughout
- Real-time Notifications: Push notifications for appointments
- Video Consultations: Telemedicine integration
- Payment Gateway: Online payment for consultations
- Mobile App: Native mobile applications
- AI Recommendations: Smart doctor and specialty recommendations
- Multi-language Support: Arabic and French language options
- Optimized Queries: Efficient database operations
- Pagination: Handle large datasets efficiently
- Lazy Loading: Component-based code splitting
- Caching Strategy: Strategic caching for improved performance
- Scalable Architecture: Designed for horizontal scaling
This project follows standard development practices:
- Clean code principles
- Comprehensive error handling
- Proper documentation
- Type safety with TypeScript
- RESTful API design