forge-docs

0004. Use AWS Cognito Across All Environments (Production and Development)

Status: Accepted Date: 2025-10-27 Context: Continuation of ADR-0003 (Auth); unified Cognito across environments after development tooling and cost analysis.

Context

We need a unified authentication strategy for a web application that supports:

  1. User login with username/password
  2. Social login via Google, Facebook, etc.
  3. Service-to-service authentication between backend services using JWTs

Constraints and considerations:


Options Considered

Option 1: Keycloak (Self-hosted)

Pros:

Cons:

Verdict: Not ideal — adds operational burden and duplicates functionality available via AWS services.


Option 2: jagregory/cognito-local (Local Development Emulator)

Pros:

Cons:

Verdict: Useful for local JWT-based testing, but insufficient for social login emulation.


Option 3: AWS Cognito (Managed Service)

Pros:

Cons:

Verdict: Best fit for both production and development - provides full functionality at minimal cost using AWS free tier.


Decision

We will adopt the following strategy:

Environment Auth Provider Features
Production / Staging AWS Cognito User Pools (username/password), Identity Pools (social login), JWTs for service-to-service
Development / Local AWS Cognito User Pools (username/password), Identity Pools (social login), JWTs for service-to-service

Key Notes:


Consequences


References / Investigations


This ADR ensures that authentication is consistent, secure, and cost-effective across all environments, while providing full functionality without expensive development tools.