···11+---
22+description: Use Bun instead of Node.js, npm, pnpm, or vite.
33+globs: "*.ts, *.tsx, *.html, *.css, *.js, *.jsx, package.json"
44+alwaysApply: false
55+---
66+77+Default to using Bun instead of Node.js.
88+99+- Use `bun <file>` instead of `node <file>` or `ts-node <file>`
1010+- Use `bun test` instead of `jest` or `vitest`
1111+- Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild`
1212+- Use `bun install` instead of `npm install` or `yarn install` or `pnpm install`
1313+- Use `bun run <script>` instead of `npm run <script>` or `yarn run <script>` or `pnpm run <script>`
1414+- Bun automatically loads .env, so don't use dotenv.
1515+1616+## APIs
1717+1818+- `Bun.serve()` supports WebSockets, HTTPS, and routes. Don't use `express`.
1919+- `bun:sqlite` for SQLite. Don't use `better-sqlite3`.
2020+- `Bun.redis` for Redis. Don't use `ioredis`.
2121+- `Bun.sql` for Postgres. Don't use `pg` or `postgres.js`.
2222+- `WebSocket` is built-in. Don't use `ws`.
2323+- Prefer `Bun.file` over `node:fs`'s readFile/writeFile
2424+- Bun.$`ls` instead of execa.
2525+2626+## Testing
2727+2828+Use `bun test` to run tests.
2929+3030+```ts#index.test.ts
3131+import { test, expect } from "bun:test";
3232+3333+test("hello world", () => {
3434+ expect(1).toBe(1);
3535+});
3636+```
3737+3838+## Frontend
3939+4040+Use HTML imports with `Bun.serve()`. Don't use `vite`. HTML imports fully support React, CSS, Tailwind.
4141+4242+Server:
4343+4444+```ts#index.ts
4545+import index from "./index.html"
4646+4747+Bun.serve({
4848+ routes: {
4949+ "/": index,
5050+ "/api/users/:id": {
5151+ GET: (req) => {
5252+ return new Response(JSON.stringify({ id: req.params.id }));
5353+ },
5454+ },
5555+ },
5656+ // optional websocket support
5757+ websocket: {
5858+ open: (ws) => {
5959+ ws.send("Hello, world!");
6060+ },
6161+ message: (ws, message) => {
6262+ ws.send(message);
6363+ },
6464+ close: (ws) => {
6565+ // handle close
6666+ }
6767+ },
6868+ development: {
6969+ hmr: true,
7070+ console: true,
7171+ }
7272+})
7373+```
7474+7575+HTML files can import .tsx, .jsx or .js files directly and Bun's bundler will transpile & bundle automatically. `<link>` tags can point to stylesheets and Bun's CSS bundler will bundle.
7676+7777+```html#index.html
7878+<html>
7979+ <body>
8080+ <h1>Hello, world!</h1>
8181+ <script type="module" src="./frontend.tsx"></script>
8282+ </body>
8383+</html>
8484+```
8585+8686+With the following `frontend.tsx`:
8787+8888+```tsx#frontend.tsx
8989+import React from "react";
9090+9191+// import .css files directly and it works
9292+import './index.css';
9393+9494+import { createRoot } from "react-dom/client";
9595+9696+const root = createRoot(document.body);
9797+9898+export default function Frontend() {
9999+ return <h1>Hello, world!</h1>;
100100+}
101101+102102+root.render(<Frontend />);
103103+```
104104+105105+Then, run index.ts
106106+107107+```sh
108108+bun --hot ./index.ts
109109+```
110110+111111+For more information, read the Bun API docs in `node_modules/bun-types/docs/**.md`.
···11+# None Of These Words Are In The Bible
22+33+A Bluesky bot that analyzes posts and reports what percentage of words appear in the Bible.
44+55+## Setup
66+77+1. Install dependencies:
88+```bash
99+bun install
1010+```
1111+1212+2. Create a `.env` file with your Bluesky credentials:
1313+```bash
1414+cp .env.example .env
1515+# Edit .env with your credentials
1616+```
1717+1818+3. Build the Bible corpus:
1919+```bash
2020+bun run build-corpus
2121+```
2222+2323+4. Run the bot:
2424+```bash
2525+bun start
2626+```
2727+2828+## How it works
2929+3030+The bot supports two modes based on your mention text:
3131+3232+### Mode 1: "how many"
3333+When you reply to any post with "@bot how many", it analyzes that post.
3434+3535+Example:
3636+```
3737+Post: "there is no such thing as a coincidence"
3838+└─ You: "@noneofthesewords how many"
3939+ └─ Bot: "actually, 71% of these words are in the Bible"
4040+```
4141+4242+### Mode 2: "really?"
4343+When you reply to the bot's analysis with "@bot really?", it re-analyzes the original post (useful for double-checking).
4444+4545+Example:
4646+```
4747+Post: "there is no such thing as a coincidence"
4848+└─ You: "@noneofthesewords how many"
4949+ └─ Bot: "actually, 71% of these words are in the Bible"
5050+ └─ You: "@noneofthesewords really?"
5151+ └─ Bot: "actually, 71% of these words are in the Bible" (re-analyzes the original post)
5252+```
5353+5454+The bot:
5555+1. Checks each word against the World English Bible corpus
5656+2. Replies with the percentage of words found in the Bible
5757+3. Handles contractions and common word variations properly
5858+5959+## Development
6060+6161+Run in watch mode:
6262+```bash
6363+bun dev
6464+```
6565+6666+## Deployment
6767+6868+The bot can be deployed to:
6969+- VPS with PM2 or systemd
7070+- Docker container
7171+- Deno Deploy (with minor modifications)
7272+- Cloud functions (AWS Lambda, Vercel, etc.)
7373+7474+Environment variables needed:
7575+- `BLUESKY_IDENTIFIER`: Your Bluesky handle
7676+- `BLUESKY_PASSWORD`: Your app password (not main password)