A Cloudflare Workers project powered by Bun, TypeScript, and Hono.
- Bun
- Cloudflare account with Wrangler CLI authentication (
bunx wrangler login)
bun installbun run devThis starts Wrangler in development mode and serves the Worker locally.
To run the Kick bot on a traditional VPS (or any Node-compatible host), use the bundled Hono Node server:
bun run startProvide the required environment variables (for example via a .env file or
your process manager). At minimum you will need DATABASE_URL,
KICK_CLIENT_ID, KICK_CLIENT_SECRET, and any MailChannels settings you rely
on. If you are using Prisma Accelerate, expose PRISMA_ACCELERATE_URL with your
Accelerate connection string so the cached reads remain active.
bun run typecheckRun the Vitest suite once:
bun run testRun in watch mode:
bun run test:watchInspect the HTML coverage report (thresholds are locked at 100%):
bun run coverageThe CI workflow publishes the HTML report and a Vitest results summary (at /tests.html) to GitHub Pages at https://jcodog.github.io/Cleo-Kick/ once it has run at least once, so the generated files stay out of the repository.
Cloudflare Workers deployment is still supported and handled automatically via
the GitHub ➜ Cloudflare Workers integration. Pushes to the default branch
trigger Cloudflare to build the Worker using Bun and publish it with the
settings in wrangler.json.
For self-hosted deployments, run bun install followed by bun run start
under your preferred process supervisor.
-
Cloudflare observability remains enabled in
wrangler.jsonso Workers deployments still surface traces and logs in the dashboard. -
Runtime failures are now persisted through Prisma’s
ErrorLogmodel in the primary Postgres database. Apply the latest schema with:bunx prisma migrate dev --name add_error_log_table
You can review entries locally with Prisma Studio:
bunx prisma studio --browser none
-
Tag persisted records (and outbound notifications) with a friendly name by setting
ERROR_LOG_PROCESS_NAMEin your environment. -
Forward structured error data to Logtail by creating a source at https://logtail.com, copying the source token, and setting
LOGTAIL_SOURCE_TOKENin your environment (or.env). The app will stream errors automatically whenever the token is present. -
Verify your MailChannels configuration without triggering real errors by calling the diagnostic route:
curl -X POST http://localhost:8787/debug/test-email \ -H "Content-Type: application/json" \ -d '{"message":"Test from Cleo Kick"}'
The route returns
{ "status": "sent" }once the email dispatch is queued.
- Set
DASHBOARD_URLinwrangler.json(or via Cloudflare dashboard) to tell the root route where to redirect users for chatbot management. - Provide
HOSTwhen running the Node adapter if you need to bind to a specific interface (defaults to0.0.0.0). - Point
WS_URLat the remote WebSocket relay HTTP endpoint (for example the/test-messageroute exposed by the dedicated overlay service).
GET /— redirects to the configured dashboard URL.POST /webhook— accepts Kick webhook events (expects JSON payloads).GET /health— lightweight readiness probe.POST /debug/test-email— sends a MailChannels test message to the configured developer inbox.POST /test-message— pushes a synthetic overlay chat payload through the configured relay endpoint for quick manual verification.
src/index.ts— Hono application entry point exported as the Worker.wrangler.json— Cloudflare Workers configuration consumed by the CI deployment (observability, routes, and legacy Worker settings).tsconfig.json— TypeScript compiler settings tailored for Workers.bunfig.toml— Bun configuration.