How enterprise-cmcs/macpro-mako works
Main Components
• Frontend Client: The “react-app” directory shows all the React UI code. This component handles user interfaces for tasks such as form submissions, package tracking, and other interactions.
• Backend API and Serverless Functions: Under “lib/lambda” are many Lambda functions (e.g., submission handling, email processing, index management, and notifications). These functions represent the core business logic.
• Command-Line Interface (CLI): The “bin/cli” directory contains commands (deploy, destroy, logs, test, etc.) that are used to interact with or manage the system.
• Infrastructure and Cloud Resources: The “lib/stacks”, “lib/local-constructs”, and “cdk.json” files show that the infrastructure (e.g., networking, authentication, databases, and storage such as S3) is defined using AWS CDK.
• Shared Libraries and Packages: Directories such as “lib/libs”, “lib/packages/shared-types”, and “lib/packages/shared-utils” represent shared code that likely gets reused in Lambdas and potentially even the frontend.
• External Integrations: The project integrates with systems like Kafka (as seen in “lib/libs/api/kafka.ts”) and OpenSearch (in “lib/libs/opensearch-lib.ts” and shared-types for opensearch), and includes extensive email templating and notification mechanisms.
Relationships and Data Flow
• The Frontend (React App) communicates with the backend via API calls. These API calls are likely routed through API Gateway to trigger Lambda functions.
• Lambda functions serve as the business logic layer—processing submissions, generating notifications, managing package workflows, handling file upload URLs, and more.
• Some Lambda functions trigger email flows using shared email libraries (found under “lib/libs/email”) to send notifications back to users or to CMS review teams.
• Infrastructure is managed via CDK stacks (stacks such as “api.ts”, “auth.ts”, “networking.ts”, etc.) that provision AWS resources (e.g., API Gateway, Lambda, S3, OpenSearch, etc.) and define policies.
• The CLI tool (under “bin/cli”) provides deployment, testing, and operational commands to interface with these components.
Architectural Patterns and Key Design Principles
• Serverless Architecture: The back-end is composed primarily of AWS Lambda functions orchestrated via a serverless approach, ensuring scalability and agility.
• Infrastructure-as-Code: AWS CDK templates (in “lib/stacks” and “lib/local-constructs”) are used to define the AWS resources and configurations.
• Separation of Concerns: Different folders for Lambdas, shared libraries, and frontend clearly delineate the responsibilities.
• Reusability & Shared Types: The usage of shared-types (common models, events, and utilities) enforces consistency between the front- and back-end.
• Testing & Quality: Extensive tests are visible in directories like “test/e2e”, “vitest.config.ts”, and within source folders for both frontend and backend – emphasizing automated testing.
Detail Level
– Capture every essential architectural element down to the logical separation between the CLI, the shared libraries/utilities, and the backend functions.