Token导航 LogoToken导航TokenDH.com
前端设计敏感数据github未标认证来源可访问许可证需确认审计提醒

bknd-deploy-hostingbknd 部署托管

Agent Skill

用于辅助云资源、部署、容器、基础设施和运维自动化任务。它适合让 Agent 检查配置、整理部署步骤、分析资源状态、生成排障思路或辅助云服务接入。使用时需要明确目标环境、账号权限、区域和资源组,区分本地测试与生产操作;涉及删除资源、重启服务、修改网络或权限配置时,应先确认影响范围。

总安装

326

周安装

14

GitHub Stars

3

下载量

114
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:bknd-deploy-hosting(bknd 部署托管)
来源仓库:https://github.com/cameronapak/bknd-skills
仓库路径:skills/bknd-deploy-hosting
安装命令:
npx skills add https://github.com/cameronapak/bknd-skills --skill bknd-deploy-hosting
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/cameronapak/bknd-skills --skill bknd-deploy-hosting

简介

用于辅助云资源部署、容器管理和基础设施自动化任务。

  • 适合检查配置、整理部署步骤、分析资源状态或生成排障思路。
  • 通过代码模式配置目标平台适配器,支持 CI/CD 流水线集成。
  • 需明确环境、账号权限和区域资源组,生产操作前应确认影响范围。
  • bknd-deploy-hosting 属于前端设计类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Deploy to Hosting

Deploy your Bknd application to various hosting platforms.

Prerequisites

  • Working Bknd application locally
  • Schema defined and tested
  • Database provisioned (see bknd-database-provision)
  • Environment variables prepared (see bknd-env-config)

When to Use UI Mode

  • Cloudflare/Vercel dashboards for environment variables
  • Platform-specific deployment settings
  • Viewing deployment logs

When to Use Code Mode

  • All deployment configuration and commands
  • Adapter setup for target platform
  • CI/CD pipeline configuration

Platform Selection Guide

PlatformBest ForDatabase OptionsCold Start
Cloudflare WorkersEdge, global low-latencyD1, Turso~0ms
Cloudflare PagesStatic + APID1, Turso~0ms
VercelNext.js appsTurso, Neon~200ms
Node.js/Bun VPSFull control, dedicatedAnyN/A
DockerContainerized, portableAnyN/A
AWS LambdaServerless, pay-per-useTurso, RDS~500ms

Code Approach

Cloudflare Workers

Step 1: Install Wrangler

npm install -D wrangler

Step 2: Create wrangler.toml

name = "my-bknd-app"
main = "src/index.ts"
compatibility_date = "2024-01-01"

[[d1_databases]]
binding = "DB"
database_name = "my-database"
database_id = "your-d1-database-id"

# Optional: R2 for media storage
[[r2_buckets]]
binding = "R2_BUCKET"
bucket_name = "my-bucket"

[vars]
ENVIRONMENT = "production"

Step 3: Configure Adapter

// src/index.ts
import { hybrid, type CloudflareBkndConfig } from "bknd/adapter/cloudflare";
import { d1Sqlite } from "bknd/adapter/cloudflare";
import { em, entity, text } from "bknd";

const schema = em({
  posts: entity("posts", {
    title: text().required(),
  }),
});

export default hybrid<CloudflareBkndConfig>({
  app: (env) => ({
    connection: d1Sqlite({ binding: env.DB }),
    schema,
    isProduction: true,
    auth: {
      jwt: {
        secret: env.JWT_SECRET,
      },
    },
    config: {
      media: {
        enabled: true,
        adapter: {
          type: "r2",
          config: { bucket: env.R2_BUCKET },
        },
      },
    },
  }),
});

Step 4: Create D1 Database

# Create database
wrangler d1 create my-database

# Copy the database_id to wrangler.toml

Step 5: Set Secrets

wrangler secret put JWT_SECRET
# Enter your secret (min 32 chars)

Step 6: Deploy

wrangler deploy

Cloudflare Pages (with Functions)

Step 1: Create functions/api/[[bknd]].ts

import { hybrid, type CloudflareBkndConfig } from "bknd/adapter/cloudflare";
import { d1Sqlite } from "bknd/adapter/cloudflare";
import schema from "../../bknd.config";

export const onRequest = hybrid<CloudflareBkndConfig>({
  app: (env) => ({
    connection: d1Sqlite({ binding: env.DB }),
    schema,
    isProduction: true,
    auth: {
      jwt: { secret: env.JWT_SECRET },
    },
  }),
});

Step 2: Configure Pages

In Cloudflare dashboard:

  1. Connect your git repository
  2. Set build command (if any)
  3. Add D1 binding under Settings > Functions > D1 Database Bindings
  4. Add environment variables under Settings > Environment Variables

Node.js / Bun (VPS)

Step 1: Create Production Entry

// index.ts
import { serve, type BunBkndConfig } from "bknd/adapter/bun";
// or for Node.js:
// import { serve } from "bknd/adapter/node";

const config: BunBkndConfig = {
  connection: {
    url: process.env.DB_URL!,
    authToken: process.env.DB_TOKEN,
  },
  isProduction: true,
  auth: {
    jwt: {
      secret: process.env.JWT_SECRET!,
      expires: "7d",
    },
  },
  config: {
    media: {
      enabled: true,
      adapter: {
        type: "s3",
        config: {
          bucket: process.env.S3_BUCKET!,
          region: process.env.S3_REGION!,
          accessKeyId: process.env.S3_ACCESS_KEY!,
          secretAccessKey: process.env.S3_SECRET_KEY!,
        },
      },
    },
    guard: {
      enabled: true,
    },
  },
};

serve(config);

Step 2: Set Environment Variables

export DB_URL="libsql://your-db.turso.io"
export DB_TOKEN="your-turso-token"
export JWT_SECRET="your-32-char-minimum-secret"
export PORT=3000

Step 3: Run with Process Manager

# Using PM2
npm install -g pm2
pm2 start "bun run index.ts" --name bknd-app

# Or systemd (create /etc/systemd/system/bknd.service)

Docker

Step 1: Create Dockerfile

FROM oven/bun:1.0-alpine

WORKDIR /app

COPY package.json bun.lockb ./
RUN bun install --frozen-lockfile --production

COPY . .

# Create data directory for SQLite (if using file-based)
RUN mkdir -p /app/data

ENV PORT=3000

EXPOSE 3000

CMD ["bun", "run", "index.ts"]

Step 2: Create docker-compose.yml

version: "3.8"
services:
  bknd:
    build: .
    ports:
      - "3000:3000"
    volumes:
      - bknd-data:/app/data
    environment:
      - DB_URL=file:/app/data/bknd.db
      - JWT_SECRET=${JWT_SECRET}
      - NODE_ENV=production
    restart: unless-stopped

volumes:
  bknd-data:

Step 3: Deploy

# Build and run
docker compose up -d

# View logs
docker compose logs -f bknd

Vercel (Next.js)

Step 1: Create API Route

// app/api/bknd/[[...bknd]]/route.ts
export { GET, POST, PUT, DELETE, PATCH } from "bknd/adapter/nextjs";

Step 2: Create bknd.config.ts

import type { NextjsBkndConfig } from "bknd/adapter/nextjs";
import { em, entity, text } from "bknd";

const schema = em({
  posts: entity("posts", {
    title: text().required(),
  }),
});

type Database = (typeof schema)["DB"];
declare module "bknd" {
  interface DB extends Database {}
}

export default {
  app: (env) => ({
    connection: {
      url: env.DB_URL,
      authToken: env.DB_TOKEN,
    },
    schema,
    isProduction: env.NODE_ENV === "production",
    auth: {
      jwt: { secret: env.JWT_SECRET },
    },
  }),
} satisfies NextjsBkndConfig;

Step 3: Set Vercel Environment Variables

In Vercel dashboard or CLI:

vercel env add DB_URL
vercel env add DB_TOKEN
vercel env add JWT_SECRET

Step 4: Deploy

vercel deploy --prod

AWS Lambda

Step 1: Install Dependencies

npm install -D serverless serverless-esbuild

Step 2: Create handler.ts

import { createHandler } from "bknd/adapter/aws";

export const handler = createHandler({
  connection: {
    url: process.env.DB_URL!,
    authToken: process.env.DB_TOKEN,
  },
  isProduction: true,
  auth: {
    jwt: { secret: process.env.JWT_SECRET! },
  },
});

Step 3: Create serverless.yml

service: bknd-api

provider:
  name: aws
  runtime: nodejs20.x
  region: us-east-1
  environment:
    DB_URL: ${env:DB_URL}
    DB_TOKEN: ${env:DB_TOKEN}
    JWT_SECRET: ${env:JWT_SECRET}

plugins:
  - serverless-esbuild

functions:
  api:
    handler: handler.handler
    events:
      - http:
          path: /{proxy+}
          method: ANY
      - http:
          path: /
          method: ANY

Step 4: Deploy

serverless deploy --stage prod

Pre-Deployment Checklist

# 1. Generate types
npx bknd types

# 2. Test locally with production-like config
DB_URL="your-prod-db" JWT_SECRET="your-secret" npx bknd run

# 3. Verify schema sync
# Schema auto-syncs on first request in production

Environment Variables (All Platforms)

VariableRequiredDescription
DB_URLYesDatabase connection URL
DB_TOKENDependsAuth token (Turso/LibSQL)
JWT_SECRETYesMin 32 chars for security
PORTNoServer port (default: 3000)

Common Pitfalls

"Module not found" for Native SQLite

Problem: better-sqlite3 not available in serverless

Fix: Use LibSQL/Turso instead of file-based SQLite:

connection: {
  url: "libsql://your-db.turso.io",
  authToken: process.env.DB_TOKEN,
}

"JWT_SECRET required" Error

Problem: Auth fails in production

Fix: Set JWT_SECRET environment variable:

# Cloudflare
wrangler secret put JWT_SECRET

# Vercel
vercel env add JWT_SECRET

# Docker
docker run -e JWT_SECRET="your-secret" ...

Cold Start Timeouts (Lambda)

Problem: First request times out

Fix:

  • Use lighter database (Turso over RDS)
  • Reduce bundle size
  • Enable provisioned concurrency for critical functions

D1 Binding Not Found

Problem: env.DB is undefined

Fix: Check wrangler.toml D1 binding:

[[d1_databases]]
binding = "DB"  # Must match env.DB in code
database_name = "my-database"
database_id = "actual-id-from-wrangler-d1-create"

Media Uploads Fail in Serverless

Problem: Local storage doesn't work in serverless

Fix: Use cloud storage adapter:

config: {
  media: {
    adapter: {
      type: "s3",  // or "r2", "cloudinary"
      config: { /* credentials */ },
    },
  },
}

CORS Errors

Problem: Frontend can't access API

Fix: Configure CORS in your adapter:

// Most adapters handle this automatically
// For custom needs, check platform docs

Deployment Commands Reference

# Cloudflare Workers
wrangler deploy
wrangler tail  # View logs

# Vercel
vercel deploy --prod
vercel logs

# Docker
docker compose up -d
docker compose logs -f

# AWS Lambda
serverless deploy --stage prod
serverless logs -f api

DOs and DON'Ts

DO:

  • Set isProduction: true in production config
  • Use cloud storage (S3/R2/Cloudinary) for media
  • Set strong JWT_SECRET (min 32 chars)
  • Enable Guard for authorization
  • Test with production database before deploying
  • Use environment variables for all secrets

DON'T:

  • Use file-based SQLite in serverless
  • Hardcode secrets in code
  • Deploy without testing schema sync
  • Use local storage adapter in production
  • Skip JWT_SECRET configuration
  • Commit .env files with real secrets

Related Skills

  • bknd-database-provision - Set up production database
  • bknd-production-config - Production security settings
  • bknd-storage-config - Configure media storage
  • bknd-env-config - Environment variable setup
  • bknd-local-setup - Local development (pre-deploy testing)

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.25%
按下载量换算40

Claude

29.01%
按下载量换算33

Cursor

18.63%
按下载量换算21

Gemini CLI

8.5%
按下载量换算10

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills