Skip to content

Task: Create Diagram Showing Separation of Concerns #172

Closed

Description

@nelsonic

I've described the following separation of concerns in our stack:

  1. Authentication/Authorisation functions including storage of personally identifiable information such as social security (NIF), Phone Number, email, (hashed) password, IP address and location data, should be stored on a logically separate and highly secured database instance which regular engineers never need to touch. This adds much needed additional security for mitigating personal data breaches.

  2. Business Logic is contained within the Web App which connects with Auth whenever a user data, roles or permissions query is required. All functionality described in the Technical Brief can (should) be built this way. All “Transaction data” (owned by the business) references a user_id owned by Auth service.

  3. Analytics & Logging - the lifeblood of any business - is the 3rd separate service. We recommend running an instance of plausible.io or paying for the hosted service (€19/month), it includes all of the core features of Google Analytics without the privacy concerns of leaking personal data. Treating Analytics data as logically separate from Business Logic is best practice because it is not the core functionality of the business so the service should not impact response times of requests for a desk/booking.

  4. Comms Service - We deploy a separate Comms Service for handling sending email and notifications. This uses 3rd-party service such as AWS or Twilio to handle the delivery. Having Comms separate from App means engineers never have the Twilio or AWS API Keys on their machine and cannot accidentally leak them (huge headache/cost). The App code just calls the service with a simple request: “Send Booking Confirmed email to user_id:123”.

  5. API requests are handled by the Web App without incurring additional complexity; the same endpoints that render HTML can render JSON. The same Auth and WebSockets used by the Web App can be consumed natively by the Mobile Client. When the traffic volume justifies spinning up a dedicated API server, it’s simply an additional instance without any incremental devops overhead.

Todo

  • Create a Basic Diagram that illustrates this separation of services.

Activity

  1. nelsonic commented on Jul 31, 2026

    @nelsonic
    MemberAuthor

    Gonna pick this up in the morning.
    But first ... 🛌

  2. nelsonic commented on Aug 4, 2026

    @nelsonic
    MemberAuthor

    Made a minor detour to update this repo: https://github.com/dwyl/learn-phoenix 🧑‍💻 ⏳

  3. nelsonic commented on Aug 7, 2026

    @nelsonic
    MemberAuthor

    Spent way too long refreshing my memory on mermaid diagrams to create this:

    ---
    config:
      theme: 'base'
      themeVariables:
        primaryColor: '#CEF4EE'
        primaryTextColor: '#556A72'
        lineColor: '#F8B229'
        secondaryColor: '#006100'
      flowchart:
        defaultRenderer: "elk"
    ---
    graph BT
    
        WebClient["<h3>Web Client</h3>(All Devices)"]
        MobileApp["<h4>Native Mobile App</h4><br/>(iOS / Android)"]
        
        WebClient <--> WebApp
        MobileApp <--> WebApp
        
        WebApp["<h2>Phoenix Web App</h2><br /> Handles all Web/API requests involving <b>Business Logic</b>. Serves HTTP, JSON and WebSocket Requests<br/>"]
        
        WebApp --> Auth["<h2>Auth</h2><br />
      Handles Authentication, Authorization, Permissions via Role-based Access Control"]
    
    	Auth --> authDb[(Auth DB)]
    	authDb --> authDb2[(Auth Backup)]
      Auth <--> Comms
    
        WebApp <--> Comms["<h2>Comms Service</h2><br /><b>3<sup>rd</sup> Party Services Send Email, SMS & Notifications</b>. 
    Tracks deliverability, open & click-through rate. Dashboards display stats + insights."]
    		Comms <--> AWS["<h3>AWS SES/SNS</h3> Sends Email, SMS and Mobile Notifications"]
        Comms --> comDb[(Comms DB)]
    		comDb --> backDb
    
    		WebApp <--> Analytics["<h2>Analytics + Logs</h2> Captures anonymous web/mobile analytics events and logs. Renders metrics dashboards."]
    		Analytics --> anaDb[(Analytics <br />+ Logs DB)]
    		anaDb --> backDb
    
       WebApp --> mainDb[("<h2>Main DB</h2>")]
    	 mainDb --> backDb[("<h2>Backup DB</h2> Read-only Replica")]
        
        classDef entryPoint stroke:#818cf8,fill:#eef2ff
        classDef WebApp stroke:#2dd4bf,fill:#f0fdfa
        classDef process stroke:#a78bfa,fill:#f5f3ff
        classDef tool stroke:#fb923c,fill:#fff7ed
    		classDef db stroke:#336791,fill:#e3edf5
    		classDef aws stroke:#252F3E,fill:#ffc267
    		
        class WebClient,MobileApp entryPoint
        class WebApp WebApp
        class Auth process
        class Comms,Analytics tool
    		class authDb,authDb2,mainDb,backDb,anaDb,comDb db
    		class AWS, aws
    
    Loading
  4. nelsonic commented on Aug 7, 2026

    @nelsonic
    MemberAuthor

    Sadly, the Mermaid renderer on my localhost (inside VSCode) renders the diagram much better than GitHub:

    So I think I'm going to have to re-do it manually as another Google Doc. 😢

  5. nelsonic commented on Aug 8, 2026

    @nelsonic
    MemberAuthor

    Really wanted the mermaid diagram to be decent.
    But sadly, had to resort to Google Drawing:

    https://docs.google.com/drawings/d/1ach2TPrH4Qhnvv1GjfU3lru-zT4ZpJEDjLdBliEm_9A/edit

    This is what I had in-mind.

    @iteles / @LuchoTurtle please review and LMK if you understand what all the "Boxes and Arrows" mean or if anything is unclear. 💬 🙏

  6. added a commit that references this issue on Aug 8, 2026
    e397f3c
  7. added
    enhancementNew feature or enhancement of existing functionality
    help wantedIf you can help make progress with this issue, please comment!
    technicalA technical issue that requires understanding of the code, infrastructure or dependencies
    priority-2Second highest priority, should be worked on as soon as the Priority-1 issues are finished
    awaiting-reviewAn issue or pull request that needs to be reviewed
    T5mQuick tasks that take 5 mins or less. See: GTD 2 min rule.
    on Aug 8, 2026
  8. added theissue type on Aug 8, 2026
  9. moved this to More ToDo ThanCanEver Be Done in Nelson's Liston Aug 8, 2026
  10. moved this from More ToDo ThanCanEver Be Done to Awaiting Feedback/Review in Nelson's Liston Aug 8, 2026
  11. LuchoTurtle commented on Aug 8, 2026

    @LuchoTurtle
    Member

    Looks great 🙏 although I'd recommend changing the replicas databases colour scheme so it's easier to differentiate

  12. nelsonic commented on Aug 8, 2026

    @nelsonic
    MemberAuthor

    @LuchoTurtle good feedback. Going to make them lighter blue to differentiate. 🧑‍🎨 🖌️ ⏳ BRB.

  13. nelsonic commented on Aug 8, 2026

    @nelsonic
    MemberAuthor

    @LuchoTurtle thanks again for the feedback. I've made the replicas lighter for clarity:

  14. added a commit that references this issue on Aug 8, 2026
  15. moved this from Awaiting Feedback/Review to Done in Nelson's Liston Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    T5mQuick tasks that take 5 mins or less. See: GTD 2 min rule.awaiting-reviewAn issue or pull request that needs to be reviewedenhancementNew feature or enhancement of existing functionalityhelp wantedIf you can help make progress with this issue, please comment!priority-2Second highest priority, should be worked on as soon as the Priority-1 issues are finishedtechnicalA technical issue that requires understanding of the code, infrastructure or dependencies

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions