4

I try to implement and document a Software Project, where I have a mobile App for the Frontend and different Microservices to save new users an so on. So to structure all the architecture: Is it correct that I use a client server architecture, where the server is implemented using a microservice architecture? Or is there anything I understand wrong?

softwareUser
  • 398
  • 2
  • 6
  • 21

1 Answers1

8

Short answer:

It depends who you ask. In simple you could say yes your server side is your microservice or multiple of them working to provide some service to one or multiple clients like your mobile app, some Web/Browser app and other type of client applications. Keep in mind that microservices is an software architecture pattern for backend which most of the time runs on some server/servers. Some people will have a different opinion on this regarding the term "Client-server model". I will try to explain bellow.

Longer answer:

  • Client-Server model historical/classic overview: Be careful with the terminology in your Documentation as it may confuse people. There are a lot of people which when you say "Client-Server architecture or model" could think of the traditional Client-Server applications. In this traditional/classic sense the client is a dedicated application(Desktop app like Outlook, Skype for Desktop or similar) which runs on the client computer and which communicates through the network with the remote server. In this sense the client and server can run on separate computers but could also run on the same computer. Coming from this way of thinking a Web application is not a Client-server application because it has not a dedicated application representing the client. It uses the Browser to represent the client which is not a dedicated application. So if your mobile app is a native app or a hybrid app(dedicated application) it would go more in the direction of the historical "Client-Server architecture or model". If it is Mobile web application(running in Browser) it would not. When it comes to the server part the difference is between classic "Client-Server" and microservices can be seen similar as the differences between "Client-Server" and SOA(Service oriented architecture). In this classic "Client-Server architecture or model" the client and server are more coupled and developed to be used together. When it comes to microservices architecture and the services they expose are usually designed to be used loosely coupled and to serve multiple different clients(mobile app, web app and so on). In this question you can read more about the differences between SOA and "Client-Server": SOA vs Client-Server vs Web Service - what is the difference?

  • Client-Server model as as loose concept/term: On the other side there are also a lot of people who use the term "Client-Server Architecture or model" thinking of any kind of client application representing the "Client part" and not only dedicated Desktop application. When it comes to the server side any kind of server(web server, file server or other regardless of which internal architecture they use) would represent the server. So for example a Mobile app(Native, Hybrid or Browser based) or a Web application(Single page application and other) communicating with some server would be considered as the "Client-Server architecture or model". This way the "Client-server architecture or model" is used as generic term. If you read the Wikipedia (https://en.wikipedia.org/wiki/Client%E2%80%93server_model) page for the Client-server model you could get that impression as well. Your client application communicates with your server through the network to exchange some content. Most of the time over HTTP or other protocols. If the server-side has multiple services(microservices) deployed on one or multiple machines to serve the content is not so important for your client. So from this standpoint the term you have a "Client-Server model".

Your case: For your case it depends how exactly your server part is used or run. I am not sure how you do it in your application but from my experience there are multiple ways to communicate with your server side. The 2 most common ways to do the communication between the client and micorservice:

  1. Client communicates through Api-Gateway
  2. Client communicates directly with the microservice

Here is an article which explains the 2 approaches: https://learn.microsoft.com/en-us/dotnet/standard/microservices-architecture/architect-microservice-container-applications/direct-client-to-microservice-communication-versus-the-api-gateway-pattern

In general the term "Client-server" could be understood wrongly. My suggestion is to describe your architecture in your documentation a little more specific to avoid confusion. You could say for example that you have have a system which on the server side is running on top of a microservice architecture and your client is a mobile application which uses the services from one or multiple microservices(directly or through some proxy, api gateway or other). This really depends on your concrete architecture.

Hope this helps.

xargs
  • 2,741
  • 2
  • 21
  • 33
  • Thats a nice explanation. I have slightly modified question: Can we use same microservice to serve both Mobile app & a web client (browser)? Are there any conventions where guidelines provided when to use same microservice or separate it for browsers & mobile app? – Saurabhcdt Jan 13 '21 at 03:17
  • There is nothing stopping you to use a micro-service from multiple clients. Actually it is a common thing to do. Usually the micro-service exposes some kind of API(Rest, GraphQL, gRPC or something else) which you can use from one or multiple Clients. – xargs Jun 08 '21 at 16:58