1.5 KiB
1.5 KiB
Default to using Bun instead of Node.js.
- Use
bun <file>instead ofnode <file>orts-node <file> - Use
bun testinstead ofjestorvitest - Use
bun build <file.html|file.ts|file.css>instead ofwebpackoresbuild - Use
bun installinstead ofnpm installoryarn installorpnpm install - Use
bun run <script>instead ofnpm run <script>oryarn run <script>orpnpm run <script> - Bun automatically loads .env, so don't use dotenv.
APIs
Bun.serve()supports WebSockets, HTTPS, and routes. Don't useexpress.bun:sqlitefor SQLite. Don't usebetter-sqlite3.arangojsfor ArangoDB. ArangoDB has no built-in Bun client.Bun.sqlfor Postgres. Don't usepgorpostgres.js.WebSocketis built-in. Don't usews.- Prefer
Bun.fileovernode:fs's readFile/writeFile - Bun.$
lsinstead 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 = Objektplayer:{id}:weapon/:armor/:talisman-> value = Array mit item_idsitem:{id},enemy:{id},region:{id}-> value = Objektregion:{id}:items/:enemies,enemy:{id}:items-> value = Array mit idsweapon:{id},armor:{id},shield:{id},talisman:{id},item_effect:{id},item_type:{id}-> value = Objekt
Coding Style Preferences
- Write everything WITHOUT comments.