Skip to content

braintelligencePL/project-manager-kotlin

Repository files navigation

Build Status 🛠

Project-Manager

Journey from layered (n-tier) architecture to hexagonal architecture in Kotlin 💪

Project-Manager is a simple application for managing projects at company. You can create teams and add members to it. You can create, modify projects and assing teams to them. (basically something similar to Trello - wiki)

We'll go from traditional layered architecture to hexagonal architecture A.K.A. Ports and Adapters architecture.

Working with Project-Manager

./gradlew bootRun - to run application.
./gradlew test - to run unit tests.
./gradlew clean build test- one to rule them all 💍

Implementation step-by-step


1️⃣ branch: step-1-team

🏠 Architecture: Layered Architecure
🕳 Tests: Integration/Acceptance with TDD/BDD approach (more like BDD).

  • POST: /teams - create a team.
  • POST: /teams/:teamName/members - add members to the team.
  • GET: /teams - show teams.

Needs and constraints:

  • Team cannot be created if already exists
  • How many projects team has?

2️⃣ branch: step-2-projects

🏠 Architecture: Layered Architecure
🕳 Tests: Integration/Acceptance with TDD/BDD approach (more like BDD).

  • POST: /projects/drafts - create project draft (only project name).
  • POST: /projects - create full project (project with features📊).
  • GET: /projects - show draft projects

Needs and constraints:

  • JobPosition must be valid (Developer, Scrum Master...)
  • Team can have no more than 3 projects at the time

3️⃣ branch: step-3-refactor

🏠 Architecture: Hexagonal Architecure

Refactor to hexagonal architecture. Removed unnesesary Dto objects. Test cleanup.

4️⃣ branch: step-4-refactor

Refactor introducing simple CQRS.

5️⃣ branch: step-5-projects

🏠 Architecture: Hexagonal Architecure

  • GET: /projects/:id - show project (project not project draft)
  • PUT: /projects/:id - change/update project
  • PATCH: /projects/:id/started - start team when team assigned
  • PATCH: /projects/:id/ended - close project when features are done


5️⃣ branch: step-5-zoo-of-microservices

🏠 Architecture: Hexagonal Architecture (modularization on package level)
🕳 Tests: Integration/Acceptance/Unit
Backing-Services from Twelve-Factor-App methodology.

Services from our zoo:
🦓 user-autorization-service - authentication gateway that protects back-end resources. There is two kinds of resources protected and unprotected. First one requires user-level authentication and second one is just read-only such as listing of offers/products.

🐼 edge-service - gives possibility to expose unified REST API from all of ours backend services. To be able to do this, the Edge Service matches a request route’s URL fragment from a front-end application to a back-end microservice through a reverse proxy to retrieve the remote REST API response.

🐰 discovery-service - Edge-service matches a request route’s URL fragment from a front-end application to a back-end microservice through a reverse proxy to retrieve the remote REST API response.

🐿 centralized-configuration-server - Spring Cloud application that centralizes external configurations using various methodologies of building twelve-factor applications.


#️⃣ branch: will-be-more

  • monitoring, grafana, actuator, performance tests with gatling



Technologies used:

  • Kotlin with spring
  • Spock (groovy) for tests
  • ArchUnit (kotlin) for architecture tests
  • Gradle to build project

Materials from mine blog:

Materials from outside world: