架构总览

十一个蓝图模块如何协作——身份、数据、支付、资讯与运维。

模块如何协作

身份最终落在 users(OAuth、邮箱或 Web3/SIWE)。Profile 与统一模块 负责 user_profiles 及模块/网站表与公开主页。Payments 写入 orders、credits。Cron 填充 资讯/币价/Gas 等缓存并驱动 通知。短链 通过 short_links 把 code 映射到用户。同步与邀请 用 content_sync_records、user_invitations 在用户间同步内容。Admin 在 ADMIN_EMAILS 校验下操作预设与缓存。Dokploy(或同类平台)负责把 环境变量 接到 Postgres 与第三方服务。

flowchart TB
  subgraph identity["身份"]
    O[OAuth / 邮箱]
    W[Web3 / SIWE]
  end
  U[(users)]
  O --> U
  W --> U
  U --> P[Profile 与模块]
  P --> M[(user_profiles、模块相关表)]
  U --> Pay[支付]
  Pay --> OC[(orders、credits)]
  Cron[定时任务] --> NC[(资讯与价格缓存)]
  NC --> NF[资讯 API]
  NF --> App[读者与 UI]
  U --> SL[短链]
  SL --> SLT[(short_links)]
  U --> Sy[同步与邀请]
  Sy --> SyT[(content_sync_records、user_invitations)]
  U --> Ns[通知]
  Ns --> Ps[(push_subscriptions、提醒订阅)]
  Ad[Admin] --> Ops[预设、缓存、调试 API]

模块对照表

模块在系统中的位置登录后的典型流向
OAuthNextAuth 各提供商建立会话 → Profile
Web3 认证NEXT_PUBLIC_WEB3_ENABLED 为真时启用钱包与 SIWE(/api/runtime-config 可回退 WEB3_ENABLED)同一 users 行,写入钱包字段
Profile 与模块主页、模块与网站user_profiles + 模块表
支付Stripe/Creem → 积分更新 orders / credits
短链/i/[code]、/u/[shortId]short_links 关联 users
资讯流读缓存资讯的 API由 Cron 与后台任务写入
通知Web Push、Alpha 提醒等push_subscriptions、VAPID
同步与邀请待处理同步、邀请、口令content_sync_records、user_invitations
Admin预设、资讯运维、统计ADMIN_EMAILS + 管理端 API
Cron定时拉取、提醒流水线CRON_SECRET_KEY + Bearer
Dokploy部署与环境配置 DATABASE_URL、密钥并重部署

环境与库表

各子页底部有 [Dependencies],列出该模块依赖的 环境变量 与 数据表(定义见 src/db/schema.ts)。部署层面可先读 Dokploy,再按模块细查。

架构总览 | 追踪狗文档