# evervault/evervault-js architecture

> Architecture diagram of the GitHub repository evervault/evervault-js, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/evervault/evervault-js
- Repository: https://github.com/evervault/evervault-js

## Overview

##### Main Components Structure

a) Public SDK Packages (Core Components):
- Browser SDK
- React SDK
- React Native SDK
- Card Validator

b) Private Supporting Packages:
- 3DS Authentication
- Input Components
- UI Components
- Shared Themes
- Type Definitions

c) Infrastructure Layer:
- CDN Distribution (js.evervault.com, inputs.evervault.com, etc.)
- Development/Staging Environments
- E2E Testing Infrastructure

##### Component Relationships and Data Flow

**[Client Applications] → [Public SDKs]**
- ↓
**[UI Components Layer]**
- ↓
**[Core Services Layer]**
- ↓
**[Infrastructure Layer]**

##### Detailed Component Breakdown

For each major component, include:

a) Browser SDK:
- Crypto Operations
- Form Handling
- HTTP Client
- Event Management
- UI Integration

b) React/React Native Components:
- Card Components
- 3DS Authentication
- PIN Input
- Reveal Functionality
- Payment Provider Integration (Apple Pay/Google Pay)

##### Cross-Cutting Concerns

Shared services:
- Type System
- Theme Management
- Configuration Management
- Testing Infrastructure

##### Deployment Architecture

Distribution system:
- CDN endpoints
- Version management
- Environment separation (Production/Staging)

##### Integration Points

External integration:
- Payment providers
- Security services
- Authentication systems

##### Development Workflow

A small section showing:
- Local development flow
- Testing pipeline
- Release management with changesets

Remember to emphasize:
- Security boundaries
- Version management
- Package interdependencies
- External service integration points
- Development and deployment workflows

This will provide a comprehensive view of the system while maintaining clarity and usefulness for the principal software engineer.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        CA[Client Applications]
    end

    subgraph "Public SDK Packages"
        direction LR
        BS["Browser SDK"]:::public
        RS["React SDK"]:::public
        RN["React Native SDK"]:::public
        CV["Card Validator"]:::public
    end

    subgraph "Private Supporting Packages"
        direction LR
        TDS["3DS Authentication"]:::private
        IC["Input Components"]:::private
        UC["UI Components"]:::private
        ST["Shared Themes"]:::private
        TD["Type Definitions"]:::private
    end

    subgraph "Core Services"
        direction LR
        CO["Crypto Operations"]:::core
        FH["Form Handling"]:::core
        UI["UI Integration"]:::core
        PP["Payment Provider Integration"]:::core
    end

    subgraph "Infrastructure"
        direction LR
        CDN["CDN Distribution"]:::infra
        DEV["Development Environment"]:::infra
        E2E["E2E Testing Infrastructure"]:::infra
    end

    CA --> BS & RS & RN
    BS --> CO & FH & UI & PP
    RS --> IC & UC
    RN --> IC & UC
    UI --> TDS
    IC --> ST
    UC --> ST
    PP --> TDS
    BS & RS & RN --> TD
    CO & FH & UI --> CDN
    DEV --> E2E

    %% Click Events
    click BS "https://github.com/evervault/evervault-js/tree/master/packages/browser"
    click RS "https://github.com/evervault/evervault-js/tree/master/packages/react"
    click RN "https://github.com/evervault/evervault-js/tree/master/packages/react-native"
    click CV "https://github.com/evervault/evervault-js/tree/master/packages/card-validator"
    click TDS "https://github.com/evervault/evervault-js/tree/master/packages/3ds"
    click IC "https://github.com/evervault/evervault-js/tree/master/packages/inputs"
    click UC "https://github.com/evervault/evervault-js/tree/master/packages/ui-components"
    click ST "https://github.com/evervault/evervault-js/tree/master/packages/themes"
    click TD "https://github.com/evervault/evervault-js/tree/master/packages/types"
    click CO "https://github.com/evervault/evervault-js/blob/master/packages/browser/lib/core/crypto.ts"
    click FH "https://github.com/evervault/evervault-js/blob/master/packages/browser/lib/core/forms.ts"
    click UI "https://github.com/evervault/evervault-js/tree/master/packages/browser/lib/ui"
    click PP "https://github.com/evervault/evervault-js/blob/master/packages/browser/lib/ui/applePay.ts"
    click CDN "https://github.com/evervault/evervault-js/tree/master/statics/browser-cdn-root"
    click E2E "https://github.com/evervault/evervault-js/tree/master/e2e-tests"

    %% Styles
    classDef public fill:#a8d1ff,stroke:#333
    classDef private fill:#e6e6e6,stroke:#333
    classDef core fill:#90EE90,stroke:#333
    classDef infra fill:#FFB6C1,stroke:#333

    %% Legend
    subgraph Legend
        direction LR
        L1["Public Package"]:::public
        L2["Private Package"]:::private
        L3["Core Service"]:::core
        L4["Infrastructure"]:::infra
    end
```
