Search code examples
soamicroservices

Splitting and naming Microservices


I recently started a side-project. It was supposed to be a virtual recipe-book with the capabilities to store and retrieve recipes (CRUD), rate them and search through them. This is nothing new, but i wanted to build it as a desktop application to learn more about databases, unit testing, UIs and so on. Now that the core domain is pretty much done (i use a DDD approach) and i implemented most of the CRUD Repositories, i want to make this a bit more extensible by hosting the core functionality online, so i am able to write multiple backends (desktop application, web application, web api, etc).

Service Oriented Architecture (or Microservices) sound like a good approach to me to do that. The problem i am facing is how to decide, which parts of my project belong into a separate service and how to name them.

Take the following parts of the project:

  • Core domain (Aggregates, Entities, Value Objects, Logic) -> Java
  • Persistence (DAOs, Repositories, multiple Database backend implementations) -> Java
  • Search (Search Services which use SQL queries on the persistence DB for searching) -> Java
  • Desktop Application -> JS (Electron) or JavaFX
  • Web Application -> Flask or Rails
  • Web API (Manage, Rate, Search for recipes using REST) -> ?

My initial approach would be to put the core domain, the persistence, the search and the web api into a single sub-project and host that whole stack on Heroku or something similar. That way my clients could consume the web interface. The Desktop and Web apps would be different projects on their own. The Dektop app could share the core domain if they are both written in Java.

Is this a valid approach, or should i split the first service into smaller parts? How do you name these services?


Solution

  • Eric Evans on GOTO 2015 conference ( https://youtu.be/yPvef9R3k-M) and I 100% agree with him, answered to your question. Microservice scope should be one or maybe more Bounded Context(s). Including its supporting classes for persistence, REST/HTTP API, etc. As I understood, the microservice is deployment wrapper over Bounded Context, with adding the isolation, scaling and resilient aspects. As you wrote, you didn't apply Strategic Design to define bounded context. So its time to check, before tearing the app to parts.