Deploying the Terminal BBS: Cloudflare Workers, D1 Database, and Giscus Integration

Modern static blogs often struggle with comment systems. Commercial platforms like Disqus inject tracking scripts, cross-site telemetry, and intrusive advertisements into what should be a clean, distraction-free reading experience.

BashIt solves this by providing a unified comment architecture with two lightweight, privacy-focused options:

  1. Terminal BBS: A custom, self-hosted serverless bulletin board system running on Cloudflare Workers with Cloudflare D1 (SQLite).
  2. Giscus: A GitHub Discussions-backed comment engine with full Catppuccin Mocha dark theme styling.

1. Architecture of the Terminal BBS

Core Architectural Specifications:

  • Zero Third-Party Trackers: No Google Analytics, no Facebook Pixels, no ad exchanges.
  • Edge Performance: Sub-50ms worldwide response times via Cloudflare’s global edge network.
  • Serverless SQLite: Backed by Cloudflare D1, staying entirely within Cloudflare’s generous free tier.
  • Spam Defense: Zero-friction honeypot fields (website_hp) that trap automated bots without requiring user-hostile CAPTCHAs.
  • Offline / Local Mock Mode: Local browser localStorage emulation for rapid theme testing without deploying backend infrastructure.

Microservice Interaction Flow

󰈙 Terminal BBS Data Flow

sequenceDiagram
    autonumber
    actor Reader as Reader / Browser
    participant Hugo as BashIt Single Post
    participant Worker as Cloudflare Worker (BBS API)
    participant D1 as Cloudflare D1 (SQLite)

    Reader->>Hugo: Loads blog post with BBS container
    Hugo->>Worker: GET /api/comments?post={slug}
    Worker->>D1: SELECT * FROM comments WHERE post_slug = ?
    D1-->>Worker: Return JSON array
    Worker-->>Hugo: 200 OK (comment payloads)
    Hugo-->>Reader: Render terminal comment cards

    Reader->>Hugo: Submits message via terminal form
    Hugo->>Worker: POST /api/comments (payload + honeypot)
    Worker->>Worker: Verify honeypot & sanitize inputs
    Worker->>D1: INSERT INTO comments (...) VALUES (...)
    D1-->>Worker: Commit OK
    Worker-->>Hugo: 201 Created
    Hugo-->>Reader: Append live comment to BBS thread

  

2. Setting Up Cloudflare Workers + D1

The backend repository is standalone in the companion bashit-comments repository.

Step 1: Create the D1 Database

npx wrangler d1 create bashit-comments-db

Update your wrangler.toml with the generated database ID:

name = "bashit-comments"
main = "src/index.ts"
compatibility_date = "2024-09-01"

[[d1_databases]]
binding = "DB"
database_name = "bashit-comments-db"
database_id = "<YOUR_DATABASE_ID>"

Step 2: Apply the SQL Schema

Run the database migration:

npx wrangler d1 execute bashit-comments-db --file=./schema.sql

Step 3: Deploy to Cloudflare Edge

npx wrangler deploy

3. Configuring hugo.toml

Configure which provider you wish to activate in your site’s hugo.toml:

Option A: Cloudflare Workers BBS (Self-Hosted)

[params.comment]
  enable = true
  provider = "cloudflare"

  [params.comment.cloudflare]
    api = "https://bashit-comments.<your-subdomain>.workers.dev"
    mockMode = false  # Set to true for local testing with localStorage

Option B: Giscus (GitHub Discussions)

[params.comment]
  enable = true
  provider = "giscus"

  [params.comment.giscus]
    repo = "your-username/your-repo"
    repoId = "R_kgD..."
    category = "Announcements"
    categoryId = "DIC_kwD..."
    mapping = "pathname"
    theme = "catppuccin_mocha"
    lazy = false

Both engines automatically apply WebTUI terminal borders, Catppuccin typography, and responsive layouts.

Bashit Comments Cloudflare D1 Giscus Architecture
󰭹 TERMINAL BBS // COMMENTS [ thread: terminal-bbs-comments ]
Fetching terminal bulletin messages...
󰅫 POST NEW MESSAGE
Copyright 2026 © BashIt