Story 4.1.5a: Architecture Consolidation for Anonymous Event Registration

Last updated: November 13, 2025 Reading time: 10 minutes File size: 15.07 KB

Story 4.1.5a: Architecture Consolidation for Anonymous Event Registration

Status

In Progress

Story

As an architect/developer, I want to consolidate and align all architecture documentation for anonymous event registration, so that stories 4.1.5 and 4.1.6 can be implemented with consistent, accurate architecture and clean normalized microservices patterns.

Domain Context

Primary Domain

Cross-cutting (Architecture & Documentation)

Involved Services

  • Company User Management Service (user_profiles table)
  • Event Management Service (registrations table)
  • API Gateway (routing and security)
  • web-frontend (React 19 + TypeScript)

Cross-Domain Dependencies

  • Event Service β†’ User Management Service (via existing UserManagementClient)
  • User Management Service ← Cognito (account linking on first login)

Requirements Context

  • Epic 4, Story 4.1 (Public Event Website)
  • Prepares for Story 4.1.5 (Registration Wizard)
  • Prepares for Story 4.1.6 (Registration Confirmation)

Problem Statement

Current stories 4.1.5 and 4.1.6 contain architectural inconsistencies that must be resolved before implementation:

  1. Wrong Endpoints: Stories reference /api/v1/registrations instead of /api/v1/events/{eventCode}/registrations
  2. Wrong Registration Scope: Stories suggest session registration instead of whole-event registration
  3. Data Duplication: registrations table duplicates user data (attendee_name, attendee_email) that exists in user_profiles
  4. No Anonymous Support: user_profiles.cognito_id is NOT NULL, preventing anonymous registration
  5. Missing ADR: No documented architecture decision for anonymous registration pattern
  6. Wireframe Misalignment: Stories don’t match wireframes for registration flow

Acceptance Criteria

  1. βœ… ADR-005 created documenting anonymous registration architecture
  2. βœ… Database migrations created (but not yet applied):
    • V9 Shared Kernel: Make user_profiles.cognito_id NULLABLE
    • V9 Event Management: Remove denormalized attendee fields from registrations
  3. βœ… Data Architecture updated (03-data-architecture.md):
    • Fix table name: event_registrations β†’ registrations
    • Update user_profiles schema (cognito_id NULLABLE)
    • Update registrations schema (remove attendee_name, attendee_email, attendee_id)
    • Document cross-service reference pattern
  4. βœ… API Architecture updated (04-api-event-management.md):
    • Correct endpoints: /api/v1/events/{eventCode}/registrations
    • Document anonymous registration flow
    • Document UserManagementClient reuse pattern
  5. βœ… OpenAPI specs updated:
    • events-api.openapi.yml: Update CreateRegistrationRequest, remove sessionIds
    • user-management-api.openapi.yml: Document user endpoints
  6. βœ… Wireframes updated:
    • Add account linking CTAs and flows
    • Remove session selection references
  7. βœ… Stories 4.1.5 and 4.1.6 corrected:
    • Fix endpoints
    • Remove session selection (whole-event registration only)
    • Document cross-service user creation flow
    • Reference ADR-005

Tasks / Subtasks

Phase 1: Create ADR-005 - Anonymous Registration Architecture

  • Task 1: Create ADR-005 document
    • File:

Phase 2: Create Database Migrations

  • Task 2: Create V9 migration for Shared Kernel (user_profiles)

    • File:
    • Note
  • Task 3: Create V9 migration for Event Management (registrations)

    • File:
    • Note

Phase 3: Update Architecture Documentation

  • Task 4: Update Data Architecture (03-data-architecture.md)

    • sql
      CREATE TABLE registrations (
          id UUID PRIMARY KEY,
          event_id UUID NOT NULL REFERENCES events(id),
          registration_code VARCHAR(100) UNIQUE NOT NULL,
          attendee_username VARCHAR(100) NOT NULL,  -- Reference to user_profiles
          status VARCHAR(50) NOT NULL,
          registration_date TIMESTAMP WITH TIME ZONE,
          created_at TIMESTAMP WITH TIME ZONE,
          updated_at TIMESTAMP WITH TIME ZONE,
          UNIQUE(event_id, attendee_username)
      );
      
  • Task 5: Update API Architecture (04-api-event-management.md)

    • Document correct endpoints:
      1. Public user submits registration form
      2. Event Service calls User Management API to create/find user_profile (cognito_id=NULL)
      3. Event Service creates registration with attendee_username reference
    • Add account linking endpoint:

Phase 4: Update OpenAPI Specifications

  • Task 6: Update events-api.openapi.yml

    • Update CreateRegistrationRequest
      • Add: firstName, lastName, company, role
      • Remove: sessionIds (whole-event registration only)
    • Update Registration
      • Remove: attendeeName, attendeeEmail (client must call User Management API)
      • Keep: registrationCode, attendeeUsername, eventId, status
    • Update endpoint documentation:
  • Task 7: Create/Update user-management-api.openapi.yml

    • Define GET /api/v1/users/{username}
    • Define GET /api/v1/users?usernames={list}
    • Define POST /api/v1/users/anonymous
    • Define POST /api/v1/users/{username}/link-account

Phase 5: Update Wireframes

  • Task 8: Update story-2.4-event-registration.md wireframe

  • Task 9: Update story-2.4-registration-confirmation.md wireframe

      • View all your registrations in one place
      • Receive personalized event updates
      • Manage your profile information
      1. User clicks β€œCreate Account” button
      2. Redirected to account creation with email pre-filled
      3. On first Cognito login, auto-link to existing user_profile
    • Update endpoints to correct pattern:

Phase 6: Correct Stories 4.1.5 and 4.1.6

  • Task 10: Correct Story 4.1.5 (registration-wizard.md)

    • Fix endpoint: POST /api/v1/registrations β†’
    • Fix endpoint: GET /api/v1/registrations/{id} β†’
    • Update AC: Make it 2-step wizard
    • Update SecurityConfig: .permitAll() for
      1. Event Service receives public registration request
      2. Event Service calls User Management API (via existing UserManagementClient)
      3. User Management creates/finds user_profile by email (cognito_id=NULL if new)
      4. Event Service creates registration with attendee_username reference
  • Task 11: Correct Story 4.1.6 (registration-confirmation.md)

    • Fix endpoints to use pattern:

Dev Notes - Implementation Guide

Migration Timing

CRITICAL: The database migrations created in this story are NOT applied yet. They will be applied during the implementation of Story 4.1.5.

Reason: We want to align all documentation first, then apply schema changes together with the code implementation to maintain consistency.

Cross-Service Architecture Pattern

This consolidation establishes a clean microservices architecture:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Event Management Service                    β”‚
β”‚                                             β”‚
β”‚  registrations table:                       β”‚
β”‚  - id, event_id, registration_code         β”‚
β”‚  - attendee_username (ref to user_profiles)β”‚
β”‚  - status, registration_date               β”‚
β”‚                                             β”‚
β”‚  RegistrationService:                       β”‚
β”‚  1. Receive registration request           β”‚
β”‚  2. Call UserManagementClient (existing)    β”‚
β”‚  3. Create/find user_profile               β”‚
β”‚  4. Create registration with username ref   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚ HTTP API Call
                  β”‚ (via UserManagementClient)
                  β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Company User Management Service             β”‚
β”‚                                             β”‚
β”‚  user_profiles table:                       β”‚
β”‚  - id, username, email                      β”‚
β”‚  - cognito_user_id (NULLABLE)              β”‚
β”‚  - first_name, last_name, company          β”‚
β”‚                                             β”‚
β”‚  UserService:                               β”‚
β”‚  - Create anonymous user (cognito_id=NULL) β”‚
β”‚  - Link account on first Cognito login     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Benefits of This Architecture

βœ… Single Source of Truth: User data lives only in user_profiles βœ… No Data Duplication: registrations reference users, don’t duplicate βœ… Microservices Independence: Services communicate via APIs, not shared DB βœ… Clean Domain Boundaries: Event Service = events/registrations, User Service = users βœ… Scalable: Can cache user lookups, batch queries prevent N+1 βœ… Reuse Existing Infrastructure: Leverages existing UserManagementClient from speaker integration

Whole-Event Registration (Not Sessions)

Decision: Registrations are for the whole event, not individual sessions.

Rationale:

  • Matches wireframes (no session selection shown)
  • Matches existing data model (registrations.UNIQUE(event_id, attendee_username))
  • Simpler user experience
  • Session preferences can be tracked separately if needed for capacity planning (future story)

Anonymous to Authenticated Flow

Anonymous Registration (Story 4.1.5):

  1. User registers without creating account
  2. user_profile created with cognito_id=NULL
  3. Email is unique identifier

Account Creation (Story 4.1.6+):

  1. User decides to create account from confirmation page
  2. Redirected to signup with email pre-filled
  3. User completes Cognito registration

Auto-Linking (Post-authentication):

  1. Cognito post-authentication trigger fires on first login
  2. Finds user_profile by email where cognito_id IS NULL
  3. Sets cognito_id on existing user_profile
  4. User now has authenticated account with previous registration history

Testing Strategy

This story is documentation-only, so testing focuses on:

  1. Alignment Review: All documents reference consistent endpoints, schemas, and flows
  2. ADR Completeness: ADR-005 provides clear architectural guidance
  3. Migration Correctness: SQL migrations are syntactically correct (verify with --dry-run or syntax check)
  4. Cross-References: All documents reference ADR-005 where appropriate
  5. Wireframe Alignment: Stories match updated wireframes

No code testing required - migrations will be tested during Story 4.1.5 implementation.

Definition of Done

Change Log

Date Version Description Author
2025-11-08 1.0 Initial story creation for architecture consolidation Winston (Architect Agent)