A centralized React Router-based navigation system that integrates all Path2Wellness applications with role-based routing and authentication.
The unified app serves as the main entry point for the Path2Wellness monorepo, providing seamless navigation between different applications based on user roles.
unified-app/
โโโ src/
โ โโโ components/
โ โ โโโ Homepage.jsx # Landing page with Get Started button
โ โ โโโ ProfileManagement.jsx # Login/Authentication page
โ โ โโโ PatientPortal.jsx # Patient dashboard wrapper
โ โ โโโ DoctorDashboard.jsx # Doctor dashboard wrapper
โ โ โโโ AdminDashboard.jsx # Admin dashboard wrapper
โ โ โโโ ProtectedRoute.jsx # Route protection component
โ โ โโโ NotFound.jsx # 404 error page
โ โโโ contexts/
โ โ โโโ AuthContext.jsx # Authentication state management
โ โโโ App.jsx # Main router configuration
โ โโโ main.jsx # Application entry point
โโโ package.json
โโโ vite.config.js
โโโ tailwind.config.js
โโโ Dockerfile
- Route:
/ - Component:
Homepage - Action: "Get Started" button navigates to
/profile-management - Features:
- Modern landing page with feature showcase
- Automatic redirect to dashboard if already logged in
- Responsive design with Tailwind CSS
- Route:
/profile-management - Component:
ProfileManagement - Features:
- Email/username and password authentication
- Demo credentials for testing
- Integration with existing authentication APIs
- Automatic role-based redirection after login
- Route:
/home/* - Component:
PatientPortal - Access: Patients only
- Features: Health dashboard, appointments, medical records
- Route:
/doctor-dashboard/* - Component:
DoctorDashboard - Access: Doctors only
- Features: Patient management, escalation tickets, schedule
- Route:
/admin-dashboard/* - Component:
AdminDashboard - Access: Admins only
- Features: User management, system monitoring, analytics
The unified app integrates with existing authentication systems:
- Primary: PathAI API (
http://localhost:5002/api/auth/login) - Fallback: Profile Management API (
http://localhost:3004/api/auth/users/login)
// Admin Access
Email: admin@path2wellness.com
Password: Admin123!@#
// Doctor Access
Email: doctor@path2wellness.com
Password: Doctor123!@#
// Patient Access
Email: patient@path2wellness.com
Password: Patient123!@#- User enters credentials on
/profile-management - System attempts login via PathAI API
- If PathAI fails, fallback to Profile Management API
- On success, JWT token stored in localStorage
- User redirected based on role:
Patientโ/homeDoctorโ/doctor-dashboardAdminโ/admin-dashboard
- Checks authentication status
- Validates user roles
- Redirects unauthorized users
- Shows loading states during authentication
// Public Routes
/ (Homepage)
/profile-management (Login)
/404 (Not Found)
// Protected Routes
/home/* (Patient only)
/doctor-dashboard/* (Doctor only)
/admin-dashboard/* (Admin only)- Framework: React 18 with Vite
- Styling: Tailwind CSS
- Icons: Lucide React
- Theme: Modern gradients with glassmorphism effects
- Mobile-first approach
- Adaptive layouts for all screen sizes
- Touch-friendly interface elements
- Smooth transitions and animations
- Loading states and error handling
- Intuitive navigation patterns
- Accessibility considerations
cd unified-app
npm install
npm run devAccess at: http://localhost:3001
npm run build
npm run previewdocker build -t path2wellness-unified .
docker run -p 3000:3000 path2wellness-unifiedThe app automatically detects and connects to:
- Profile Management API:
http://localhost:3004 - PathAI API:
http://localhost:5002
- Path aliases for clean imports
- Development server with HMR
- Production optimizations
-
Homepage Navigation
- Visit http://localhost:3001
- Click "Get Started" โ Should navigate to login
-
Authentication Testing
- Use demo credentials to test each role
- Verify proper dashboard redirection
- Test logout functionality
-
Route Protection
- Try accessing protected routes without login
- Verify role-based access restrictions
- Test invalid route handling (404)
- โ MongoDB Atlas authentication
- โ JWT token management
- โ Role-based access control
- โ Existing API compatibility
Path2Wellness/
โโโ apps/
โ โโโ homepage/ # Legacy homepage (port 5173)
โ โโโ profile-management/ # Auth backend (port 3004)
โ โโโ home/ # Patient portal (port 3001)
โ โโโ doctor-dashboard/ # Doctor dashboard (port 3002)
โ โโโ admin-dashboard/ # Admin dashboard (port 3003)
โโโ unified-app/ # Main navigation app (port 3001)
โโโ pathAi/ # AI system (port 5002)
โโโ docker-compose.yml # Container orchestration
- Each app maintains its existing functionality
- Unified app provides centralized entry point
- Existing APIs remain unchanged
- Docker configuration updated for new structure
- Legacy routes still accessible
- Existing authentication systems preserved
- Database connections maintained
- API endpoints unchanged
# Start all services
docker-compose up -d
# Or start unified app only
cd unified-app && npm run dev- Unified app serves as main entry point on port 3000
- Individual services run on their respective ports
- Load balancer can route to unified app
- CDN integration for static assets
- Code splitting by route
- Lazy loading of components
- Optimized bundle sizes
- Fast refresh in development
- Authentication success rates
- Route navigation patterns
- Error tracking and logging
- Performance metrics
- Single Sign-On (SSO) integration
- Multi-factor authentication
- Advanced role permissions
- Real-time notifications
- Progressive Web App (PWA) features
- Micro-frontend architecture ready
- API gateway integration
- Horizontal scaling support
- Multi-tenant capabilities
โ
Unified Navigation: Single entry point for all applications
โ
Role-Based Routing: Automatic redirection based on user roles
โ
Folder-Based Structure: Clean monorepo organization
โ
Authentication Integration: Works with existing MongoDB Atlas system
โ
Modern UI/UX: Professional healthcare application design
โ
Docker Ready: Full containerization support
โ
Production Ready: Optimized builds and deployment configuration
The unified navigation system successfully integrates all Path2Wellness applications into a cohesive, role-based healthcare management platform.