This repo ships one Vibbit runtime supporting both:
Managedmode (school server with server-side API keys)BYOKmode (student/teacher brings their own key in the panel)
- Teacher runs or deploys the backend (
apps/backend/). - Teacher opens
/teacher, signs in (Google or local/dev login), and saves an OpenAI-compatible API base URL + key. - Teacher creates a classroom and shares the 10-letter code (shown as
ABCDE-FGHIJ, optionally via/join/CODE). - Students open Vibbit in MakeCode and enter the classroom code. The production package (
npm run package) is code-only againsthttps://vibbit.tk.sg; ordinarynpm run buildkeeps Managed + BYOK. - Vibbit connects to
/vibbit/connect, receives a short-lived session token, then calls/vibbit/generate. - Provider keys stay on the server (per classroom). Optional operator panel:
/admin?admin=<ADMINTOKEN>.
- Endpoint used by the extension:
POST {BACKEND}/vibbit/generate
- Session bootstrap endpoint:
POST {BACKEND}/vibbit/connect
- Teacher / admin endpoints:
GET {BACKEND}/(informational landing page)GET {BACKEND}/teacher(teacher login + mint classroom codes)GET {BACKEND}/adminGET {BACKEND}/admin/statusGET {BACKEND}/download/vibbit-extension.zipGET {BACKEND}/bookmarkletGET {BACKEND}/bookmarklet/runtime.js
- Teacher classrooms accept OpenAI, OpenRouter, OpenCode, Gemini, or a custom OpenAI-compatible base URL (LiteLLM / Claude-compatible proxies). Custom public hosts require
VIBBIT_CUSTOM_ENDPOINT_ALLOWLIST; localhost/private gateways need self-hosted mode plusVIBBIT_ALLOW_PRIVATE_ENDPOINTS=true. The URL must expose a/chat/completionsendpoint (or equivalent path normalised to/v1). - Request payload supports:
target,request,currentCode,pageErrors,conversionDialog- optional managed overrides:
provider,model
- OpenAI key ->
https://api.openai.com/v1/responsesfor GPT-5.6 Luna; older presets use/v1/chat/completions - Gemini key ->
https://generativelanguage.googleapis.com/v1beta/models/{model}:generateContent - OpenRouter key ->
https://openrouter.ai/api/v1/chat/completions - OpenCode key -> OpenCode Go or Zen (
https://opencode.ai/zen/go/v1orhttps://opencode.ai/zen/v1)
work.js: primary runtime source (extension + bookmarklet)dist/: built extension outputartifacts/vibbit-extension.zip: packaged extensionapps/backend/: managed backend (classroom auth + provider proxy)
- Prompts for
micro:bitprefer built-in icons (basic.showIcon(IconNames.*)) using canonical names frompxt-microbit/libs/core/icons.ts(for exampleIconNames.Duck). - Runtime validation checks known enum members from
pxt-microbitcore enums (for exampleButton,Gesture,TouchPin,DigitalPin). - Runtime validation checks argument counts for core block APIs (derived from
//% blockIdsignatures) before accepting model output. - Prompt guidance includes
blocks-teststyle example shapes to bias towards code that decompiles cleanly to Blocks.
npm run buildOutputs:
dist/content-script.jsdist/manifest.json
Build-time backend overrides:
VIBBIT_BACKEND="https://your-server.example" VIBBIT_APP_TOKEN="optional-token" npm run buildExtension packaging is built into the repo:
npm run packageOutput:
artifacts/vibbit-extension.zip
Website download route:
GET {BACKEND}/download/vibbit-extension.zip
By default, that backend route redirects to the latest GitHub release asset:
https://github.com/tinkertanker/vibbit/releases/latest/download/vibbit-extension.zip
To ship a new downloadable version on GitHub:
- Push a release tag (for example
v0.2.1). - GitHub Actions workflow
.github/workflows/release-extension.ymlbuilds and packages the extension. - The workflow publishes release assets:
vibbit-extension.zip(stable filename for latest download URL)vibbit-extension-<tag>.zip(versioned copy)- matching
.sha256checksum files
Optional backend override:
- Set
VIBBIT_EXTENSION_DOWNLOAD_URLto any custom hosted zip URL if you do not want to use GitHub release assets.
For users who cannot install the Chrome extension, build bookmarklet artefacts:
npm run build:bookmarkletDefault output includes both managed and BYOK bookmarklets (matching the extension):
artifacts/bookmarklet/vibbit-runtime.jsartifacts/bookmarklet/bookmarklet-managed.txtartifacts/bookmarklet/install-managed.htmlartifacts/bookmarklet/bookmarklet-byok.txtartifacts/bookmarklet/install-byok.html
To emit managed-only output:
VIBBIT_BOOKMARKLET_ENABLE_BYOK=false npm run build:bookmarkletSet the hosted runtime URL used inside the bookmarklet link:
VIBBIT_BOOKMARKLET_RUNTIME_URL="https://cdn.example.com/vibbit-runtime.js" npm run build:bookmarkletDeploy artifacts/bookmarklet/vibbit-runtime.js to that URL, then distribute the generated bookmarklet text or install HTML.
The managed backend can host bookmarklet assets directly, so you can avoid a separate static hosting step:
- Installer page:
GET {BACKEND}/bookmarklet - Runtime script:
GET {BACKEND}/bookmarklet/runtime.js
After deploying the backend, share {BACKEND}/bookmarklet with students who cannot install extensions.
For coordinated extension, bookmarklet, and backend/site releases, use:
docs/release.md
work.js (BYOK runtime) and apps/backend/src/runtime.mjs (managed runtime) share generated compat helpers from:
shared/makecode-compat-core.mjs
Sync/check commands:
npm run sync:compat-coreupdates the generated block inwork.jsnpm run check:compat-corefails if the generated block is stale
cp apps/backend/.env.example apps/backend/.env
npm run backend:startDefault local URL:
http://localhost:8787
On start, backend logs the classroom share line and admin path. Supply VIBBIT_ADMIN_TOKEN through the environment; the token is not printed.
If provider keys are not set in env, open /admin?admin=<ADMINTOKEN> and configure them in the Provider Setup form.
Supported hosted deployment target:
- Railway
Deploy button (placeholder until template is published):
See full backend setup and env docs here:
apps/backend/README.md
Recommended teacher flow:
- Open Railway New Project and deploy from GitHub.
- Set service root directory to
apps/backend. - Add required env vars from
apps/backend/.env.example. - Generate a public domain, mint a classroom code, and share the code (hosted extension students need only the code).
Cheapest hosted option:
- Use one Railway backend service only, attach a volume, and set
VIBBIT_STATE_FILE=/data/vibbit-state.json. - Set Railway hard usage limit to
$1.
Vibbit is not on the Chrome Web Store yet. Install it as an unpacked extension:
- Download the latest zip from
https://vibbit.tk.sg/download/vibbit-extension.zip, or - Build locally with
npm run buildand usedist/.
Then:
- If you downloaded the zip, unzip it first.
- Open
chrome://extensions. - Enable Developer mode.
- Click Load unpacked.
- Select the unzipped folder (or
dist/for local builds) containingmanifest.json. - For updates, rebuild/re-download and click Reload on the extension card.
- Build/package:
npm run package
- Confirm artefacts:
dist/content-script.jsdist/manifest.jsonartifacts/vibbit-extension.zip
- Managed checks after
npm run package(hosted/code-only):- enter classroom code only (server URL hidden; baked
https://vibbit.tk.sg) - generate and verify paste +
Revert - test error-aware flow (empty prompt + page errors)
- trigger conversion modal and verify retry +
Fix convert error
- enter classroom code only (server URL hidden; baked
- BYOK checks after
npm run build(neutral dual-mode):- mode toggle, provider + model + key
- generation, paste, and error-context fixing
- Reload extension and refresh MakeCode tabs after each build
npm run audit:smoke-> deterministic UI smoke + screenshotsnpm run audit:live-> optional managed/BYOK live verificationnpm run audit:install-> install Chromium
Audit output:
output/playwright/audits/
Invalid class code: confirm teacher shared the current code from backend logs/env.Request failed: Unauthorized: check class code/session, orAPP_TOKEN/SERVER_APP_TOKENif using legacy token mode.No code returned: try a clearer prompt or switch model.Monaco not found: open an actual MakeCode project first.CORS/network errors: checkVIBBIT_ALLOW_ORIGIN, deployment env vars, and provider API key configuration.
Kickstarted during work attachment by:
Raffles Institution Year 4 (2025).