# @architect/asap

> Architect Static Asset Proxy (ASAP) - a helpful library for Lambda-based static asset delivery

Latest version **7.0.10** (published 2024-04-29) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @architect/asap
pnpm add @architect/asap
yarn add @architect/asap
bun add @architect/asap
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 7.0.10 |
| Published | 2024-04-29 |
| First published | 2020-11-28 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=16 |
| Dependencies | 2 |
| Unpacked size | 31.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Maintainers | brianleroux, dam, kborchers, ryanblock, architectci, filmaj |
| Keywords | aws, lambda, amazon, serverless, cloud, cloudfunctions, apigateway, dynamodb, s3, sns, api gateway, framework |

## Links

- npm: https://www.npmjs.com/package/@architect/asap
- Repository: https://github.com/architect/asap
- Homepage: https://github.com/architect/asap#readme
- Issues: https://github.com/architect/asap/issues
- npm.io page: https://npm.io/package/@architect/asap

## Dependencies (2)

- [@aws-lite/s3](https://npm.io/package/@aws-lite/s3.md) ^0.1.21
- [@aws-lite/client](https://npm.io/package/@aws-lite/client.md) ~0.21.1

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 7.0.10 (latest) — 2024-04-29
- 7.0.3-RC.0 (RC) — 2024-02-03
- 7.0.9 — 2024-04-29
- 7.0.8 — 2024-03-25
- 7.0.7 — 2024-02-07
- 7.0.5 — 2024-02-07
- 7.0.4 — 2024-02-05
- 7.0.3 — 2024-02-03
- 7.0.2 — 2024-02-02
- 7.0.1 — 2024-02-02
- 7.0.0 — 2024-02-02
- 7.0.0-RC.2 — 2024-01-31
- 7.0.0-RC.1 — 2024-01-24
- 6.0.6 — 2024-01-17
- 6.0.5 — 2024-01-11
- … 23 more at https://npm.io/package/@architect/asap/versions

## README

# @architect/asap

>  Architect Static Asset Proxy (ASAP) - a helpful library for Lambda-based static asset delivery

[![GitHub CI status](https://github.com/architect/asap/workflows/Node%20CI/badge.svg)](https://github.com/architect/asap/actions?query=workflow%3A%22Node+CI%22)

# Usage

## Module

Call ASAP within your handler function manually like so:

```javascript
let asap = require('@architect/asap')

// All config is optional!
module.exports = asap({
  // Alias assets to different filenames
  alias: {
    '/an-asset.jpg': '/a-different-filename.jpg',
    '/a-path': '/a-different-path',
  },
  // Pass your own fingerprinted static asset manifest (defaults to Arc-generated static.json)
  assets: { 'some-file.gif': 'some-file-a1b2c3.gif' },
  // Set a custom bucket configuration (defaults to Arc-generated buckets)
  bucket: {
    staging: 'staging-bucket-name',
    production: 'production-bucket-name',
    folder: 'some-bucket-subfolder',
  },
  // Override the content-aware cache-control header
  cacheControl: 'max-age=0',
  // Manually set response headers
  headers: { 'some-header': 'ok=true' },
  // Return null if asset is not found (defaults to `false`)
  passthru: true,
  // Engage SPA mode (defaults to `false`)
  spa: false,
})
```


## Lambda handler

Use ASAP as the handler for your Lambda! If you're using Architect, this is done automatically for you when you don't define a root handler for your `@http` pragma.

If using ASAP with non-Architect projects, just point your Lambda's source directory to `src/`, and make sure you set the following two env vars:
- `ARC_ENV`: `staging` or `production`
- `ARC_STATIC_BUCKET`: the S3 bucket name where your assets are stored

---
_Source: https://npm.io/package/@architect/asap · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
