创建自己的 LDC 小店

摘要

文章全文摘抄自我的博客 部署 LDC 商店,简要讲述了如何创建自己的LDC小店

感谢 @chatgpt 的开源项目

准备工作

  • 注册 Linux Do

  • 注册 Cloudflare 并绑定域名,没有域名可点击注册,推荐 com

  • 点击申请接入 Linux DO Connect,填写示例如下

    名称 示例
    应用名 Reno’s Store
    应用主页 https://shop.xxxx.com
    回调地址 https://shop.xxxx.com/api/auth/callback/linuxdo
  • 点击在 Linux DO Credit 创建应用,填写示例如下

    名称 示例
    应用名称 Reno' Store
    应用描述 Reno 的小店
    应用主页 URL https://shop.xxxx.com
    通知 URL https://shop.xxxx.com/api/notify
    回调 URI https://shop.xxxx.com/callback

开始部署

点击创建 D1数据库,名称填写 ldc-shop,点击创建,然后点击红圈复制 ID

点击 Fork 仓库,并根据 D1数据库 ID 修改 _workers_next/wrangler.json 并在 Action 标签找到 Upstream Sync 后点击 enable

{
    "name": "ldc-shop",
    "main": ".open-next/worker.js",
    "compatibility_date": "2025-11-12",
    "compatibility_flags": ["nodejs_compat"],
    "assets": {
        "directory": ".open-next/assets",
        "binding": "ASSETS"
    },
    "d1_databases": [
        {
            "binding": "DB",
            "database_name": "ldc-shop",
            "database_id": "你的数据库ID"
        }
    ],
    "observability": {
        "enabled": true
    }
}

点击创建 Workers,点击 Continue with github,如果还没绑定 GitHub 需要先按步骤绑定

选择 ldc-shop,点击下一步,构建命令填写

npm install && npx opennextjs-cloudflare build

下拉找到高级设置点击展开,路径填写

_workers_next

然后点击部署

点击完成最后的设置

域和路由 点击 + 添加 - 自定义域,输入绑定域名的二级域如 shop.xxxx.com 后点击添加域

变量和机密 点击 + 添加,依次填写

变量名 类型 说明
OAUTH_CLIENT_ID 密钥 Linux DO Connect Client ID
OAUTH_CLIENT_SECRET 密钥 Linux DO Connect Client 密钥
MERCHANT_ID 密钥 Linux DO Credit Client ID
MERCHANT_KEY 密钥 Linux DO Credit Client Key
AUTH_SECRET 密钥 随机加密字符串,如 123456abcdefg
ADMIN_USERS 密钥 管理员 Linux DO 用户名,多个用户名用逗号分隔
NEXT_PUBLIC_APP_URL 文本 你绑定的域名,如 https://shop.xxxx.com

参考链接

81 个赞

感谢R佬分享

你好,第一步注册不了怎么办

建议把号扬了 肯定是号黑了 :thinking:

1 个赞

谢谢 正想学一下

感谢分享

4 个赞

谢谢分享

1 个赞

太强了,Reno佬!

1 个赞

学习学习

感谢分享

感谢分享

1 个赞

很好的教程

1 个赞

这一步找不到Upstream Sync,求教:tieba_009:

2 个赞

3 个赞

好的,学到了,谢谢佬友!!

感谢分享

請教下怎麽活得LDC積分呢

1 个赞

感谢分享,一路按教程进行操作,非常顺畅的创建好了小店.

1 个赞

感谢佬友分享

你好,请问这个Linux DO Credit Client ID 和 key去哪里查看啊?