npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

acai

v2.3.1

Published

JavaScript-first helpers for building AWS Lambda integrations (TypeScript implementation available via acai-ts).

Downloads

25

Readme

🫐 Acai (JavaScript)

Auto-loading, self-validating, minimalist JavaScript library for Amazon Web Service Lambdas

CircleCI Quality Gate Status Bugs Coverage Node.js npm package License Contributions welcome

Acai delivers a DRY, configurable, declarative experience for building AWS Lambda integrations in JavaScript. It encourages Happy Path Programming—validate inputs first, eliminate defensive code, and keep business logic focused on success paths.

Need TypeScript bindings? Check out the companion package acai-ts for a fully typed experience.


📖 Documentation

Full Documentation · Examples · Tutorial


🎯 Why Acai?

  • 🚀 Zero Boilerplate – File-based routing auto-loads handlers with minimal configuration.
  • ✅ Built-in Validation – OpenAPI schema validation for API Gateway and event sources.
  • 🧩 Extensible Middleware – Compose before, after, withAuth, and beforeAll/afterAll hooks effortlessly.
  • 🔄 Event Helpers – Uniform abstractions for DynamoDB, S3, and SQS events with operation filtering.
  • 🧪 Test Friendly – Lightweight surface area and deterministic responses make unit tests straightforward.
  • 🌐 Serverless Friendly – Designed to slot into Serverless Framework, SAM, or raw Lambda stacks.

Happy Path Programming (HPP)

Validate early, then write business logic without guardrails and nested try/catch blocks. Acai pushes error handling to the edges, keeping the core flow clean and intention-revealing.


⚡ Quick Start

const {Router} = require('acai').apigateway;

const router = new Router({
    basePath: 'v1',
    handlerPath: 'src/handlers',          // auto-expanded to src/handlers/**/*.js
    schemaPath: 'openapi.yml',            // optional: enable OpenAPI validation
    autoValidate: true,                   // validate requests automatically
    validateResponse: true                // validate responses before returning
});

exports.handler = async (event) => {
    return await router.route(event);
};

// File: src/handlers/users/index.js
exports.requirements = {
    post: {
        requiredBody: 'CreateUserRequest'
    }
};

exports.post = async (request, response) => {
    response.body = {
        id: '123',
        email: request.body.email
    };
    return response;
};

Pattern Routing via Globs

const router = new Router({
    basePath: 'api/v1',
    handlerPattern: 'src/controllers/**/*.controller.js'
});

Both handlerPath and handlerPattern feed the same resolver. handlerPath is shorthand for directory-style routing (**/*.js), while handlerPattern supports custom naming conventions.


📦 Event Processing Examples

DynamoDB Streams

const {dynamodb} = require('acai');

exports.handler = async (event) => {
    const ddbEvent = new dynamodb.Event(event, {
        operations: ['create', 'update'],
        globalLogger: true
    });

    for (const record of ddbEvent.records) {
        console.log('Operation:', record.operation);
        console.log('New values:', record.body);
        console.log('Old values:', record.oldImage);
    }
};

S3 Object Hydration

const {s3} = require('acai');

exports.handler = async (event) => {
    const s3Event = new s3.Event(event, {
        getObject: true,
        isJSON: true
    });

    const records = await s3Event.getRecords();
    for (const record of records) {
        console.log('Bucket:', record.bucket.name);
        console.log('Key:', record.key);
        console.log('Parsed body:', record.body);
    }
};

📦 Installation

npm install acai

Requirements

  • Node.js: ≥ 22.19.0

🧪 Testing

npm install
npm test

🤝 Contributing

We welcome issues, feature requests, and pull requests! Please review the guidelines in CONTRIBUTING.md before you start. If you release a bug fix or enhancement, add an entry to CHANGELOG.md describing the change.

🧭 Agent Resources


📦 Related Packages

  • acai-ts – TypeScript-first implementation with decorators and type metadata.