Architecture

2021-03-13
2 min read

This document describes the overall architecture for MyChat - a hypothetical chat/messaging system.

Date: 2021-03-13

Status: Draft

Objectives

The objectives of this architecture document are to outline the architectural elements for the MyChat messaging service. This architecture should provide enough clarity for developers to create more detailed design documents for each of the major architectural components (if required).

Scope

This document only provides a overall the high-level architecture for MyChat.

Assumptions

The following assumptions have been made in regards to this document:

  • A known set of requirements have been created and accepted.
  • A basic understanding of chat/messaging system architecture.
  • A basic understanding of right-sized services.

Domains

The following are the top level domains:


Components

The MyChat service consists of the following components:

  • Account Management Service

    • User Profile (name, email, phone, address, etc.)
    • User Preferences (language, Timezone, etc.)
    • Identity Service (SSO, MFA, etc.)
  • Chat Spaces

    • Manage chat Spaces (create, delete, modify, add/delete users)
  • Notification Service

    • Handle communications with users via (email, SMS)
      • Notify if of new messages
      • Invitation to join a chat Space
  • Message Service

    • SSE Emitter for chat spaces
    • Handle input of messages to be queued for chat spaces

Component Interactions

Login

A user may authenticate to MyChat via SSO. The following details that interaction:

Once a user is logged in a token will be create that will be passed to all authenticated APIs.

SSE Events

SSE handshake:


Database Requirements

Databases schemas should be designed based on the type of required queries.

Account Management

The Account Management domain has the following database queries:

  • Get account information by account ID
  • Modify account information.
  • Delete (may just flag a user as inactive unless deletion required by PII/GDPR)

Chat Spaces

The Chat Spaces domain has the following database queries:

  • Get all Chat Spaces for a given account ID
  • Add account ID to a given Chat Space
  • Delete account ID from a given Chat Space
  • Delete Chat Space for a given account ID
  • Modify Chat Space attributes (TBD)
  • Get messages starting from a given date from a Chat Space
  • Delete messages starting from a given date from a Chat Space (depending on governance regulations)

Questions to be Resolved

  • How do determine the SSE “capacity” of servers?
  • Do we need to setup GEO-located servers to meet the latency requirements?
  • Can we use a “wrapped” Webview for desktop applications?
  • How do we manage the encryption keys for encrypted data (when to rotate, who owns the private key etc.)

References