@fewchurs/next

中文文档
1.7.2发布于 2026/11/14SEE LICENSE IN LICENSETypeScriptESM + CJS近 30 天下载 1981

A server-rendered Fewchurs feature-request board for Next.js, with the API key kept on the server.

原始使用文档
文档目录16 节
  1. Integrate in 5 steps
  2. 1. Get an API key and add your domain
  3. 2. Install
  4. 3. Add the key to .env.local
  5. 4. Create the route handler
  6. 5. Render the board
  7. Or add a feedback button to every page
  8. Deploying and preview URLs
  9. Customize
  10. Link straight to one request
  11. Signed-in users
  12. Options
  13. Troubleshooting
  14. Other entry points
  15. More
  16. License

@fewchurs/next

A server-rendered feature-request board for the Next.js App Router: visitors submit ideas, vote, comment and follow, and you manage everything from your Fewchurs dashboard.

Your API key stays on the server. The board renders with real data on first paint, and voting and commenting go through a route handler in your own app, so the key never reaches the browser and no CORS setup is needed.

Not using Next.js? Use @fewchurs/react.

  • Next.js 14+ (App Router), React 18 or 19, Node 20+ (the handler also runs on the edge runtime)
  • Light and dark mode out of the box
  • Fully typed

Integrate in 5 steps

1. Get an API key and add your domain

In the Fewchurs dashboard, open your app, copy the API key (it looks like fr_live_…) and add the domain your site runs on. localhost always works while you build.

2. Install

npm install @fewchurs/next
# or: pnpm add @fewchurs/next
# or: yarn add @fewchurs/next

3. Add the key to .env.local

FEWCHURS_API_KEY=fr_live_…

Do not prefix it with NEXT_PUBLIC_. It is a server-only secret here. Restart next dev after you edit the file.

4. Create the route handler

This is the small proxy the board talks to. It adds your key on the server.

// app/api/fewchurs/[...route]/route.ts
export { GET, POST, DELETE } from "@fewchurs/next/handler";

Keep the folder name [...route] exactly as written.

5. Render the board

// app/feedback/page.tsx
import { FewchursBoard } from "@fewchurs/next";
import "@fewchurs/next/styles.css";

export default function Page() {
  return <FewchursBoard />;
}

Open /feedback. You should see the board with its tabs, voting, comments and a New request form.

Or add a feedback button to every page

FewchursButton renders only a button. Clicking it slides the board in as a sheet, and nothing is fetched until it opens. Put it in your root layout so it shows everywhere. It does not make your pages dynamic.

// app/layout.tsx
import { FewchursButton } from "@fewchurs/next";
import "@fewchurs/next/styles.css";

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>
        {children}
        <FewchursButton floating>Suggest a feature</FewchursButton>
      </body>
    </html>
  );
}

floating pins it to the bottom right, floating="left" to the bottom left. Leave the children out for the default "Feedback" label.

Deploying and preview URLs

The package reads your domain from each request and checks it against the domains you added in the dashboard. When your site runs on another address, such as a preview deployment, set the domain yourself:

FEWCHURS_APP_ID=yourcompany.com

Setting it also lets you test your production domain from localhost. Add FEWCHURS_API_KEY to your hosting provider's environment variables too.

Customize

CSS variables:

.fewchurs {
  --fw-primary: #ed5f18;
  --fw-radius: 12px;
  --fw-font: var(--font-sans);
}

Props:

<FewchursBoard
  tabs={["top", "new", "roadmap"]} // default: ["top", "new"]
  defaultTab="top"
  showDeclined={false}
  allowComments
  emailField="optional"
  pageSize={20}
  theme={{ primary: "#0f766e", radius: 4 }}
  labels={{ title: "Ideas", submit: "Suggest an idea" }}
/>

<FewchursBoard> is a server component, so it cannot take functions (renderHeader, renderEmpty, renderFeature, onEvent). When you need those, wrap the client board from @fewchurs/react in your own "use client" file, with <FewchursProvider baseUrl="/api/fewchurs"> around it.

// app/feedback/page.tsx
export default async function Page({
  searchParams,
}: {
  searchParams: Promise<{ request?: string }>;
}) {
  const { request } = await searchParams;
  return <FewchursBoard initialFeatureId={request} />;
}

Visit /feedback?request=<id> and the request shows above the list with its comments open, rendered on the server. On Next 14, searchParams is a plain object instead of a Promise.

Signed-in users

Votes are anonymous and tied to an httpOnly cookie that the route handler sets on the first request. To make votes follow the account across devices, return a hashed user id from both the handler and the board. Never use a raw id or an email address.

// app/api/fewchurs/[...route]/route.ts
import { createHandler } from "@fewchurs/next/handler";

export const { GET, POST, DELETE } = createHandler({
  deviceId: async () => hash((await auth()).userId),
});
<FewchursBoard deviceId={async () => hash((await auth()).userId)} />

Options

OptionWhere it is readDefault
apiKeyFEWCHURS_API_KEYnone, required
appIdFEWCHURS_APP_IDthe host of the request
apiPathFEWCHURS_API_PATH/api/fewchurs
baseUrlFEWCHURS_BASE_URLthe Fewchurs API

Pass them as props to <FewchursBoard> and createHandler({ … }), or set the environment variable. If you mount the handler somewhere other than /api/fewchurs, set apiPath on both.

Troubleshooting

You seeWhy, and what to do
"Fewchurs isn't set up"FEWCHURS_API_KEY is missing. Add it to .env.local and restart next dev.
"Invalid API key" (401)The key is wrong. Copy it again from the dashboard.
"Invalid API key" (403)The domain is not added to your app. The message names the domain to add.
Votes and comments fail with a 404The route handler is missing, or not at app/api/fewchurs/[...route]/route.ts.
The board has no stylingYou forgot import "@fewchurs/next/styles.css".
Build error about server-only<FewchursBoard> was imported into a "use client" file. Render it from a server component. This is deliberate, so a key is never bundled for the browser.

Other entry points

  • @fewchurs/next/actions: submitFeatureAction, voteAction, commentAction, followAction, for boards built from plain forms.
  • @fewchurs/next/identity: the httpOnly device-id cookie helpers.
  • @fewchurs/next/handler: createHandler(options) and the ready-made GET, POST, DELETE.

More

License

Proprietary. You may use the package in your own apps to connect them to Fewchurs and customize it through the documented props, CSS variables, slots and hooks. See LICENSE.

版本与发布记录

@fewchurs/next 共发布 13 个版本,首次发布于 2026/10/19;过去 12 个月发布了 13 个版本。

版本发布日期距今
1.7.2latest2026/11/14今天
1.7.12026/11/123 天前
1.7.02026/11/068 天前
1.6.02026/11/068 天前
1.5.02026/11/068 天前
1.4.02026/11/068 天前

关于 @fewchurs/next 的常见问题

@fewchurs/next 是什么?

A server-rendered Fewchurs feature-request board for Next.js, with the API key kept on the server.

如何安装 @fewchurs/next?

在项目目录运行 npm install @fewchurs/next,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:next(>=14)、react(>=18)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@fewchurs/next 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@fewchurs/next 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@fewchurs/next 可以商用吗?

@fewchurs/next 使用 SEE LICENSE IN LICENSE 许可。许可条款写在包内的独立文件中,请阅读该文件确认可否商用。以上为概括,不构成法律意见,请以许可原文为准。

@fewchurs/next 的下载量有多少?

根据 npm 官方下载统计,@fewchurs/next 在 2026/10/15 – 2026/11/13 这 30 天内被下载 1,981 次,日均约 66 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@fewchurs/next 还在维护吗?

最新版本 1.7.2 发布于 2026/11/14(今天);至今共发布 13 个版本,其中过去 12 个月发布了 13 个;首次发布于 2026/10/19。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。