forge-docs

0009. User Profile Storage Strategy

Status: Accepted Date: 2025-11-25 Context: Cognito handles auth; we must store extended profile attributes beyond basic identity and choose Cognito attributes vs application database.

Context

We must choose between:

  1. Storing extended attributes directly in AWS Cognito user attributes, or
  2. Using Cognito only for authentication and storing extended attributes in our own application database (e.g., RDS).

Enterprise requirements include: scalability, schema evolution, auditability, portability, integration with domain models, and avoiding vendor lock-in.


Decision

Use Cognito exclusively for identity and authentication and store all extended user profile attributes in our application database (RDS). Cognito remains the identity provider; the application database becomes the system of record for user profile data.


Rationale

Why not store extended attributes in Cognito

Why store extended attributes in our own DB


Store the following in Cognito (minimal identity set)

Attribute Reason
sub Unique, stable user identifier
email Primary login credential
email_verified Auth logic / token claims
phone_number (optional) Required only if used for MFA
given_name / family_name (optional) Convenience, but not mandatory

Store the following in the application database (system of record)


Architecture Overview

                    AWS Cognito (IdP)
                    - Authentication
                    - Tokens
                    - MFA
                          |
                          | sub
                          v
           Application Database (RDS)
           - User Profile (system of record)
           - Preferences
           - Media references (S3)
           - Domain model relationships

User creation flow:

Application access flow:


Consequences

Positive

Negative