How universal-connect-project/ucp-hosted-app works
Project Type and Purpose
• This is a monorepo managed with TurboRepo that consolidates multiple UCP-hosted services and applications. It is not a customer-hosted service but supports integration with a separate customer-hosted UCW-App.
• The README lists three primary applications:
– Authentication Service: Manages authentication and API key management (leverages Auth0).
– Institution Service: Manages CRUD operations on an institution list and handles institution data.
– UCP UI: A dashboard web application that interacts with the backend services for account management and service operations.
• There’s also a Performance Service (and likely additional shared packages like backend-utils and shared-utils) that provides metrics or specialized functions, which should be included if it’s part of the deployed architecture.
Main Components and Their Structure
• Backend Services (Microservices):
– Authentication Service (located in apps/authentication-service): Contains configuration files, middleware (e.g., error handling, auth middleware), and resources for handling clients, users, and token utilities.
– Institution Service (located in apps/institution-service): Includes controllers, models, routes, migrations, seeders, and services for handling institutions and aggregator integrations.
– Performance Service (located in apps/performance-service): Manages event handling, performance metrics, and integrates with external systems (such as InfluxDB and Redis) for storing and retrieving performance data.
• Frontend Application:
– UCP UI (located in apps/ucp-ui): A React-based dashboard application with multiple modules (e.g., Institutions, Authentication Wrapper, shared UI components) that interacts with the backend.
• Shared and Utility Packages:
– packages/backend-utils: Contains shared functions (e.g., access token management, validation functions) used across backend services.
– packages/shared-utils: Provides common constants and utilities.
• Supporting Files and Configuration:
– CI/CD configurations in the .github/workflows directory indicate rigorous testing (e2e, unit, linting, performance) ensuring each component is verified.
– Deployment files (Procfile, app.json, nodemon.json, etc.) present in various apps indicate how these services are deployed and managed.
– TurboRepo configuration (turbo.json) for managing build and dependency processes.
Relationships and Interactions
• Data Flow:
– The UCP UI (frontend) sends HTTP requests or REST API calls to the Authentication and Institution services.
– The Authentication Service provides API key management and ensures that only validated users interact with other services.
– The Institution Service receives requests from both the UI and other systems (like the external UCW-App) and interacts with the database (shown by the migrations, seeders, and defined models).
– The Performance Service collects and exposes performance-related metrics, likely interfacing with data stores like Redis (for caching/storage) and InfluxDB (for time-series metrics).
• Shared utilities or libraries are used by multiple services ensuring consistent validation, token handling, and configuration across services.
Architectural Patterns and Design Principles
• Microservices Architecture: Each application (Authentication, Institution, Performance) is relatively self-contained with its own routing, controllers, middleware, and testing suites. They expose APIs for interaction, following separation of concerns and scalability.
• Modular UI Development: The UCP UI is structured with clear component boundaries, feature modules (like Institution management, API key management, etc.), and uses React ecosystem conventions.
• Shared Code Reusability: Common functionalities encapsulated in packages (backend-utils, shared-utils) reduce code duplication and enforce standard practices.
• CI/CD Integration: Extensive GitHub workflows reflect automated testing, linting, and performance monitoring.