Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Bunファースト開発
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
NearMeの技術発表資料です
PRO
January 28, 2024
63
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Bunファースト開発
NearMeの技術発表資料です
PRO
January 28, 2024
More Decks by NearMeの技術発表資料です
See All by NearMeの技術発表資料です
Claude Code × git worktree で並列開発 (続き) -差分のサービスだけを併設する-
nearme_tech
PRO
1
50
Claude Code × git worktree で並列開発 — サブモジュール構成のリポジトリで成立させる —
nearme_tech
PRO
0
54
LLM + 強化学習
nearme_tech
PRO
0
31
PosthogのA/Bテスト機能の紹介
nearme_tech
PRO
1
44
AIフレンドリーなプロダクトに向けて
nearme_tech
PRO
2
65
初めてのLean言語
nearme_tech
PRO
0
100
Apache Airflow Workflow orchestration without turning cron into spaghetti
nearme_tech
PRO
2
37
実務で役立つ幾何学 ボロノイ図の基礎から グラフ・ネットワーク応用まで
nearme_tech
PRO
1
76
SQL/ID抽出タスクから考える 実践的なハルシネーション対策
nearme_tech
PRO
1
88
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.7k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.8k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.4k
The SEO Collaboration Effect
kristinabergwall1
1
550
Ruling the World: When Life Gets Gamed
codingconduct
0
320
Chasing Engaging Ingredients in Design
codingconduct
0
300
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
320
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
250
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
The untapped power of vector embeddings
frankvandijk
2
1.9k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.4k
Transcript
0 Bunファースト開発 2024-01-26 第76回NearMe技術勉強会 @yujiosaka
1 作ったもの 1
2 Cronyx https://github.com/yujiosaka/Cronyx
3 Cronyx • 分散型タスクスケジューラー • 主要なターゲットはNodeユーザー • NodeでもBunでもどちらでも動作する • 開発とテストはどちらもBunを使⽤
4 CronyxServer https://github.com/yujiosaka/CronyxServer
5 CronyxServer • CronyxのHTTPインターフェース • Bunのみをサポートする強気スタイル • DockerイメージとKubernetesマニフェストを公開 • Elysia(BunのWebフレームワーク)のプラグインを公開
6 なんでBun? • 検証に最適な⼩さな趣味プロジェクトだった • 開発とテストだけならNode+Jestとほぼ同じ書き⽅ができるし、すぐに撤退も可能 • Cronyxで使ってみて良かったので、CronyxServerでは全⾯採⽤することにした
7 なんでElysia? • 「Bun Web Framework」でググって⼀番上に出てきた(ちゃんと⽐較してない) • Expressは未だにPromise(Async∕Await)に対応してなくてなんかイヤ • とはいえNestJSは(好きだけど)⼩さなプロジェクトには⼤袈裟すぎる
8 ⼀般的なメリット • ビルドが早い(今回Bunでビルドはしなかった) • パッケージインストールが早い(そこまで体感はできなかった) • パフォーマンスが良い(ほぼI/Oのプロジェクトであまり関係なかった) • ホットリロードが早い(体感できたけど、まだ発展途上なことも多々あった)
9 Bunでのスクリプティング • クロスプラットフォーム(Windowsでも動く) • セキュア(デフォルトで⽂字列がエスケープされる)
10 Bunでのテスト
11 Elysiaでの開発 Typeboxによるスキーマバリデーション https://github.com/sinclairzx81/typebox
12 Bunを使ってみた感想 • ちょいちょい⼩さな不具合に悩まされたけど、致命的な問題はなかった • 開発やテスト時にTypeScriptのコンパイルが要らないのは想像以上に楽 • setSystemTimeが神機能でこれなしでのテストはできない体になった • 特にテストのホットリロードの反応が早いのが嬉しい
• 総合評価は凄く(・∀・)イイ! → これとか https://github.com/oven-sh/bun/issues/5602 → これとか https://github.com/oven-sh/bun/issues/1446 • → Denoと違ってnpmパッケージがちゃんと動く → RubyのTimecopみたいに、システム時間を⾃在に変更できる → でも新しいファイル追加に反応しない等、課題もまだ残ってる → npmパッケージ開発時に使う分には⼼からオススメできる
13 Elysiaを使ってみた感想 • ほぼPromise(Async∕Await)版Expressみたいな気持ちで使える • TypeBoxを使ったバリデーションが便利だけど癖が強い • 型推論に頼りすぎてて、⾃分で型を定義したい時すっごく困る → 動的に型推論が効くのは気持ちいい
→ Transformの機能が弱い。せめてzodだったら。。。 → こういう時どうしたらいい? ← 本当はここで Elysia<typeof cronyx<S, I>> とかやりたい
14 まだ痒いところ • バージョンを固定する⽅法がない • package.jsonでBunを指定できるようにして欲しい • .node-versionみたいな感じで .bun-version 欲しい
15 Thank you