Dev Mern Task
Dev Mern Task
Task Overview:
The task is to build a Lead Management Tool with a focus on both frontend and backend
development using the MERN stack. The tool will manage leads and customer details for a
pharmacy business. This task will evaluate the developer’s proficiency in creating a
responsive and scalable application with a focus on component handling, global state
management, and efficient API integration.
3. API Requirements:
• Ensure clean and modular code in the backend (controllers, services, routes).
UI Components:
• Modular Component Structure: Ensure the frontend code is structured into reusable,
modular components.
• Component State Management: Use React Hooks (useState, useEffect) for local state
management.
• Global State Management: Implement Redux or Context API for managing global state
(e.g., user authentication, leads data).
• Routing: Use React Router for navigating between views (e.g., dashboard, edit lead, view
lead).
List View:
• Features:
• Sort by columns like next follow-up date, lead status, lead source, etc.
• Pagination controls.
Edit View:
• Include fields for leadName, contactNumber, email, lead source, next follow-up date/time,
status, etc.
• Handle API requests for filters and sorting on the backend to manage large datasets
efficiently.
Search Functionality:
• The search should trigger API calls with debounce functionality to minimize unnecessary
requests.
1. Code Structure:
• No use of global variables. Use context or state management solutions (e.g., Redux).
• Use CSS Modules or Styled Components for scoped CSS to prevent style leakage across
components.
• Ensure a responsive design for different device sizes (desktop, tablet, mobile).
3. Error Handling:
4. Security:
• Use proper form validation to avoid XSS and SQL injection attacks.
5. Optimization:
• Lazy load components where appropriate (e.g., large forms or complex views).
• Optimize performance by keeping API calls minimal and using local caching where
applicable (e.g., Redux or context state).
6. Testing:
• Write basic unit tests for core components and services (e.g., authentication, lead CRUD
operations).
• Use tools like Jest and React Testing Library for frontend testing.
1. Component Management:
• Keep components small and manageable. A single component should follow Single
Responsibility Principle.
• Avoid prop drilling by using context API or Redux to manage state at the global level.
2. Variables:
• Ensure variables are scoped appropriately (local/global) and avoid excessive global variable
usage.
3. API Integration:
• Handle loading states, success, and failure gracefully for all API calls.
• Commits should be atomic and properly documented with meaningful commit messages.
• Deliverables: