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

@geek-fun/serverless-adapter

v0.2.2

Published

Adapter for web frame work express, koa, springboot to run in serverless function as backend of apigateway cross multi cloud provider like aliyun, huawei

Readme

Serverless-Adapter

Node.js CI release npm version Known Vulnerabilities License codecov

Adapter for web frameworks (Express, Koa) to run on serverless platforms across multiple cloud providers with automatic provider detection.

Supported Cloud Providers

| Provider | Service | Status | Trigger Type | | ---------------------- | ------------------------------- | ------------ | ------------ | | Alibaba Cloud (Aliyun) | Function Compute | ✅ Supported | API Gateway | | Tencent Cloud | Serverless Cloud Function (SCF) | ✅ Supported | API Gateway | | Volcengine | veFaaS (函数服务) | ✅ Supported | API Gateway |

Supported Frameworks

| Framework | Version | Status | | --------- | ------- | ------------ | | Express | 4.x | ✅ Supported | | Express | 5.x | ✅ Supported | | Koa | 2.x | ✅ Supported | | Koa | 3.x | ✅ Supported |

Quick Start

Prerequisites

  • Node.js >= 16.x

Install

npm install @geek-fun/serverless-adapter

Usage

Auto-detect Provider (Recommended)

The adapter automatically detects the cloud provider based on the context object:

import express from 'express';
import serverlessAdapter from '@geek-fun/serverless-adapter';

const app = express();

app.get('/', (req, res) => {
  res.json({ message: 'Hello World!' });
});

// Auto-detect provider based on context
export const handler = serverlessAdapter(app);

Explicit Provider Selection

You can explicitly specify the provider:

import express from 'express';
import serverlessAdapter from '@geek-fun/serverless-adapter';

const app = express();

app.get('/', (req, res) => {
  res.json({ message: 'Hello from Tencent Cloud!' });
});

// Explicitly specify Tencent provider
export const main_handler = serverlessAdapter(app, { provider: 'tencent' });

Aliyun Function Compute Example

import express from 'express';
import serverlessAdapter from '@geek-fun/serverless-adapter';

const app = express();

app.get('/api/users', (req, res) => {
  res.json({ users: [] });
});

// Handler for Aliyun Function Compute
export const handler = serverlessAdapter(app);

Tencent SCF Example

import express from 'express';
import serverlessAdapter from '@geek-fun/serverless-adapter';

const app = express();

app.get('/api/users', (req, res) => {
  res.json({ users: [] });
});

// Handler for Tencent SCF
export const main_handler = serverlessAdapter(app, { provider: 'tencent' });

Volcengine veFaaS Example

import express from 'express';
import serverlessAdapter from '@geek-fun/serverless-adapter';

const app = express();

app.get('/api/users', (req, res) => {
  res.json({ users: [] });
});

// Handler for Volcengine veFaaS
export const handler = serverlessAdapter(app, { provider: 'volcengine' });

API Reference

serverlessAdapter(app, options?)

Creates a serverless handler for your Express or Koa application.

Parameters

| Parameter | Type | Required | Description | | ------------------ | --------------------------------------- | -------- | ------------------------------------------------------------ | | app | Express \| Koa | Yes | Express or Koa application instance | | options.provider | 'aliyun' \| 'tencent' \| 'volcengine' | No | Explicitly specify cloud provider (auto-detected if omitted) |

Returns

A function that handles serverless events:

(event: Buffer, context: ProviderContext) =>
  Promise<{
    statusCode: number;
    body: string;
    headers: Record<string, string>;
    isBase64Encoded: boolean;
  }>;

Provider Detection

The adapter automatically detects the cloud provider by examining the context object:

| Provider | Detection Fields | | ---------- | -------------------------------------------------------- | | Aliyun | service.name, tracing, logger, function.memory | | Tencent | tencentcloud_region, tencentcloud_appid, namespace | | Volcengine | requestId, region, function.memoryMb |

License

Apache-2.0