title: Share code for hybrid mobile app and desktop web app
body: <p>I want to build a brand new app that should be deployed both as a hybrid mobile app and a desktop web app.</p>
  
  <p>Mostly the logic and the user interface are very similar for both apps.
  Except for some differences:</p>
  
  <ol>
  <li>Screen size optimization for mobile (e.g. hidden side menus in mobile vs expanded ones in desktop)</li>
  <li>Touch gestures (3DTouch) in mobile vs hover functionalities in desktop</li>
  <li>Touch feedback for some elements in mobile</li>
  <li>Page navigation in mobile vs routing navigation in desktop</li>
  </ol>
  
  <p>I thought of using <a href="https://material.angular.io/components" rel="nofollow noreferrer">angular-material</a> components for desktop, and <a href="https://ionicframework.com/docs/api/" rel="nofollow noreferrer">Ionic</a> components and navigation for mobile as both are built on top of angular.</p>
  
  <p>Of course I aim to share as much code that I can, for the logic but also for UI container components.</p>
  
  <p>So I trying to think of a good way to structure my project while creating separate Angular Modules for the desktop UI, mobile UI, shared UI and logic:</p>
  
  <p>One option is to have one Core Module for both apps, importing the logic and the shared UI modules.Then switch between the specific platform UI module, when building for each platform. In this option the platform specific UI components will have the same <code>selector</code>s and <code>@Input</code>s, but will differ in their rendered UI.</p>
  
  <p>The second option is to have separate Core Modules for each platform app that will import the logic module and the shared UI components module.</p>
  
  <p>Maybe someone has experience of doing such a thing and can share his thoughts about the best project structure covering all of this?</p>
  
  <p>Or which project structure I've suggested is better?</p>