lambda-api is a zero-dependency, lightweight web framework designed specifically for building serverless applications on AWS Lambda. It supports both AWS API Gateway Lambda Proxy Integration and ALB Lambda Target Support, providing a minimal yet familiar API similar to Express.js or Fastify for routing, middleware, and error handling. Optimized for the stateless, single-run execution model of Lambda, it prioritizes fast cold starts and low memory consumption by eschewing external dependencies. The package is currently at version 1.2.0, with a consistent release cadence of minor versions to introduce new features, enhance TypeScript type definitions, and resolve bugs. Its primary differentiation lies in its minimal footprint and dedicated focus on the unique demands of serverless environments, making it ideal for high-performance, cost-efficient serverless APIs.
npm install lambda-apiVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize `lambda-api`, define a simple GET and POST route, and expose it as an AWS Lambda handler.
Install `@aws-sdk/client-s3` and `@aws-sdk/s3-request-presigner` via npm/yarn. Update any AWS SDK v2 S3 calls to their equivalent AWS SDK v3 syntax. If you must use SDK v2, pin `lambda-api` to `0.12.0`.
Run `npm install @aws-sdk/client-s3 @aws-sdk/s3-request-presigner` (or `yarn add`) if you intend to use the S3 service provided by `lambda-api`.
If migrating to AWS SDK v3 is not feasible, restrict `lambda-api` to `0.12.0` in your `package.json` (`"lambda-api": "^0.12.0"`). Otherwise, upgrade your application's SDK usage to v3.
Upgrade to `lambda-api@0.11.2` or any later version (e.g., `1.x.x`) to patch this security vulnerability.
Ensure `lambda-api` is `v1.0.0` or higher, and install `@aws-sdk/client-s3` and `@aws-sdk/s3-request-presigner`. If using `lambda-api@0.12.0` for AWS SDK v2, ensure `aws-sdk` is installed.
Change your import statement to `import lambdaApi from 'lambda-api'; const api = lambdaApi();`. Alternatively, ensure your file is treated as CommonJS (e.g., change file extension to `.cjs` or set `"type": "commonjs"` in `package.json`).
Run `npm install lambda-api` or `yarn add lambda-api` in your project directory.