A modern, responsive React application for managing prescriptions with an elegant tabbed interface.
- Tabbed Interface: Clean tabbed layout with Prescription Form and History tabs
- Responsive Design: Full-width layout optimized for higher resolution screens
- Toast Notifications: Real-time feedback for user actions
- Form Validation: Comprehensive form validation using React Hook Form and Zod
- Modern UI: Elegant design with Tailwind CSS and smooth animations
- Type Safety: Full TypeScript support throughout the application
- React 19 - Modern React with latest features
- TypeScript - Type-safe development
- Vite - Fast build tool and development server
- Tailwind CSS - Utility-first CSS framework
- React Hook Form - Performant forms with easy validation
- Zod - TypeScript-first schema validation
- React Router - Client-side routing
- Axios - HTTP client for API communication
- React Hot Toast - Beautiful toast notifications
- Lucide React - Beautiful icons
- Vitest - Fast unit testing framework
- Node.js (v18 or higher)
- npm or yarn
-
Clone the repository
-
Install dependencies:
npm install
-
Start the development server:
npm run dev
-
Open your browser and navigate to
http://localhost:5173
The application includes static user authentication with the following demo credentials:
| Role | Password | Name | Department | |
|---|---|---|---|---|
| Administrator | admin@clinic.com | admin123 | Jaydeep Chandegra | General Medicine |
| Physician | doctor@clinic.com | doctor123 | Dr. Jaydeep | Cardiology |
| Nurse | nurse@clinic.com | nurse123 | Jaydeep C | Emergency Care |
| Pharmacist | pharmacist@clinic.com | pharma123 | Mr. Jaydeep | Pharmacy |
| Demo | demo@clinic.com | demo123 | Demo Jaydeep | Demo Department |
- Navigate to the login page
- Use any of the credentials above
- Click "Sign in" to access the dashboard
- Invalid credentials will show an error toast notification
Note: These are demo credentials for testing purposes only. In a production environment, authentication would be handled through a secure API.
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run test- Run tests in watch modenpm run test:run- Run tests oncenpm run test:coverage- Run tests with coverage reportnpm run test:ui- Run tests with UI interfacenpm run lint- Run ESLintnpm run lint:fix- Fix ESLint issuesnpm run format- Format code with Prettiernpm run type-check- Run TypeScript type checking
This project uses Vitest for unit and integration testing.
# Run all tests
npm run test
# Run tests once (CI mode)
npm run test:run
# Run tests with coverage
npm run test:coverage
# Run tests with UI interface
npm run test:uiThe project includes comprehensive test coverage for:
- Token Management: JWT token decoding and expiration checking
- Prescription Service: API calls for medicines, prescriptions, and error handling
- Form Validation: Input validation and error handling
- Component Logic: User interactions and state management
When adding new features, ensure you write corresponding tests:
- Create test files with
.test.tsor.test.tsxextension - Place them in
__tests__directories next to the code being tested - Use descriptive test names that explain the expected behavior
- Mock external dependencies and API calls
- Test both success and error scenarios
The application integrates with a Fastify backend API for:
- Authentication and authorization
- Prescription management
- Medicine catalog
- Patient data management