title: How and where to resolve foreign key in microservice architecture
body: <p>We recently started splitting a big monolith into microservices. One of the challenges we come across is that <strong>how and where to resolve the foreign key</strong>.</p>
  
  <p>To give you a better perspective. We are planning to build the following microservices. Each of these services has their own dedicated database in order to make services independent.</p>
  
  <p><strong>PriceQuote Service</strong>, primarily responsible for managing prices based on variant and city</p>
  
  <pre><code>PriceQuote
  -----------------------   
  id(Pk)
  veriant_id(Fk)
  city_id(Fk)
  price
  </code></pre>
  
  <p><strong>CarData Service</strong>, There are three concerns clubbed in this microservice. Makes, Models, Variants</p>
  
  <pre><code>Variants
  -----------------------
  id(Pk)
  model_id(fk)
  name
  </code></pre>
  
  <p><strong>Location Service</strong>, States, cities, and areas clubbed in single microservice</p>
  
  <pre><code>Cities
  -----------------------
  id(Pk)
  state_id(fk)
  name
  </code></pre>
  
  <p>Please help me with the following concerns</p>
  
  <ol>
  <li><p><strong>Is this the right way of designing microservices?</strong></p></li>
  <li><p><strong>Where to resolve variant_id and city_id Fks while retrieving price<br>
  quote? inside or outside microservice?. if outside microservice? where?</strong></p></li>
  </ol>