## Casadoc: Technical specifications describing cross-platform feasibility ##### Summary The strategic choice, considering high quality UI/UX and performance over a quick-fix migration (using a framework like Ionic), is **React Native**. While it requires more initial work than Ionic, the result will be a robust mobile app that feels truly native on both iOS and Android. The frontend will have to be written in JavaScript entirely but it offers a significantly faster, smoother *native* feel. The PHP code would only serve as the backend API. ##### React Native * **Architecture:** Renders true native mobile UI components using JavaScript. * **Frontend Migration:** We won't be able to use the original HTML/CSS output rendered by the PHP code directly. We'll have to rewrite the UI using JSX (React). * **Language:** JavaScript/TypeScript. * **Native Features:** React Native supports a large ecosystem of native modules. #### Technical strategy for migrating Casadoc from PHP to React Native 1. **Architectural Shift** **Decoupling**. Currently, our PHP code likely mixes logic and UI (e.g., fetching data from DB and immediately rendering an HTML table). - **Current State:** PHP $\rightarrow$ HTML/CSS (Browser renders UI) - **Future State:** PHP $\rightarrow$ JSON Data $\rightarrow$ React Native (Mobile renders UI) 2. **Category-Wise Migration Plan** - **The Backend (PHP): Transformation to API** We do not need to rewrite the backend logic (code), but we must change *how* it delivers data. - Create a new set of endpoints specifically for the mobile app. - **Authentication:** - *Current:* Likely uses Sessions/Cookies (`$_SESSION`). - *New:* Switch to **JWT (JSON Web Tokens)**. The app will send a "Token" with every request to prove who the user is. - **Response Format:** - Stop returning `view('profile.index', $data)` - Start returning `json_encode($data)` or `return response()->json($data)` - **The Frontend (React Native): Complete Rewrite** Most of the work will go into the frontend development since we can't use the HTML/CSS given by PHP directly for rendering. **UI Components:** - HTML `
` becomes `` - HTML `` or `

` becomes `` - HTML `` becomes `` - HTML `