How jpmorgan-payments/embedded-finance works
Based on our file structure and README analysis, this project is a full-stack showcase application for Embedded Finance. It comprises separate but related components: a React-based client UI, a server component that facilitates API calls (either to mocked internal endpoints or the live UAT APIs), an SDK (embedded-finance-sdk) for validation and payment logic, and a collection of embedded UI components (embedded-components) that provide reusable interface elements. There’s also a Postman collection to directly interface with the API endpoints.
Main Components
• Client Application (under “app/client”):
– A React front-end written in TypeScript/JavaScript.
– Contains feature-specific directories (Accounts, Authentication, Cases, DebitCards, Onboarding, etc.), state management, hooks, and UI components that interact with the Embedded Finance APIs.
• API Server (under “app/server”):
– A Node/Express (or similar) server that serves as the backend for API calls.
– Handles SSL setup for secure communication with external UAT endpoints (using certificate files as described in the README).
• Embedded Finance SDK (under “embedded-finance-sdk”):
– A separate package that encapsulates validation logic and domain-specific payment schemas.
– Published as a standalone npm package, it represents a critical library dependency.
• Embedded UI Components (under “embedded-components”):
– A library of reusable UI components (with components for form controls, onboarding wizards, linked account setup, etc.) especially crafted for the Embedded Finance user experience.
• External Components:
– Postman Collection (under “postman”) for direct API testing and demonstration.
– External APIs (represented by the live UAT endpoints and ForgeRock authentication service) that the server connects to when not using mocked responses.
Relationships & Data Flow
• The Client UI communicates with the API Server for all backend operations (e.g., submitting payment requests, account lookups).
• The API Server (if configured to use live endpoints) securely communicates with external systems (J.P. Morgan’s UAT environment and ForgeRock) using SSL authentication.
• The client makes use of the Embedded Finance SDK to validate data (for payments, debit cards, etc.) before sending requests.
• The UI is built using reusable components from the Embedded Components library—these components interact with stateful hooks and feature-specific modules.
• Mock Service Worker (MSW) is integrated into the client to intercept network calls for testing or demo purposes, as noted in the README.
Key Architectural Patterns & Design Principles
• Separation of Concerns: Clearly divide the UI (client), business logic/API interactions (server), and re-usable libraries (SDK and UI components).
• Modular Architecture: Each “feature” (e.g., Authentication, Transactions, Onboarding) is organized in its own folder, indicating a modular or domain-driven design approach.
• Environment Configuration: Use of environment variables and configuration files (e.g., VITE_FR_URL and VITE_FR_CLIENT) to swap between mocked data and live endpoint behavior.
• External Integration: SSL certificate management and secure API calls denote best practices in interfacing with external systems.
Final Elements
• Component names and directory mappings (as noted above).
• Annotations noting the use of MSW for service worker-based API mocking and the secure connection setup in the server configuration.