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

@faapi/next

v3.1.0

Published

Next.js integration for faapi — serve faapi APIs and Next.js pages from a single server

Readme

@faapi/next

Next.js + faapi 单进程单端口集成

@faapi/next 让 faapi 和 Next.js 运行在同一个进程中,共享同一个端口。/api/* 路径走 faapi,其余路径走 Next.js,无需写 custom server 代码。

安装

pnpm add @faapi/next next
# 或
npm install @faapi/next next

要求 Node.js >= 24,Next.js >= 13。

快速开始

faapi.config.ts 中声明插件:

export default {
  plugins: ['@faapi/next'],
} satisfies FaapiConfig;

然后像普通 faapi 项目一样启动:

npx faapi

/api/* 的请求由 faapi handler 处理,其余请求(页面、静态资源、HMR)由 Next.js 处理。

自定义 API 前缀

export default {
  plugins: [
    ['@faapi/next', { apiPrefix: '/v1' }],
  ],
} satisfies FaapiConfig;

生产模式

npx faapi build
node dist/main

HTTP 分流

| 请求路径 | 处理方 | |----------|--------| | /api/user | faapi handler | | /api/hello?name=world | faapi handler | | / | Next.js 首页 | | /about | Next.js 页面 | | /api2(不匹配 /api 前缀) | Next.js | | /_next/*(HMR / 静态资源) | Next.js |

WebSocket 分流

| upgrade 请求 | 处理方 | |-------------|--------| | /api/chat(faapi WS 路由) | faapi WebSocket handler | | /_next/webpack-hmr | Next.js HMR |

许可证

MIT