ecomYB/README.md
eric 5559308690 Initial TubeMart YPP channel market with NOWPayments checkout.
Document local setup, env vars, and API in README; sync to Gitea.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-22 22:29:23 -05:00

75 lines
1.9 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# TubeMart (ecomYB)
YouTube 色调的单页 SPA:出售已开通 **YPP(YouTube Partner Program)** 的频道,加密货币结账走 **NOWPayments**。
仓库:https://gitea.dsx2020.com/eric/ecomYB
## 功能
- 单页市场:筛选、列表点选、右侧详情
- 动效:漂浮 emoji、跑马灯、CountUp、SVG 折线 / 柱状图
- 支付:`POST /api/pay/invoice` 创建 NOWPayments 发票并跳转收银台
- 回调:`POST /api/pay/ipn` 校验 `x-nowpayments-sig`(HMAC-SHA512)
## 技术栈
- Next.js 15(App Router)+ React 19 + TypeScript
- 前端:`src/components/SpaApp.tsx`、`Viz.tsx`
- 库存数据:`src/lib/channels.ts`
- 支付封装:`src/lib/nowpayments.ts`
## 本地启动
```bash
npm install
cp .env.example .env.local # 填入 NOWPayments 密钥
npm run dev
```
打开 http://localhost:3000
生产构建:
```bash
npm run build
npm start
```
## 环境变量
| 变量 | 说明 |
|------|------|
| `NOWPAYMENTS_API_KEY` | NOWPayments API Key |
| `NOWPAYMENTS_IPN_SECRET` | IPN 签名密钥 |
| `NOWPAYMENTS_PAYOUT_USDT_TRX` | 结算钱包(USDT TRC20,可选备注) |
| `SITE_URL` | 站点根 URL;本地用 `http://localhost:3000`,上线须公网 HTTPS(IPN 依赖) |
`.env.local` 已加入 `.gitignore`,不要提交密钥。
## 修改库存
编辑 `src/lib/channels.ts`:名称、niche、订阅数、价格、`trend` / `weekly` 图表数据等。
## API
| 方法 | 路径 | 说明 |
|------|------|------|
| `POST` | `/api/pay/invoice` | Body: `{ "channelId": "ch-xxx" }` → `{ invoiceUrl }` |
| `POST` | `/api/pay/ipn` | NOWPayments IPN webhook |
支付成功跳转:`/success?channel=<id>`
## 目录结构
```
src/
app/ # 页面与 API routes
components/ # SpaApp、图表与图标
lib/ # channels、nowpayments
.env.example # 环境变量模板
```
## License
Private — eric / ecomYB