title: MVC Core and MVC Core API with Identity Server 4
body: <p>I have several projects done in MVC5 which I am looking at 'upgrading' to Dot Net Core with IdentityServer 4. Each project  has an API through which Android and iOS clients connect. The API and MVC are in the same project.</p>
  
  <p>I am currently working through the quickstart samples of IDS and have implemented IDS with and API and MVC client using the documentation found here <a href="http://docs.identityserver.io/en/release/" rel="nofollow noreferrer">docs.identityserver.io</a></p>
  
  <p>I am trying to get my head around the architecture of using the MVC client with the API where only the API would have a reference to the DbContext?</p>
  
  <p>Should the API and MVC Client be in the same project or in 2 separate projects? </p>
  
  <p>I also assume then that data to be retrieved and saved to the database should be managed by the API only? No sense in having 2 places where Entity Framework is used (API and MVC) if I now see the MVC client in a similar light as an Android/iOS Client?</p>
  
  <p>I am also assuming that Razor Views can be migrated to DotNet core easier than creating new ones?</p>
  
  <p>But then there are 2 sets of controllers, one for API and one for MVC. MVC would then connect to API using HttpClient (or RestSharp?). This seams like an extremely bloated approach where I'd have to do API calls in my MVC controllers' actions. As compared to using an ApplicationDbContext?</p>
  
  <p>Or am I going about this all wrong?</p>