How stytchauth/stytch-node works
Main Components Organization
• B2C Authentication Services (Left)
• Shared Components (Center)
• B2B Authentication Services (Right)
Component Breakdown
A. B2C Authentication (Left Section):
• Related authentication methods:
• Magic Links Module
• OAuth Module
• Passwords Module
• OTP Module (SMS/Email/WhatsApp)
• WebAuthn Module
• Crypto Wallets Module
• Session Management
• User Management
• TOTP Module
B. Shared Components (Center Section):
• Base Client Implementation
• Error Handling
• Session Management
• M2M (Machine-to-Machine)
• Common Utilities (Base64, Environment)
• HTTP Client Layer (undici integration)
C. B2B Authentication (Right Section):
• Organizations Management
• Member Management
• RBAC System
• SSO Integration
• SAML
• OIDC
• Discovery Service
• MFA Components
• SCIM Integration
Connection and Flow Representation
• All authentication modules connecting to the central shared components
• Data flow between related modules (e.g., Passwords → Session Management)
• External service interactions (e.g., OAuth providers, SAML providers)
Implementation Details
Technical annotations showing:
• TypeScript types and interfaces
• API endpoint groupings
• Error handling paths
• Configuration options
Notes Section
Callouts for:
• Security considerations
• Configuration requirements
• Runtime requirements
• Type system integration
• Clear separation between B2B and B2C features
• Modular architecture allowing independent use of features
• Shared infrastructure components
• Type safety throughout the system
• Error handling paths
• External service integration points
Keep the abstraction level balanced:
• Enough detail to understand the component relationships
• Avoid overwhelming with implementation details
• Service boundaries and interactions
• Extension points and customization options