How mrtracker-new/contact-manager works
Main Components
• Frontend Web Application – Built with React and Material UI. This is represented by the files under the “src” directory, including pages (e.g., ContactList.js, Dashboard.js) and shared components (e.g., Header.js, ImportExport.js).
• Mobile Application – Uses Capacitor to wrap the web app and run natively on Android. The “android” directory contains all native Android code and configurations.
• Document and Contact Management Logic – Implemented as utility functions (e.g., vCardFormatter.js, contactImportExport.js) and integrated with storage mechanisms (Capacitor Preferences, LocalStorage).
• Routing & State Management – The application uses React Router for navigation (visible in the “src” directory) and React Context API for state management.
• Configuration & Integration Layer – Provided by capacitor.config.json and capacitor.config.ts, which govern cross-platform behaviors like file system access, camera & sharing integrations.
Component Relationships & Interactions
• The Frontend Web Application serves as the primary user interface accessible via browsers. It interacts with local storage (e.g., Capacitor Preferences, LocalStorage) for holding contact information locally (supporting offline functionality).
• The Mobile Application layer (wrapped by Capacitor) uses the same web codebase (from “src”) but builds an Android package (see “android” directory). This native layer interfaces with OS-specific features (camera, file handling, etc.) configured in capacitor.config.json.
• The document processing utilities, invoked by both frontends, handle tasks such as formatting vCard files and managing document attachments.
• The import/export functionalities (also seen in the components and utils directories) ensure data can be exchanged in standard formats (vCard).
Architectural Patterns & Design Principles
• Cross-Platform Reusability: The design emphasizes code reuse by sharing the React codebase across web and native apps via Capacitor.
• Component-Based UI: The React components follow a modular pattern ensuring separation of concerns (header, dashboard, contact details, etc.).
• Offline-First and Local Data Storage: The application is designed to maintain full functionality without constant internet access.
• Separation of Concerns: Clear split between presentation (React UI), business logic (utility functions for contact and document management), and mobile integration (native Android code wrapped by Capacitor).