Wrapper for NextJS image handling, optimised for Lambda w/ ApiGw integration.

Overview

NextJS Lambda Utils

This is a project allowing to deploy Next applications (standalone options turned on) to AWS Lambda without hassle.

This is an alternative to existing Lambda@Edge implementation (see) as it has too many limitations (primarily inability to use env vars) and deployments take too long.

This library uses Cloudfront, S3, ApiGateway and Lambdas to deploy easily in seconds (hotswap supported).

TL;DR

  • In your NextJS project, set output to standalone.
  • Run npx @sladg/nextjs-lambda pack
  • Prepare CDK (see)
  • Run cdk deploy

Usage

We need to create 2 lambdas in order to use NextJS. First one is handling pages/api rendering, second is solving image optimization.

This division makes it easier to control resources and specify sizes and timeouts as those operations are completely different.

Loading of assets and static content is handled via Cloudfront and S3 origin, so there is no need for specifying this behaviour in Lambda or handling it anyhow.

next.config.js

The only requirement is to change your Next12 config to produce standalone output via output: 'standalone'. This should work fine for single-repositories with yarn/npm/pnpm.

In case you are using monorepo/workspaces, be aware! Producing standalone build is tricky due to dependencies being spread out and not contained within single node_modules folder, making it complicated for SWC to properly produce required dependencies. This would most likely result in deployment failing with HTTP 500, internal error, as some required dependency is not in place.

See:

Server handler

This is a Lambda entrypoint to handle non-asset requests. We need a way to start Next in lambda-friendly way and translate ApiGateway event into typical HTTP event. This is handled by server-handler, which sits alongside of next's server.js in standalone output.

Image handler

Lambda consumes Api Gateway requests, so we need to create ApiGw proxy (v2) that will trigger Lambda.

Lambda is designed to serve _next/image* route in NextJS stack and replaces the default handler so we can optimize caching and memory limits for page renders and image optimization.

Via CDK

See NextStandaloneStack construct in lib/construct.ts.

You can easily create cdk/app.ts and use following code:

#!/usr/bin/env node
import 'source-map-support/register'
import * as cdk from 'aws-cdk-lib'
import * as path from 'path'

import { NextStandaloneStack } from '@sladg/nextjs-lambda'

const assetsZipPath = path.resolve(__dirname, '../next.out/assetsLayer.zip')
const codeZipPath = path.resolve(__dirname, '../next.out/code.zip')
const dependenciesZipPath = path.resolve(__dirname, '../next.out/dependenciesLayer.zip')

const app = new cdk.App()

new NextStandaloneStack(app, 'StandaloneNextjsStack-2', {
	assetsZipPath,
	codeZipPath,
	dependenciesZipPath,
})

This imports pre-made construct, you only need to worry about paths to outputed zip files from CLI pack command.

More granular CDK construct coming soon.

Sharp layer

Besides handler (wrapper) itself, underlying NextJS also requires sharp binaries. To build those, we use npm install with some extra parametes. Then we zip all sharp dependencies and compress it to easily importable zip file.

import { sharpLayerZipPath } from '@sladg/nextjs-lambda'

const sharpLayer = new LayerVersion(this, 'SharpDependenciesLayer', {
  code: Code.fromAsset(sharpLayerZipPath)
})

Next layer

To provide both image and server handlers with all depdencies (next is using require.resolve inside, so it cannot be bundled standalone for now).

We pre-package this layer so it can be included in Lambda without hassle.

import { nextLayerZipPath } from '@sladg/nextjs-lambda'

const nextLayer = new LayerVersion(this, 'NextDependenciesLayer', {
  code: Code.fromAsset(nextLayerZipPath)
})

Packaging

In order to succefully deploy, you firstly need to include target: 'standalone' in your next.config.js setup. Make sure to use NextJS in version 12 or above so this is properly supported.

Once target is set, you can go on and use your next build command as you normally would. To package everything, make sure to be in your project root folder and next folder .next and public exist. Packaging is done via NPM CLI command of @slack/nextjs-lambda package.

It will create next.out/ folder with 3 zip packages. One zip Lambda's code, one is dependencies layer and one is assets layer.

  • code zip: include all files generated by next that are required to run on Lambda behind ApiGateway. Original handler as well as new server handler are included. Use server-handler.handler for custom one or server.handler for original one.
  • dependencies layer: all transpilied node_modules. Next includes only used files, dramatically reducing overall size.
  • assets layer: your public folder together with generated assets. Keep in mind that to public refer file, you need to include it in public/assets/ folder, not just in public. This limitation dramatically simplifies whole setup. This zip file is uploaded to S3, it's not included in Lambda code.

Server handler

Custom wrapper around NextServer to allow for passing ApiGateway events into Next server.

Cloudfront paths used:

  • default
  • _next/data/*

Static assets

Next uses multiple directories to determine which file should be served. By default next provides us with list of routes for API/images/assets/pages. To simplify the process as much as possible, we are tapping into resulting paths.

We are packaging those assets to simulate output structure and we are using S3 behind CloudFront to serve those files. Also, Image Handler is tapping into S3 to provide images, so correct folder structure is crucial.

Cloudfront paths used:

  • _next/*
  • assets/*

Keep in minda, Cloudfront does not allow for multiple regex patterns in single origin, so using extensions to distinguish image/server handlers is not doable.

Versioning

This package exposes two CLI functions intended to deal with versioning your application and releasing.

Motivation behind is to get rid of huge dependencies and over-kill implementations such as @auto-it, release-it or semver. Those are bulky and unncessarily complex.

Guess

Simple CLI command that takes commit message and current version and outputs (stdout) next version based on keywords inside commit message.

Shipit

Similar to guess command, however, it automatically tags a commit on current branch and creates release branch for you so hooking up pipelines is as simple as it can be. Version is automatically bumped in common NPM and PHP files (package.json, package-lock.json and composer.json).

Simply call @sladg/next-lambda shipit on any branch and be done.

Disclaimer

At this point, advanced features were not tested with this setup. This includes:

  • GetServerSideProps,
  • middleware,
  • ISR and fallbacks,
  • streaming,
  • custom babel configuration.

I am looking for advanced projects implementing those features, so we can test them out! Reach out to me!

Comments
  •  Specified target is invalid. Provided:

    Specified target is invalid. Provided: "standalone" should be one of server, serverless, experimental-serverless-trace

    Thanks for this project. I'm having trouble running next build with target: 'standalone'. next.config.js is:

    module.exports = {
      async redirects() {
        return [
          {
            source: '/town/:slug',
            destination: '/towns/:slug',
            permanent: true,
          },
        ]
      },
      output: 'standalone',
      target: 'standalone',
      compress: false,
    }
    

    When I run next built I get the following output:

    Error: Specified target is invalid. Provided: "standalone" should be one of server, serverless, experimental-serverless-trace

    Running npx --package @sladg/nextjs-lambda next-utils pack without this results in Process failed with error: Error: Folder: /Users/<project root>/.next/standalone does not exist!

    From the next docs it seems we can have output: 'standalone',? But this doesn't seem to work either, or where am I going wrong? Thanks.

    documentation 
    opened by sennett 6
  • Unable to have an API route that returns binary data

    Unable to have an API route that returns binary data

    I want to have an API route that returns binary data - by way of example, let's say that there's an API route that generates a dynamic image /api/image/generate and where the content is returned by something looking like this:

    export default async (req: NextApiRequest, res: NextApiResponse) => {
    
    ...
      // buffer contains the image of type defined by mime, is of type Buffer
      res.setHeader('Content-Type', mime);
      res.setHeader('Content-Length', buffer.length);
      res.status(200).send(buffer);
    
    }
    

    If I have run Nextjs locally, this works fine. I can enter the API route directly into the browser and the image will render. However, if I run this in nextjs-lambda, I get an error. Specifically, the content length of the actual data returned is very much larger than the actual image size. I have an image of size 224214 and the content length reported by the server lambda is 403034 and the content is corrupted.

    The issue is that the API Gateway (HTTP API) that sits in front of the lambda is not recognising the fact that the data being returned is binary and is mangling it (https://aws.amazon.com/blogs/compute/handling-binary-data-using-amazon-api-gateway-http-apis/). This library explicitly sets the response from the lambda to be non-binary: https://github.com/sladg/nextjs-lambda/blob/master/lib/standalone/server-handler.ts#L39

    I don't see what the harm would be to remove that config flag: when we look at the way the serverless-http response from the Nextjs lambda is formatted, if the binary option is not specified then the response will not be treated as binary unless the underlying lambda returns a binary header or the Content-Type is set to be a binary type (by matching a type defined in process.env.BINARY_CONTENT_TYPES). Specifically, by not setting that flag we would hit this if statement.

    Could we please consider removing that line?

    This would allow for setting BINARY_CONTENT_TYPES=image/png,image/jpg,image/jpeg or similar and then such content would be returned to API Gateway in a way that APIG can handle it appropriately.

    enhancement 
    opened by john-tipper 5
  • CDK Additional Information

    CDK Additional Information

    Hey @sladg great library and this isn't really an issue as such, it's just more of an information gathering question.

    I ran the commands that were mentioned and the app was definitely deployed but I'm not really familiar with CDK and that's kind of where my question lies.

    Initially, I ran into an issue with the deploy command not being able to find the environment variables so that led me to installing cdk and running cdk bootstrap and that solved the issue as I was able to point it to the correct profile, account and region.

    So my question is, is there a way I can configure AWS related attributes like the name of the Cloudfront resource or associating a domain with the Cloudfront distribution. This might be a CDK related question but I just wanted to drop it here to confirm that. I can indeed see CDK related config in the cdk.out folder and my guess is that editing the data there should help with this.

    documentation enhancement 
    opened by judemanutd 5
  • How to obtain {sharp,next,image}_handler.zip

    How to obtain {sharp,next,image}_handler.zip

    First, thank you for the provided example/*, it is very helpful on helping me integrating this project. I have no idea how to acquire these zips, could you document more on how to obtain these zips?

    opened by Pegasust 5
  • Bundle image handler with Sharp

    Bundle image handler with Sharp

    Existing implementation was error prone, creating unnecessary complexity and layers. There needs to be easier way how to bundle image handler and include Sharp for Lambda as well.

    Currently using Squoosh for image handling, which is not recommended for production use with Vercel.

    enhancement internal dependencies 
    opened by sladg 4
  • Deployment fails at ImageOptimization Handler

    Deployment fails at ImageOptimization Handler

    Hi, when I run npx --package ... deploy

    Failed resources:
    StandaloneNextjsStack-Temporary | 2:28:51 PM | UPDATE_FAILED        | AWS::Lambda::Function                           | ImageOptimizationNextJs (ImageOptimizationNextJsB167CF66) Resource handler returned message: "Lambda function StandaloneNextjsStack-Tem-ImageOptimizationNextJsB-MAFjARSAA8QV could not be found" (RequestToken: bd6daa8c-9bf9-6640-0e13-9dc06fb19e9c, HandlerErrorCode: NotFound)
    
    stderr: 
     ❌  StandaloneNextjsStack-Temporary failed: Error: The stack named StandaloneNextjsStack-Temporary failed to deploy: UPDATE_ROLLBACK_COMPLETE: Resource handler returned message: "Lambda function StandaloneNextjsStack-Tem-ImageOptimizationNextJsB-MAFjARSAA8QV could not be found" (RequestToken: bd6daa8c-9bf9-6640-0e13-9dc06fb19e9c, HandlerErrorCode: NotFound)
        at FullCloudFormationDeployment.monitorDeployment (/Users/user/.npm/_npx/3b877e98bdaa260f/node_modules/aws-cdk/lib/api/deploy-stack.ts:505:13)
        at processTicksAndRejections (node:internal/process/task_queues:96:5)
        at deployStack2 (/Users/user/.npm/_npx/3b877e98bdaa260f/node_modules/aws-cdk/lib/cdk-toolkit.ts:264:24)
        at /Users/user/.npm/_npx/3b877e98bdaa260f/node_modules/aws-cdk/lib/deploy.ts:39:11
        at run (/Users/user/.npm/_npx/3b877e98bdaa260f/node_modules/p-queue/dist/index.js:163:29)
    
    stderr: 
     ❌ Deployment failed: Error: Stack Deployments Failed: Error: The stack named StandaloneNextjsStack-Temporary failed to deploy: UPDATE_ROLLBACK_COMPLETE: Resource handler returned message: "Lambda function StandaloneNextjsStack-Tem-ImageOptimizationNextJsB-MAFjARSAA8QV could not be found" (RequestToken: bd6daa8c-9bf9-6640-0e13-9dc06fb19e9c, HandlerErrorCode: NotFound)
        at deployStacks (/Users/user/.npm/_npx/3b877e98bdaa260f/node_modules/aws-cdk/lib/deploy.ts:61:11)
        at processTicksAndRejections (node:internal/process/task_queues:96:5)
        at CdkToolkit.deploy (/Users/user/.npm/_npx/3b877e98bdaa260f/node_modules/aws-cdk/lib/cdk-toolkit.ts:338:7)
        at initCommandLine (/Users/user/.npm/_npx/3b877e98bdaa260f/node_modules/aws-cdk/lib/cli.ts:364:12)
    
    
    
    opened by khuezy 3
  • specify next 13 in docs

    specify next 13 in docs

    I found that Next 12 didn't work for me - there was no directory .next/standalone in built output. This PR highlights Next 13 requirement.

    Related: https://github.com/sladg/nextjs-lambda/issues/51

    opened by sennett 3
  • Bundled `image-handler` isn't respecting allowed `remotePatterns` / `domains`

    Bundled `image-handler` isn't respecting allowed `remotePatterns` / `domains`

    My Next.js stores images on a CDN, which requires me to display them using their absolute URLs. However, the bundled image-handler refuses to work with them, as it was built before reading my next.config.js.

    bug internal 
    opened by fabiob 3
  • Building Assets Failed: Error: StandaloneNextjsStack-Temporary: SSM parameter /cdk-bootstrap/hnb659fds/version not found.

    Building Assets Failed: Error: StandaloneNextjsStack-Temporary: SSM parameter /cdk-bootstrap/hnb659fds/version not found.

    Steps to reproduce next build npx --package @sladg/nextjs-lambda next-utils pack npx --package @sladg/nextjs-lambda next-utils deploy I get

    [paul@rb demo-app]$ npx --package @sladg/nextjs-lambda next-utils deploy
    Our config is:  {
      stackName: 'StandaloneNextjsStack-Temporary',
      appPath: '/home/paul/.npm/_npx/3b877e98bdaa260f/node_modules/@sladg/nextjs-lambda/dist/cdk-app.js'
    }
    stdout: 
    ✨  Synthesis time: 1.63s
    
    
    stdout: StandaloneNextjsStack-Temporary: building assets...
    
    
    stdout: current credentials could not be used to assume 'arn:aws:iam::661723878467:role/cdk-hnb659fds-deploy-role-661723878467-us-east-1', but are for the right account. Proceeding anyway.
    
    stderr: 
     ❌ Building assets failed: Error: Building Assets Failed: Error: StandaloneNextjsStack-Temporary: SSM parameter /cdk-bootstrap/hnb659fds/version not found. Has the environment been bootstrapped? Please run 'cdk bootstrap' (see https://docs.aws.amazon.com/cdk/latest/guide/bootstrapping.html)
        at buildAllStackAssets (/home/paul/.npm/_npx/3b877e98bdaa260f/node_modules/aws-cdk/lib/build.ts:21:11)
        at processTicksAndRejections (node:internal/process/task_queues:96:5)
        at CdkToolkit.deploy (/home/paul/.npm/_npx/3b877e98bdaa260f/node_modules/aws-cdk/lib/cdk-toolkit.ts:175:7)
        at initCommandLine (/home/paul/.npm/_npx/3b877e98bdaa260f/node_modules/aws-cdk/lib/cli.ts:357:12)
    
    stdout: 
    
    stderr: Building Assets Failed: Error: StandaloneNextjsStack-Temporary: SSM parameter /cdk-bootstrap/hnb659fds/version not found. Has the environment been bootstrapped? Please run 'cdk bootstrap' (see https://docs.aws.amazon.com/cdk/latest/guide/bootstrapping.html)
    
    Process failed with error: Error: Command failed: STACK_NAME=StandaloneNextjsStack-Temporary /home/paul/.npm/_npx/3b877e98bdaa260f/node_modules/aws-cdk/bin/cdk deploy --app "node /home/paul/.npm/_npx/3b877e98bdaa260f/node_modules/@sladg/nextjs-lambda/dist/cdk-app.js" --require-approval never --ci
    
     ❌ Building assets failed: Error: Building Assets Failed: Error: StandaloneNextjsStack-Temporary: SSM parameter /cdk-bootstrap/hnb659fds/version not found. Has the environment been bootstrapped? Please run 'cdk bootstrap' (see https://docs.aws.amazon.com/cdk/latest/guide/bootstrapping.html)
        at buildAllStackAssets (/home/paul/.npm/_npx/3b877e98bdaa260f/node_modules/aws-cdk/lib/build.ts:21:11)
        at processTicksAndRejections (node:internal/process/task_queues:96:5)
        at CdkToolkit.deploy (/home/paul/.npm/_npx/3b877e98bdaa260f/node_modules/aws-cdk/lib/cdk-toolkit.ts:175:7)
        at initCommandLine (/home/paul/.npm/_npx/3b877e98bdaa260f/node_modules/aws-cdk/lib/cli.ts:357:12)
    Building Assets Failed: Error: StandaloneNextjsStack-Temporary: SSM parameter /cdk-bootstrap/hnb659fds/version not found. Has the environment been bootstrapped? Please run 'cdk bootstrap' (see https://docs.aws.amazon.com/cdk/latest/guide/bootstrapping.html)
    
        at ChildProcess.exithandler (node:child_process:400:12)
        at ChildProcess.emit (node:events:513:28)
        at maybeClose (node:internal/child_process:1093:16)
        at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5) {
      code: 1,
      killed: false,
      signal: null,
      cmd: 'STACK_NAME=StandaloneNextjsStack-Temporary /home/paul/.npm/_npx/3b877e98bdaa260f/node_modules/aws-cdk/bin/cdk deploy --app "node /home/paul/.npm/_npx/3b877e98bdaa260f/node_modules/@sladg/nextjs-lambda/dist/cdk-app.js" --require-approval never --ci'
    }
    

    Is something missing in README.md? Do I really need to run cdk bootstrap manually? Thanks.

    documentation question 
    opened by pavlo-mais 3
  • Allow use of Serverless Framework instead of CDK

    Allow use of Serverless Framework instead of CDK

    Serverless Framework has a deployment approach of a serverless.yml file defining a single API Gateway and multiple lambdas. This is different to the current CDK implementation where each lambda is associated with a separate APIG and each APIG is associated with a separate CloudFront origin.

    If you have 2 lambdas associated with a single APIG, then each lambda needs to be given a different path, e.g. the server-handler lambda being associated with /server/* paths and the image-handler lambda being associated with /image/* paths. CloudFront allows for originPaths where different origins will use a different prefix when making requests to the origins. Thus it is possible to user Serverless Framework to route traffic to different origins, where each origin uses the SAME shared APIG but with different prefixes.

    PROBLEM 1: The server-handler lambda uses the full path of the request passed to it from the APIG to determine what Nextjs resources to serve (the image-handler lambda does not, it just uses the query string passed to it and doesn't care about the path). If the server-handler lambda has a /server prefix passed to it then the routes in Nextjs are wrong.

    SOLUTION: The serverless-http library used in this project has support for defining a basePath configuration parameter (details here), which will strip the basePath off the supplied path before passing the value on to the consumer. e.g. a request path of /server/_next/data* with basePath: '/server' would be converted to /_next/data* before being passed to Nextjs.

    PROBLEM 2: There is currently no means of injecting a configuration value into the options that are supplied to serverless-http, see here. Additionally, the current version of serverless-http (3.0.2) has a bug such that the Typescript type definition of the Options object passed to slsHttp does not support basePath. I have had a PR for serverless-http merged (https://github.com/dougmoscrop/serverless-http/pull/246) which will add this support, but I am waiting for a release of 3.0.3.

    SOLUTION: I would like to add a PR to allow for the basePath to be optionally specified by an env variable, here. e.g.:

    basePath: process.env.NEXTJS_LAMBDA_BASE_PATH
    

    If no variable is specified then basePath is not set and there is no behaviour change. If the variable is set then the base path is stripped before being passed to Nextjs. This will allow for both Serverless Framework and CDK to be used as a deployment tool.

    opened by john-tipper 3
  • Is middleware supported?

    Is middleware supported?

    I see a middleware checkmark in the list of features, but when I deploy the example: https://github.com/vercel/next.js/tree/canary/examples/middleware, it doesn't actually work.

    Edit: it does work when you reload the browser, but using <Link />, it does not work.

    opened by khuezy 2
  • Consider sharing resources across stacks

    Consider sharing resources across stacks

    AWS is limiting number of:

    • cache policies,
    • cloudfronts.

    Those are typical resources limitations experiences. Cloudfront is not really solvable as each one is unique. However, cache policies are same across stacks so those could be shared (aka. create once and import to stacks).

    opened by sladg 2
  • next-auth login() redirection doesn't work

    next-auth login() redirection doesn't work

    Use case: I used the repo below and added next-auth using Cognito provider: https://github.com/plevavas/monorepo https://next-auth.js.org/getting-started/example https://next-auth.js.org/providers/cognito

    The redirection to Cognito login does work locally when debugging in vs code

    Issue: The redirection to Cognito login does NOT work when deployed with tosladg/[email protected]

    opened by adamsh25 4
Releases(v3.1.2)
Owner
Jan
Find more about me - https://www.linkedin.com/in/j-soukup/
Jan
AWS Lambda & Serverless - Developer Guide with Hands-on Labs. Develop thousands line of aws lambda functions interact to aws serverless services with real-world hands-on labs

AWS Lambda & Serverless - Developer Guide with Hands-on Labs UDEMY COURSE WITH DISCOUNTED - Step by Step Development of this Repository -> https://www

awsrun 35 Dec 17, 2022
🔐 Lambda Authorizer ready for integration with Serverless Framework and Auth0.

Getting started 1. Clone the repository (or generate a serverless project) sls create --name auth-service --template-url https://github.com/GustavoNor

Gustavo Noronha 2 Feb 10, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Connect Web Integration illustrates the integration of Connect-Web in various JS frameworks and tooling

Connect Web Integration Connect Web Integration is a repository of example projects using Connect-Web with various JS frameworks and tooling. It provi

Buf 43 Dec 29, 2022
A desktop app handling image uploading and text transfering.

Transmitter Introduction 一款利用Github repository实现图床+文本传输的桌面应用 框架:Vite+React+Electron Tutorial release 创建Github token:https://docs.github.com/en/authent

Wenhao Zhang 3 Mar 24, 2022
optimize image & upload file to cloud as image bed with tiny image automic.

Rush! 图片压缩 & 直传图床工具 这是一个兴趣使然的项目, 希望 Rush! 能让这个世界的网络资源浪费减少一点点 下载 Downloads 获取最新发行版 功能 Features 拖拽批量压缩图片, 支持格式 jpg/png/gif Drop to optimize, jpg/png/gif

{ Chao } 3 Nov 12, 2022
A set of APIs for handling HTTP and HTTPS requests with Deno 🐿️ 🦕

oak commons A set of APIs that are common to HTTP/HTTPS servers. HTTP Methods (/method.ts) A set of APIs for dealing with HTTP methods. Content Negoti

oak 7 May 23, 2022
A simple library for handling keyboard shortcuts with Alpine.js.

✨ Help support the maintenance of this package by sponsoring me. Alpine.js Mousetrap A simple library for handling keyboard shortcuts with Alpine.js.

Dan Harrin 102 Nov 14, 2022
HanAssist - Utilities to ease Chinese variant handling in user scripts and gadgets.

HanAssist 代码文档 HanAssist 是帮助中文维基百科及其他 MediaWiki 网站上的用户脚本和小工具更优雅地处理中文变体消息的实用程序。 本程序的目标是取代wgULS()和wgUVS()小工具。 HanAssist.localize( { hans: '一天一苹果,医生远离我。'

Diskdance 3 Oct 29, 2022
GraphErr is an open-source error handling library for GraphQL implementations in Deno. It's a lightweight solution that provides developers with descriptive error messages, reducing ambiguity and improving debugging.

GraphErr Descriptive GraphQL error handling for Deno/Oak servers. Features Provides additional context to GraphQL's native error messaging for faster

OSLabs Beta 35 Nov 1, 2022
Pressure is a JavaScript library for handling both Force Touch and 3D Touch on the web

Pressure is a JavaScript library for handling both Force Touch and 3D Touch on the web, bundled under one library with a simple API that makes working with them painless.

Stuart Yamartino 2.9k Dec 29, 2022
Provides event handling and an HTMLElement mixin for Declarative Shadow DOM in Hotwire Turbo.

Turbo Shadow Provides event handling and an HTMLElement mixin for Declarative Shadow DOM support in Hotwire Turbo. Requires Turbo 7.2 or higher. Quick

Whitefusion 17 Sep 28, 2022
Dead-simple CORS handling for any itty-router API (test with Cloudflare Workers, but works anywhere)!

Simple CORS-handling for any itty-router API. Designed on Cloudflare Workers, but works anywhere. Features Tiny. Currently ~600 bytes, with zero-depen

Kevin R. Whitley 6 Dec 16, 2022
🖼️ Image proxy for Next.js. Makes it possible to use dynamic domains in next/image component.

Next.js Image Proxy Image proxy for Next.js. Makes it possible to use dynamic domains in next/image component. ❔ Motivation This library makes it poss

Blazity 30 Dec 1, 2022
A Javascript library that discourages and prevents image theft/download by preventing client ability to retrieve the image.

ProtectImage.js ProtectImage.js is a Javascript library that helps prevent image theft by disabling traditional user interactions to download/copy ima

null 4 Aug 18, 2022
Simple JavaScript Library to add parallax image to background-image

Backpax Simple JavaScript Library to add parallax image to background-image Install $ npm install backpax --save Demo Demo page is here Usage If you

appleple 13 Oct 12, 2022