2026-07-07 16:59:54 +02:00

1.5 KiB

Default to using Bun instead of Node.js.

  • Use bun <file> instead of node <file> or ts-node <file>
  • Use bun test instead of jest or vitest
  • Use bun build <file.html|file.ts|file.css> instead of webpack or esbuild
  • Use bun install instead of npm install or yarn install or pnpm install
  • Use bun run <script> instead of npm run <script> or yarn run <script> or pnpm run <script>
  • Bun automatically loads .env, so don't use dotenv.

APIs

  • Bun.serve() supports WebSockets, HTTPS, and routes. Don't use express.
  • bun:sqlite for SQLite. Don't use better-sqlite3.
  • arangojs for ArangoDB. ArangoDB has no built-in Bun client.
  • Bun.sql for Postgres. Don't use pg or postgres.js.
  • WebSocket is built-in. Don't use ws.
  • Prefer Bun.file over node:fs's readFile/writeFile
  • Bun.$ls instead of execa.

Datenmodell (ArangoDB als Key-Value)

ArangoDB ist multimodal, wir nutzen es hier bewusst als reinen Key-Value-Store, damit der Vergleich direkt zu Redis passt. Alles liegt in einer Collection kv. Jedes Dokument hat den Redis-Key als _key und den Wert im Feld value.

  • player:{id} -> value = Objekt
  • player:{id}:weapon / :armor / :talisman -> value = Array mit item_ids
  • item:{id}, enemy:{id}, region:{id} -> value = Objekt
  • region:{id}:items / :enemies, enemy:{id}:items -> value = Array mit ids
  • weapon:{id}, armor:{id}, shield:{id}, talisman:{id}, item_effect:{id}, item_type:{id} -> value = Objekt

Coding Style Preferences

  • Write everything WITHOUT comments.