How montoyan877/lambda-running works
Project Type & Purpose
• Lambda Running is a tool designed to allow developers to locally run and test AWS Lambda functions. It supports both a web-based UI mode and an interactive CLI mode.
• The README and file layout emphasize zero-configuration testing, custom event injection and Lambda layers support – all aimed at simulating real AWS Lambda environments for rapid iteration.
Key Components
• CLI & Entry Points:
• Binaries (bin/lambda-run.js, bin/ui-start.js) initiate different modes.
• The CLI commands (interactive mode) and direct command invocation are supported via src/commands.
• Backend Core Engine:
• Lambda Runner (src/lambda-runner.js) is at the heart of the simulation, actually invoking the Lambda functions.
• Event Store (src/event-store.js) is responsible for tracking and logging events during local execution.
• Config Loader (src/config-loader.js) manages environment settings and configurations from .env files and lambda-running.json.
• Layer Resolver (src/layer-resolver.js) handles mapping AWS Lambda layers from the local filesystem (guided by configurations in lambda-running.json and the directory structure in layers/).
• UI Components:
• The UI server (src/ui-server.js) provides backend support to the Vue-based frontend housed in the ui directory.
• The ui folder contains the complete Vue application (with components, router, state management, and assets) that offers a modern web interface for testing and viewing real-time logs and events.
• Supporting Infrastructure:
• Configuration files such as .env.example, .lambdarunignore, and the sample configurations in lambda-running.json that impact scanning, environment loading, and layer mappings.
• Test suites (in tests/) that validate integration, unit functionality, and UI behaviors.
• Documentation (docs/) and examples (examples/) that help users understand and extend the system.
Relationships & Interactions
• The CLI commands and UI Mode both kick off by first loading configurations (via src/config-loader.js) which initialize settings such as environment variables and lambda layer paths.
• Once initialized, they call into the Lambda Runner. The runner uses the Event Store to record invocation logs and execution details.
• The Layer Resolver plays a critical role when a Lambda function needs to use a defined layer – mapping the expected AWS layer file structure to the local layer directory.
• In UI mode, the UI server (src/ui-server.js) serves the Vue application found under ui/ and acts as a bridge between the backend simulation engine and the real-time web interface.
• The CLI mode, on the other hand, feeds commands directly to the Lambda Runner and Event Store, displaying results in the terminal.
Architectural Patterns & Technologies
• Overall, the architecture adopts a modular design where different concerns (configuration, execution, logging, UI) are clearly separated.
• There is a distinct separation of frontend (Vue-based UI) and backend (command processing, lambda runner) components.
• Patterns such as “configuration loader” and “layer resolver” encapsulate specific responsibilities.
• Key technologies include Node.js (for running backend scripts and CLI commands), Vue along with Vite for the frontend, and support for both JavaScript and TypeScript (as observed in examples/typescript-examples and presence of ts_alias files).
Instructing the Principal Software Engineer
– From the CLI/Entry Points to the Config Loader.
– From the Config Loader to both the Lambda Runner and the Layer Resolver.
– From the Lambda Runner to the Event Store.
– From the UI Server to the Vue-based frontend components.
• Annotations or legends where necessary to clarify responsibilities (e.g., “Handles environment configuration”, “Maps local layer directories”).