展示HN:Pbnj – 一个极简、自托管的粘贴板,可在60秒内部署。
Show HN: Pbnj – A minimal, self-hosted pastebin you can deploy in 60 seconds

原始链接: https://pbnj.sh/

## pbnj: 一个极简的粘贴板解决方案 pbnj 是一个自托管的粘贴板,用于通过简单的 URL 分享代码和文本 – 无需账户。它提供 CLI、API 和 Web 界面,所有配置都通过 `pbnj.config.js` 文件进行。 **安装:** 使用 `npm install -g @pbnjs/cli` 全局安装 CLI,并使用 `pbnj --init` 初始化。 **身份验证:** 所有写入操作(API 和 Web 界面)都需要在 `Authorization` 头部中提供 Bearer token:`Authorization: Bearer YOUR_AUTH_KEY`。 **主要特性:** * **API:** 通过向 `/api` 发送带有 JSON 数据的 POST 请求创建粘贴。 * **Web 界面:** 使用相同的身份验证密钥,直接从浏览器管理粘贴。 * **部署:** 可以在 GitHub 仓库上使用一键按钮轻松部署到 Cloudflare。 * **成本:** Cloudflare 的免费套餐提供 500MB 存储空间和充足的读/写操作。

## Pbnj:一个极简、自托管的粘贴板 Pbnj 是一款新的、轻量级的粘贴板,旨在实现简洁和自托管。它由一位对现有复杂选项感到沮丧的开发者创建,目标是 60 秒内完成部署,提供 100 多种语言的语法高亮显示、易记的 URL 以及带有可选密钥的私有粘贴。 它有意保持极简——没有账户、git 集成或过期粘贴等功能——并且不打算取代 Gist 等平台。创建者强调对数据所有权的需求以及享受自托管的乐趣是关键动力。 目前针对 Cloudflare(免费套餐允许约 10 万个粘贴)优化了一键部署,该项目是开源的,可在 GitHub 上找到。虽然目前 Cloudflare 部署是首选,但开发者计划添加对 VPC 和 Dockerfile 的支持,以提供更广泛的托管选项。用户正在讨论保护自托管实例的方法,例如反向代理和 VPN,以防止未经授权的公开访问。 **链接:** * **演示:** [https://pbnj.sh](https://pbnj.sh) * **GitHub:** [https://github.com/bhavnicksm/pbnj](https://github.com/bhavnicksm/pbnj)
相关文章

原文
# API Reference

## Authentication

All write operations require a Bearer token:
```
Authorization: Bearer YOUR_AUTH_KEY
```

## Endpoints

### Create Paste

POST /api

#### JSON Request
```bash
curl 
05_api.md
9 hours ago
# CLI Reference

## Installation

```bash
npm install -g @pbnjs/cli
```

## Configuration

Run the setup wizard:
```bash
pbnj --init
```

This creates ~/.pbnj with your configuration:
```
PBNJ_HOST=ht
04_cli.md
9 hours ago
# Cost Breakdown

"This is deployed on Cloudflare, they might charge us eventually!"

Don't worry. Let's do the math.

## Cloudflare D1 Free Tier

- 500 MB storage
- 5 million reads/day
- 100,000 writ
03_cost.md
9 hours ago
# Deployment Guide

## One-Click Deploy (Recommended)

Click the "Deploy to Cloudflare" button on the GitHub repo — that's it!

The deploy button automatically:
- Forks the repo to your GitHub account
02_deployment.md
9 hours ago
# Welcome to pbnj

pbnj is a simple, minimal self-hosted pastebin solution.

## What is pbnj?

pbnj lets you share code snippets and text files with a simple URL.
No accounts, no bloat - just paste an
01_welcome.md
9 hours ago
# Web Interface

pbnj includes a web interface for creating and managing pastes directly from your browser.

## Authentication

The web interface uses the same `AUTH_KEY` as the CLI and API. Authentic
07_web_interface.md
9 hours ago
# Configuration

pbnj is configured through a single `pbnj.config.js` file in the project root.

## Default Configuration

```js
export default {
  name: 'pbnj',
  logo: '/logo.png',
  idStyle: 'sandw
06_configuration.md
9 hours ago
联系我们 contact @ memedata.com