0

I'm developing an application where users can create projects. Each project has posts and tasks. I have three microservices: Projects, Posts and Tasks. There is some logic here:

  • All users can create projects
  • Only project owner can create posts
  • Only project members can create tasks

Project members logic (owner and members management) belongs to Project microservice. So, in CreateTask use-case, I need to check first if user is member of project.

fun createTask(projectId: String, task: String, userId: String) {
  if (!projectService.isMember(userId)) {
    throw Forbidden
  }
  // do stuff
}

And same for CreatePost use-case; I check whether user is the project's owner.

Currently, this check (projectService::isMember) makes an http call to Projects microservice, so both services, Tasks and Posts, are really coupled with Projects microservice.

How can I improve this? Should they belong to the same microservice? Should I extract members/owner management from Projects to another new microservice?

1
  • ’Each project has posts and tasks. I have three microservices: Projects, Posts and Tasks.’ Closely related concepts should not be separated into microservices.
    – Rik D
    Jul 6 at 18:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.