Next.jsReact工具站

Preface — Next.js 工具站模板

作者 Abudora-0

Preface 是一个把项目材料转成结构化 README 的本地工具,先解析 package.json、Cargo.toml、pyproject.toml、go.mod 等清单,再由用户编辑并渲染成 Markdown,可选调用本地 Ollama 模型润色文字。

看看你的网站会是什么样

浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。

2 个预览视图
桌面端首页1 / 2
桌面端截图首屏预览

由服务器浏览器实际访问页面后截取。

全部页面与视图 2

截图用于了解视觉与布局,交互效果请以实际项目为准。

采集于 2026-10-14查看来源

值得关注的模板亮点

从已有项目资料中,快速了解它的特点。

01

解析 package.json、Cargo.toml、pyproject.toml 和 go.mod,提取名称、描述、许可证、作者、仓库、脚本、环境变量、语言构成、依赖和文件树

02

支持从 GitHub 仓库 URL 导入描述、许可证、语言构成、topics 和根清单

03

提供 GitHub 风格的明暗主题实时预览,允许并净化原始 HTML

04

内置约八十个 shields.io 徽章,覆盖语言、框架、数据库和基础设施,四种样式

05

八种模板渲染同一份结构化数据,切换模板不会丢失内容

06

生成环节默认使用本地 Ollama,Claude 需显式设置 AI_PROVIDER=anthropic 才会启用

模板详细介绍

Preface 的核心是一个确定性解析器,而不是单纯的提示词包装。README 说明它读取粘贴进来的 package.json、文件树、源码或草稿,提取项目名称、描述、许可证、作者、仓库、脚本、环境变量、语言构成、依赖列表和文件树,也支持 action.yml 的输入输出以及 workspace 包。身份信息来自 package.json、Cargo.toml、pyproject.toml 或 go.mod,因此 Rust crate、Python 包和 Go module 与 npm 项目一样能被读取;pyproject.toml 同时支持 PEP 621 的 [project] 和 Poetry 的 [tool.poetry] 布局,go.mod 只提供模块名、所在仓库、Go 版本和直接依赖。解析、编辑、预览、徽章构建和模板渲染都在本地运行,生成环节默认针对本地 Ollama 模型,因此可离线使用。README 也说明了托管部署的限制:默认 Ollama 地址指向服务器自身回环地址,生成环节无法运行,官方建议设置 PREFACE_DISABLE_AI=1 隐藏生成相关界面,并设置 GITHUB_TOKEN 以应对未认证 GitHub 每小时 60 次的请求限制。

Next.js工具站

适合你的项目吗?

适用场景

  • 把已有项目的 package.json、文件树和源码粘贴进来,生成结构化的 README 草稿
  • 为 GitHub Action 或 monorepo 生成输入输出表、工作流片段或包列表
  • 在本地离线环境用 Ollama 模型润色 README 文字,事实仍由解析器提供
  • 在托管部署上关闭 AI 生成,仅使用解析器和编辑器功能

适合人群

  • 需要为 npm、Rust、Python 或 Go 项目整理 README 的开发者
  • 希望 README 生成过程不离开本机、不使用账号或 API key 的用户
  • 维护 GitHub Action 或 monorepo、需要自动生成输入输出表或包列表的维护者
  • 想用本地小模型辅助写作、同时要求依赖和脚本等事实不被模型改写的用户

上手与定制指南

结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。

  1. 1

    需要 Node.js 20 或更新版本,运行 npm install 和 npm run dev,应用默认在 http://localhost:3000

  2. 2

    生成环节为可选,需要安装 Ollama,执行 ollama serve 并拉取配置的模型(默认 qwen2.5:1.5b)

  3. 3

    所有环境变量均为可选,可复制 .env.local.example 为 .env.local 进行配置

  4. 4

    托管部署时建议设置 PREFACE_DISABLE_AI=1,并设置 GITHUB_TOKEN 以避免未认证的 GitHub 请求限制

  5. 5

    使用 Claude 必须同时设置 AI_PROVIDER=anthropic 和 ANTHROPIC_API_KEY,仅有 key 不会启用

查看仓库使用说明

授权与来源资料

使用条件与限制

免费使用 · 保留许可声明

本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。

使用时需要遵守

  • 允许免费使用、修改、商用和分发该版本代码。
  • 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
  • 代码按现状提供;担保与责任限制以原许可证及适用法律为准。

额外费用与待核对事项

  • 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
  • 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
  • 生成环节为可选功能,需要本地安装并运行 Ollama;不安装则只能使用解析、编辑、预览和模板渲染等本地功能。
  • 使用生成环节前必须先用 ollama pull 拉取所配置的模型(默认 qwen2.5:1.5b),否则生成无法运行。
  • 托管部署时应设置 PREFACE_DISABLE_AI=1,否则生成按钮会提示访客启动 ollama serve,而访客无法执行该操作。
  • 仅当 AI_PROVIDER=anthropic 时才会读取 ANTHROPIC_API_KEY;使用 Claude 需要自备 API key 并承担相应费用。
  • 未设置 GITHUB_TOKEN 时,GitHub 仓库导入受每小时 60 次请求限制;托管部署下该限制按 IP 计算,所有访客共用同一配额。
  • 即使环境中已存在 ANTHROPIC_API_KEY,也必须显式设置 AI_PROVIDER=anthropic 才会启用 Claude,避免因环境变量意外产生 API 计费。
  • 托管部署时默认 Ollama 地址指向服务器自身回环地址,生成环节无法运行,需自行提供服务器可访问的模型服务。
  • 托管部署建议设置 GITHUB_TOKEN,否则未认证的 GitHub 请求限制会因所有访客共用同一 IP 而更容易被触发。
查看原文依据

Permission is hereby granted, free of charge

许可证原文

- [Ollama](https://ollama.com), optional, only for the generation pass

README 原文

ollama pull qwen2.5:1.5b

README 原文

| `PREFACE_DISABLE_AI` | unset | Set to `1` on a hosted deployment to hide the generation pass entirely |

README 原文

| `ANTHROPIC_API_KEY` | unset | Only read when `AI_PROVIDER=anthropic` |

README 原文

| `GITHUB_TOKEN` | unset | Raises repo import from 60 to 5000 requests per hour |

README 原文

`AI_PROVIDER=anthropic` is required to use Claude even when a key is already

README 原文

Generation needs a model the server can reach. Hosted, the default Ollama URL

README 原文

Set `GITHUB_TOKEN` as well when hosting. The unauthenticated GitHub limit of 60

README 原文
https://github.com/Abudora-0/Preface/blob/main/LICENSEhttps://github.com/Abudora-0/Preface/blob/main/README.md

DeepSeek 根据仓库许可证和 README 整理 ·2026-10-14。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。

项目核对记录与介绍依据

模板资料

来源平台
GitHub
资料与维护参考分
资料较完整 · 80 / 100
技术栈
Next.js · React
网站类型
工具站
这个分数如何计算

本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。

这个项目需要核对什么

记录的仓库更新时间
2026-08-23
截图检查日期
2026-10-14

已收录演示链接。请用你的内容与屏幕尺寸检查;有演示不代表表单、认证或支付已经可用。

目录记录的主要技术栈是 Next.js。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。

查看具体选型方法 →

介绍的制作与核对状态

介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。

审核声明: codex-user-requested-batch-review-20261015 · 2026-10-15

查看当时使用的来源资料

SHA-256: 0c7b4227f179cd68f6e15c964514f02c82eca5c93a097186ab3d5ad3c4283ee4

2026-10-14T22:53:21.964Z

来源文件 / 仓库
<div align="center">

<img src="src/app/icon.svg" alt="" width="76" height="76" />

<h1>Preface</h1>

<p><i>Dump your project in, get a well organised README out.</i></p>

<p>
  <img src="https://img.shields.io/github/actions/workflow/status/Abudora-0/Preface/ci.yml?style=for-the-badge&label=CI&labelColor=161b23" alt="CI status" />
  <img src="https://img.shields.io/badge/license-MIT-3fb950?style=for-the-badge" alt="MIT license" />
  <img src="https://img.shields.io/badge/Next.js-16-000000?style=for-the-badge&logo=nextdotjs&logoColor=white" alt="Next.js 16" />
  <img src="https://img.shields.io/badge/TypeScript-5-3178C6?style=for-the-badge&logo=typescript&logoColor=white" alt="TypeScript 5" />
  <img src="https://img.shields.io/badge/Tailwind_CSS-4-06B6D4?style=for-the-badge&logo=tailwindcss&logoColor=white" alt="Tailwind CSS 4" />
  <img src="https://img.shields.io/badge/Ollama-local-000000?style=for-the-badge&logo=ollama&logoColor=white" alt="Runs on local Ollama" />
  <img src="https://img.shields.io/badge/tests-162_passing-3fb950?style=for-the-badge" alt="162 tests passing" />
</p>

<p><b>No account. No API key. Nothing leaves your machine.</b></p>

</div>

---

Preface turns a pile of project material into a structured README. Paste a
`package.json`, a file tree, some source files or rough notes, and it parses what
it can, fills a form you control, and renders markdown through one of eight
templates, with a GitHub-accurate live preview beside it.

The parser, editor, preview, badge builder and templates all run locally. The
optional generation pass adds prose on top and runs against a local
[Ollama](https://ollama.com) model by default, so the whole thing works offline
and costs nothing.

## Contents

- [Why it works without a model](#why-it-works-without-a-model)
- [Features](#features)
- [Getting Started](#getting-started)
- [Configuration](#configuration)
- [Deploying](#deploying)
- [Templates](#templates)
- [How it works](#how-it-works)
- [Tests](#tests)
- [Project Structure](#project-structure)
- [Implementation notes](#implementation-notes)
- [License](#license)

## Why it works without a model

Most README tools are a prompt wrapped in a text box. Preface is a parser first.

`analyze.ts` reads the dump and extracts the project name, description, license,
author, repository, scripts, environment variables, language mix, dependency list
and file tree, plus `action.yml` inputs and outputs and workspace packages. All
of that is deterministic and instant.

Identity comes from `package.json`, `Cargo.toml`, `pyproject.toml` or `go.mod`,
so a Rust crate, a Python package or a Go module is read as thoroughly as an npm
one. Both PEP 621 `[project]` and Poetry's older `[tool.poetry]` layout are
understood, along with console entry points. `go.mod` carries no description or
licence, so it supplies the module name, the repository it lives at, the Go
version as a prerequisite, and the direct requirements only: indirect ones are
what the module graph dragged in rather than what the project chose.

A manifest is also proof of its own language, so a `go.mod` or `Cargo.toml`
pasted alone is recognised even with no source files beside it. Where a
repository ships more than one manifest, `package.json` wins: it names the
artifact people install.

A model is only ever asked to improve the writing on top of that structure. Facts
come from the parser and are never overwritten, which is what makes a small local
model a reasonable choice: a weaker model produces flatter prose, not invented
dependencies.

## Features

| Feature | Detail |
| --- | --- |
| **Dump in, README out** | Reads `package.json`, `Cargo.toml`, `pyproject.toml` and `go.mod` for identity, detects npm, pnpm, yarn, bun, pip, cargo and go, then pulls out the stack, scripts, env vars and structure |
| **Import from GitHub** | Paste a repo URL to pull description, license, language breakdown, topics and root manifests |
| **Live preview** | GitHub-accurate rendering in both light and dark theme, with raw HTML allowed and sanitised |
| **Badge builder** | Around eighty shields.io badges across languages, frameworks, databases and infrastructure, in four styles |
| **Eight templates** | The same structured data rendered eight ways, switchable without losing content |
| **Split editing** | Resizable panes driven by mouse, touch, pen or keyboard, with scroll sync and line numbers |
| **Optional AI pass** | Local Ollama by default, Claude behind an explicit opt-in, with live progress |

## Getting Started

### Prerequisites

- Node.js 20 or newer
- [Ollama](https://ollama.com), optional, only for the generation pass

### Installation

```bash
npm install
npm run dev
```

The app is then at <http://localhost:3000>.

### Optional: the generation pass

```bash
ollama serve
ollama pull qwen2.5:1.5b
```

The status endpoint asks the daemon directly whether it is running and whether
the configured model is present, so the builder tells you which of those is
missing instead of failing when you press Generate.

## Configuration

Everything is optional. Copy `.env.local.example` to `.env.local` to change any
of it.

| Variable | Default | Purpose |
| --- | --- | --- |
| `PREFACE_DISABLE_AI` | unset | Set to `1` on a hosted deployment to hide the generation pass entirely |
| `OLLAMA_URL` | `http://127.0.0.1:11434` | Where the local Ollama daemon is listening |
| `OLLAMA_MODEL` | `qwen2.5:1.5b` | The model to generate with. Must already be pulled. |
| `AI_PROVIDER` | `ollama` | Set to `anthropic` to use Claude instead |
| `ANTHROPIC_API_KEY` | unset | Only read when `AI_PROVIDER=anthropic` |
| `GITHUB_TOKEN` | unset | Raises repo import from 60 to 5000 requests per hour |

`AI_PROVIDER=anthropic` is required to use Claude even when a key is already
present in the environment. A key can be exported by an unrelated tool, and
billing an API because of an ambient variable is not a decision this app makes
for you.

## Deploying

Generation needs a model the server can reach. Hosted, the default Ollama URL
is the server's own loopback with nothing behind it, so the pass can never run
there, and a disabled button telling visitors to start `ollama serve` is advice
they cannot act on.

```bash
PREFACE_DISABLE_AI=1
```

Set that and the deployment is a parser and editor: the Generate button, the
model status probe and the AI wording are not rendered at all, and
`/api/generate` answers 404. Everything else is unaffected, and the analyzer
runs in the browser either way. Leave it unset locally to get the model pass
back.

Set `GITHUB_TOKEN` as well when hosting. The unauthenticated GitHub limit of 60
requests an hour is counted per IP, and a serverless deployment puts every
visitor behind the same one.

## Templates

| Template | Best for |
| --- | --- |
| Minimal | Libraries and anything small |
| Standard OSS | Most public repositories |
| Showcase | Portfolio projects and launches |
| Documentation | SDKs, APIs, internal tooling |
| CLI tool | Command line tools and dev utilities |
| GitHub Action | Anything published to the Actions marketplace |
| Monorepo | Workspaces with several published packages |
| Profile README | `github.com/<you>/<you>` |

The model may describe workspace packages and Action inputs and outputs, but
it may not decide which ones exist. Those names are read out of the member
manifests and `action.yml`, and people copy the resulting tables straight into
a workflow file, so an invented entry would be a broken instruction rather than
flat prose.

Three of these carry their own data. Paste or import an `action.yml` and the inputs
and outputs tables fill themselves, then the workflow snippet is generated from
those same inputs so the two cannot drift apart. Paste a workspace and its member
manifests and the package table fills itself, with the root manifest excluded.

Profile README asks for the things a profile is made of rather than the things a
project is: a GitHub handle, what you are working on and learning, what to ask
you about, and any number of links. The handle matters most, since every stats,
streak and profile-view card is keyed on it; an import fills it from the
repository owner so the cards work before you have typed anything.

## How it works

Everything flows through one `ProjectSpec` object:

```text
dump / repo ──▶ analyzer ──▶ ProjectSpec ──▶ renderer ──▶ markdown
                    │            ▲
              (optional)         │
            Ollama / Claude ─────┘
```

- **`src/lib/analyze.ts`** is the deterministic extraction described above.
- **`src/lib/ai.ts`** is the optional model pass, provider agnostic. It runs the
  analyzer first and feeds the result to the model as grounding, then merges:
  facts from the parser win, prose from the model wins.
- **`src/lib/render.ts`** turns a `ProjectSpec` into markdown. Switching template
  never loses data because all eight render the same spec.

## Tests

The analyzer, renderer and merge logic are pure functions, so they are covered
directly with vitest:

```bash
npm test
npm run test:watch
```

The suite pins the behaviours that are easy to break by accident: blank line
separation in generated markdown, badges emitting real `<img>` tags inside HTML
blocks, table versus list fallbacks, anchors resolving to headings that exist,
the `action.yml` and workspace readers, and the rule that a model can never
rewrite a real script command.

## Project Structure

```text
src/
├── app/
│   ├── api/
│   │   ├── generate/    Model pass, Ollama or Claude
│   │   ├── github/      Repo import
│   │   └── status/      Which integrations are usable right now
│   ├── builder/         The split-screen workspace, with its error.tsx
│   ├── apple-icon.tsx   180x180 touch icon, generated with next/og
│   ├── opengraph-image.tsx  1200x630 social card, same generator
│   ├── icon.svg         Favicon (the pilcrow mark)
│   ├── globals.css      Design tokens, motion, GitHub markdown styles
│   └── page.tsx         Landing page
├── components/
│   ├── ContribGraph.tsx Animated contribution heatmap
│   ├── ErrorBoundary.tsx Contains a render failure to one region
│   ├── PrefaceMark.tsx  Brand mark (geometric pilcrow)
│   ├── Preview.tsx      Sanitised GitHub-accurate markdown renderer
│   ├── Reveal.tsx       Scroll reveal wrapper
│   ├── SectionNav.tsx   Scroll-synced repo-style tabs
│   ├── Toast.tsx        Transient action confirmations
│   ├── TypingDemo.tsx   Live markdown-to-preview demo
│   ├── Wordmark.tsx     Per-letter animated wordmark
│   ├── panels.tsx       Import / Dump / Details / Sections / Badges / Style
│   └── ui.tsx           Buttons, boxes, fields, toggles
└── lib/
    ├── ai.ts            Provider-agnostic model pass and spec merge
    ├── analyze.ts       Deterministic project analyzer
    ├── badges.ts        ~80 shields.io badge definitions
    ├── render.ts        ProjectSpec -> markdown, eight templates
    ├── templates.ts     Template metadata
    └── types.ts         ProjectSpec and section keys
```

## Implementation notes

A few things that are easy to get wrong and worth knowing before editing.

**Values written into raw HTML are escaped, and link targets are validated.**
Not every value in a spec belongs to the person editing it: importing a
repository by URL pulls in that repository's description and homepage, which
belong to whoever owns it. The templates that emit real HTML run text through
`escHtml` and link targets through `httpUrl`, so an imported description cannot
close the tag it sits in, and a target that is not http(s) is dropped rather
than written out. The preview's sanitizer is the second layer, not the only
one, and it deliberately does not allow `style`: GitHub strips inline styles
from rendered READMEs, so permitting them made the preview less accurate while
handing any pasted node control over position and stacking.

**Markdown is not parsed inside raw HTML blocks.** Templates that wrap badges in
a `<p>` emit real `<img>` tags rather than markdown image syntax, otherwise they
render as literal `![Stars](…)` text on GitHub. The badge row at the top of this
file follows the same rule.

**Base element resets live inside `@layer base`.** Unlayered CSS outranks
anything in a layer regardless of specificity, so a bare `textarea { … }` rule
silently beats Tailwind's `font-mono` utility.

**The line-number gutter draws one row per logical line**, so it is only correct
while soft wrap is off. Toggling wrap on hides the gutter rather than showing
numbers that drift.

**Generation progress is read off the output, not off a timer.** Schema
constrained decoding emits the top level keys in the order they are declared,
so the bar advances when a key has actually been written and cannot run ahead
of the model. Because the response streams, a failure arrives as an error event
in the body rather than an HTTP status, which is already committed by then.

**A failing panel does not take the workspace down.** Each region of the
builder sits behind its own boundary, so a panel that cannot render is replaced
on its own while the editor, preview and draft stay on screen. The route level
`error.tsx` is the backstop, and it offers to save or clear the stored draft,
because a draft that crashes on restore makes a plain retry a loop.

**Local models get a smaller dump.** The budget scales with parameter count, 8k
characters at 1.5B up to 40k above 9B, against 180k for Claude. Ollama silently
drops anything past `num_ctx` rather than erroring, and small models lose the
thread well before they run out of context.

## License

[MIT](LICENSE)
反馈内容错误

看看同类模板

对比同技术栈与用途的模板,找到更适合的视觉与内容结构。