Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问许可证需确认审计异常

bknd-local-setupbknd 本地设置

Agent Skill

bknd-local-setup 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

315

周安装

13

GitHub Stars

3

下载量

103
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/cameronapak/bknd-skills --skill bknd-local-setup

简介

用于从零搭建 Bknd 本地开发环境,支持新项目初始化。

  • 可配置数据库连接、定义 schema 和启动开发服务器。
  • 推荐使用 CLI 方式进行初始设置,UI 仅用于数据浏览测试。
  • 需 Node.js 18+ 或 Bun 环境及包管理器支持。
  • bknd-local-setup 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Local Development Setup

Set up a Bknd local development environment from scratch.

Prerequisites

  • Node.js 18+ or Bun 1.0+
  • npm, yarn, pnpm, or bun package manager
  • Terminal/command line access

When to Use UI Mode

  • Browsing admin panel at http://localhost:3000/admin
  • Exploring entities and data visually
  • Testing auth flows manually

Note: Initial project setup requires CLI/code.

When to Use Code Mode

  • Creating new Bknd project
  • Configuring database connection
  • Defining schema
  • Running development server
  • All initial setup tasks

Code Approach

Step 1: Create New Project (Interactive)

Quickest way to start:

# Interactive project creation
npx bknd create my-app

# Follow prompts:
# - Project name
# - Database type (SQLite recommended for local dev)
# - Include example schema?

This creates project structure with:

  • bknd.config.ts - Main configuration
  • package.json - Dependencies
  • .env - Environment variables template

Step 2: Install Dependencies

cd my-app

# npm
npm install

# bun (faster)
bun install

# pnpm
pnpm install

Step 3: Run Development Server

# Default (port 3000, file-based SQLite)
npx bknd run

# In-memory database (fastest for prototyping, data lost on restart)
npx bknd run --memory

# Custom port
npx bknd run --port 8080

# Don't auto-open browser
npx bknd run --no-open

# Specify runtime explicitly
npx bknd run --server bun
npx bknd run --server node

Server starts at http://localhost:3000 with:

  • API: /api/data/*, /api/auth/*, /api/media/*
  • Admin UI: /admin

Alternative: Manual Setup

Step 1: Initialize Package

mkdir my-bknd-app && cd my-bknd-app
npm init -y
npm install bknd

Step 2: Create Config File

Create bknd.config.ts:

import type { CliBkndConfig } from "bknd";
import { em, entity, text, boolean } from "bknd";

// Define schema
const schema = em({
  todos: entity("todos", {
    title: text().required(),
    done: boolean(),
  }),
});

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

export default {
  app: (env) => ({
    connection: {
      url: env.DB_URL ?? "file:data.db",
    },
    schema,
  }),
} satisfies CliBkndConfig;

Step 3: Create Entry File (Optional)

For programmatic control, create index.ts:

import { serve } from "bknd/adapter/bun";
import { em, entity, text, boolean } from "bknd";

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

serve({
  connection: { url: "file:data.db" },
  config: {
    data: schema.toJSON(),
  },
});

Run with:

# Bun
bun run index.ts

# Node (requires tsx or ts-node)
npx tsx index.ts

Runtime Adapters

Bun (Recommended for Speed)

import { serve } from "bknd/adapter/bun";

serve({
  connection: { url: "file:data.db" },
});

Node.js

import { serve } from "bknd/adapter/node";

serve({
  connection: { url: "file:data.db" },
});

Framework Integrations

Next.js:

// app/api/bknd/[[...bknd]]/route.ts
import { createHandler } from "bknd/adapter/nextjs";
export const { GET, POST, PUT, DELETE, PATCH } = createHandler(config);

Astro:

// src/pages/api/[...bknd].ts
import { createHandler } from "bknd/adapter/astro";
export const ALL = createHandler(config);

React Router (Remix):

// app/routes/api.$.tsx
import { createHandler } from "bknd/adapter/react-router";
export const loader = createHandler(config);
export const action = createHandler(config);

CLI Options Reference

OptionDescriptionDefault
-p, --port <port>Server port3000
-m, --memoryUse in-memory database-
--server <server>Runtime: node or bunAuto-detected
--no-openDon't auto-open browserOpens by default
-c, --config <path>Config file pathAuto-detected
--db-url <url>Database URL override-

Config File Detection

Bknd auto-detects config files (in order):

  • bknd.config.ts
  • bknd.config.js
  • bknd.config.mjs
  • bknd.config.cjs
  • bknd.config.json

Project Structure

Recommended Layout

my-bknd-app/
├── bknd.config.ts      # Main configuration
├── bknd-types.d.ts     # Generated types (run: npx bknd types)
├── .env                # Environment variables
├── .dev.vars           # Dev-specific overrides (optional)
├── data.db             # SQLite file (auto-created)
├── uploads/            # Local media storage (if using local adapter)
└── package.json

Framework Integration Layout

my-nextjs-app/
├── app/
│   ├── api/
│   │   └── bknd/
│   │       └── [[...bknd]]/
│   │           └── route.ts
│   └── admin/
│       └── page.tsx
├── bknd.config.ts
├── bknd-types.d.ts
└── .env.local

Generate TypeScript Types

After defining schema, generate types for IDE support:

# Generate to bknd-types.d.ts (default)
npx bknd types

# Custom output
npx bknd types -o types/bknd.d.ts

# Print to console (debug)
npx bknd types --dump

Database Options for Local Dev

DatabaseURL FormatBest For
In-memory SQLite:memory: or --memory flagQuick prototyping
File SQLitefile:data.dbPersistent local dev
LibSQL (Turso)libsql://your-db.turso.ioRemote dev database

In-Memory (Ephemeral)

npx bknd run --memory

Data resets on server restart. Best for rapid prototyping.

File-Based SQLite (Persistent)

npx bknd run
# or explicitly:
npx bknd run --db-url "file:data.db"

Data persists in data.db file.

Reset Database

# Delete SQLite file for fresh start
rm data.db

# Then restart server
npx bknd run

Hot Reload

Schema changes require server restart. Use watch mode:

# Bun
bun --watch index.ts

# Node with nodemon
npx nodemon --exec "npx bknd run"

Debug Commands

# Show internal paths
npx bknd debug paths

# Show all registered routes
npx bknd debug routes

# CLI help
npx bknd --help
npx bknd run --help

Verification

After setup, verify everything works:

1. Server running:

curl http://localhost:3000/api/data
# Should return entity list

2. Admin panel accessible: Open http://localhost:3000/admin in browser

3. Types generated:

npx bknd types
# Check bknd-types.d.ts created

Common Pitfalls

Config File Not Found

Problem: Config file could not be resolved error

Fix: Ensure config file exists with correct extension:

# Check file exists
ls bknd.config.*

# Or specify explicitly
npx bknd run -c ./bknd.config.ts

Port Already in Use

Problem: EADDRINUSE: address already in use

Fix: Use different port or kill existing process:

# Use different port
npx bknd run --port 3001

# Or find and kill process
lsof -i :3000
kill -9 <PID>

Database Permission Error

Problem: SQLITE_CANTOPEN: unable to open database file

Fix: Ensure write permissions in directory:

# Check permissions
ls -la

# Fix permissions
chmod 755 .

TypeScript Errors with em()

Problem: Type errors when using em() return value

Fix: Remember em() returns schema definition, not EntityManager:

// WRONG - em() is schema builder only
const em = em({ ... });
em.repo("posts").find();  // ERROR

// CORRECT - use api.data for queries
const api = new Api({ url: "http://localhost:3000" });
api.data.readMany("posts");

Bun Not Found

Problem: bun: command not found

Fix: Install Bun or use Node:

# Install Bun
curl -fsSL https://bun.sh/install | bash

# Or use Node runtime
npx bknd run --server node

Windows Path Issues

Problem: File paths not resolving on Windows

Fix: Use forward slashes:

// WRONG
connection: { url: "file:C:\\data\\my.db" }

// CORRECT
connection: { url: "file:C:/data/my.db" }
// or relative
connection: { url: "file:data.db" }

DOs and DON'Ts

DO:

  • Use --memory flag for quick experiments
  • Use file:data.db for persistent development
  • Generate types after schema changes
  • Commit bknd.config.ts to version control
  • Use .env for environment-specific values

DON'T:

  • Commit data.db to version control (add to .gitignore)
  • Commit .env with secrets (use .env.example template)
  • Use in-memory database when you need data persistence
  • Forget to restart server after schema changes
  • Try to use em() result as EntityManager

Related Skills

  • bknd-env-config - Configure environment variables
  • bknd-create-entity - Create entities in your schema
  • bknd-client-setup - Set up SDK in frontend
  • bknd-debugging - Debug common issues
  • bknd-deploy-hosting - Deploy to production

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

36.03%
按下载量换算37

Claude

31.01%
按下载量换算32

Cursor

20.57%
按下载量换算21

Gemini CLI

10.24%
按下载量换算11

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

通过

权限和风险

敏感数据

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

安装前确认

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

来源信息

继续浏览同类 Skills