bcc-code / developer.bcc.no

BCC Developer Portal with technical documentation and other resources for developers
https://developer.bcc.no/
5 stars 5 forks source link

[ADR] Microservice migration for Members 2.0 #40

Open JakubC-projects opened 2 years ago

JakubC-projects commented 2 years ago

title: Future Architecture for Services in "Members" description: High level target architecture for services implemented in Members (as of March 2022)

Context

Members 2.0 was developed as an application for managing person data and organizational membership as well as facilitating sharing of data with other systems in a GDPR-compliant manner. During the initial development fase, there has been a heavy focus on UX and the application experience, and less of a focus on the maturity of back-end services and APIs. This has given many "quick" wins, however in this second development fase the focus will be on creating stable and mature backend-services that can be used to provide value and enable other teams to deliver applications/services that are dependent on person, organization and membership data.

Current Issues and Symptoms

Brainstorm (from workshop)

  1. Users without a membership can't log in
  2. No support for multiple addresses (work/private etc.)
  3. Legacy integrations - no public API
  4. Access to BCC systems limited to members
  5. Managing data access (GDPR) possibly overcomplicated
  6. Data deletion webhooks not implemented
  7. API Landscape is not mapped out and not aligned
  8. Users are frustrated with amount and complexity of Apps
    • Family registration(profile)
    • Look and feel of BCC Apps
  9. Changes are not enfoced on other Applications (e.g. signout)
  10. Lack of test environment (require access to production)
  11. 5 minute test time
  12. 10 minute Deploy time
  13. Lacking global roles
  14. Lacking business specification

Observations

  1. In general, "person" and "membership" is too tightly intertwined to support more flexible scenarios.

  2. It is currently difficult to communicate with other teams (changes not enforced) due to:

    • no real public / documented API
    • no client SDKs
    • product/team culture is stronger than organization culture which is reflected in the architecture
  3. Somewhat challenging to set up local development environment and gain full insight into current application

    • Mix of concerns within application: process, presentation and integration tightly intertwined
    • Simple errors would require a fairly high level of project knowledge to fix with current solution (both due to code base size and especially due to mix of concerns in code)

Conlusion: we need a better separation of concerns (both from a business and technical perspective) and we need a commitment to our public interface.

Decision

  1. Host core APIs related to person, association and organization in one (or few) services (with a public contract). Motivation: clear separaton of concerns, highly reusable services that could form part of multiple processes

  2. Create a separate profile service (which interfaces to multiple environments and has a different behavioural concern - Query vs. Command) Motivation: clear separation of concen, possible interface to multiple other source services and many target applications

  3. Keep current "feathers" structure as a BFF (for Members) which utilizes the core APIs Motivation: leverage work already done regarding UI, membership processes etc.

  4. Long term, it may also make sense to move the "membership processes" from the current "feathers" implementation. This would be specifically useful if membership flows were integrated with other systems. (fase 2)

Consequences

  1. Need to define and create new services

  2. Ideally need a microservice hosting environment (already partially being practiced via Cloud Run in all teams)

  3. We need a messaging infrastructure

  4. We need a good solution for API documentation / consumption (e.g. Open API - v2, Protobuf, GraphQL, SDKs)

  5. Migration of legacy integrations

Alternatives

  1. Cleanup current solution (monolith)

    • split presentation and domain layers
    • define public API interface(s)
    • move out highly unrelated services
  2. Move fundamental services to their own APIs (microservice approach)

    • integrate current application (front-end) with new backend services
    • ensure clean separation of concerns: application (UI), data aggregation (e.g. profile) and process (e.g. change history etc.)

Reasons for Monolith approach (one code base, one process)

Reasons for Microservice approach (one or multiple code bases, multiple processes)

Pitfalls for Microservice approach

What do we want to achieve?

  1. End-product should be highly coherent

    • Design/UX
    • Process flow
    • Data consistency (e.g. common profile etc.)
  2. Services should be developed and deployed individually

    • Front-end
    • Processes / integrations
    • Data

At a high level, there should be easy communication and high coherence between teams. At a low level, there should be very little inter-team dependencies.

Can we find a sweet spot?

github-actions[bot] commented 2 years ago

Remember that ADRs are publicly available hence do not include any confidential information in the issue description! To read more about ADR please refer to documentation.