Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
WorkersでCMSを作ってみないか / Wanna build a CMS with W...
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Taiyu Yoshizawa
September 04, 2025
Technology
12
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
WorkersでCMSを作ってみないか / Wanna build a CMS with Workers?
Cloudflare Workers Tech Talks in Hokkaido #1 での発表資料
Taiyu Yoshizawa
September 04, 2025
More Decks by Taiyu Yoshizawa
See All by Taiyu Yoshizawa
The Present and Future of CJK Rendering in MapLibre
nekoya3
0
12
Kartore: A Style Editor and Toolkit for MapLibre
nekoya3
0
18
Kartore: Maplibre のための Style Editor とその Toolkit
nekoya3
0
140
Flagship という素晴らしいもの / This awesome thing called Flagship
nekoya3
0
6
10分で完全に理解出来る Cloudflare Workers + HyperDrive / Cloudflare Workers + HyperDrive: You Might Understand It in Just 10 Minutes
nekoya3
0
25
Cloudflare Realtime と Workers でつくるサーバーレス WebRTC
nekoya3
1
1.9k
北海道新型コロナウイルスまとめサイトでのいろいろなこと
nekoya3
0
470
Other Decks in Technology
See All in Technology
分析の民主化を支えるメタデータ整備の実践
kakehashi
PRO
4
1.4k
⾮構造化データを価値に変える AI エージェント基盤とその組織
ivry_presentationmaterials
0
200
DWH の限界突破! AI エージェント向け爆速リアルタイムデータ基盤 ClickHouse
jozono
1
490
USB PDを使ってスマホを労わりたい
raspython3
0
180
JAWSUG TOHOKU 青森支部 「LoGoチャット」のAWS移行で 乗り越えたこと
taketakekaho
0
340
Webの常識が通じないHTMLメールのダークモード
teamlab
PRO
0
130
DBについての基礎説明(MySQL編) - コロプラ 2026年度 新卒研修
colopl
0
110
ストレスなくAIと付き合いたい!こんなときどうしてる?
namiki64
3
600
ソフトウェア ファクトリー - 再現性のあるソフトウェアの工場づくり / Software factory
iktakahiro
6
5k
パッチ更新でterraform initが落ちた日
grimoh
1
140
Rust で関数型ドメインモデリング
takonda
0
160
宣言型部分更新は何を解決しどこへ向かうのか
shuta13
1
460
Featured
See All Featured
A Tale of Four Properties
chriscoyier
163
24k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
460
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Building a Scalable Design System with Sketch
lauravandoore
464
34k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
630
Marketing to machines
jonoalderson
1
5.9k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.6k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.6k
Agile that works and the tools we love
rasmusluckow
331
22k
Paper Plane
katiecoart
PRO
5
54k
The browser strikes back
jonoalderson
0
1.8k
Technical Leadership for Architectural Decision Making
baasie
3
600
Transcript
WorkersでCMSを作ってみないか ɴᴇᴋᴏʏᴀsᴀɴ
Who are you? ɴᴇᴋᴏʏᴀsᴀɴ Software Engineer @MIERUNE Inc. Co-founder &
Software Engineer @ ReMotive GitHub: @NEKOYASAN Web: nekoyasan.me ←最近更新忘れて、メッチャ焦りました
What is ReMotive? エンタメ系の受託やら、Web制作やら、コンサルやらをして るちっさい2人会社 Workers使っていろいろやってたり、WebRTC x Live2D とか、Streaming Platformを作ってたり
おことわり まだ全然開発途中・サービスインの目処もまだしばらく先です 動くものを見せたかったんですが壊したので見せれません...ごめ んなさい.... 若干初心者向け(かも)
Motivation
None
None
Motivation Newtがサービス終了しちゃう microCMSはそれはそれで若干のつらみがある 金額的なところ 課金対象的なところ 仕様上のところ(画像・iframeまわりとか) Strapiとかを立てるのもそれはそれで辛みが... https://github.com/cloudflare/workerd/pull/4591 もしかしたらなんとかなったのかも...?
Motivation Newtがサービス終了しちゃう microCMSはそれはそれで若干のつらみがある 金額的なところ 課金対象的なところ 仕様上のところ(画像・iframeまわりとか) Strapiとかを立てるのもそれはそれで辛みが... https://github.com/cloudflare/workerd/pull/4591 もしかしたらなんとかなったのかも...? やっぱ自分で作るしかなくない?
Features
必ず欲しい セルフホストできる でもサーバーは持ちたくない... 安価に使える リッチエディタがあるか、Markdownで書ける モデルが自分で設定できる APIでアクセスできたり、画像上げれたり ログインとかメンバー管理とか
あったらいいな 画像最適化 予約投稿 Webhook 補助的なAI アクセス数解析
None
None
Cloudflare Developer platform AI Gateway Analytics Engine Assets Browser Rendering
D1 Durable Objects Hyperdrive Images KV Queues R2 Service Bindings Vectorize Workers for Platforms Workers AI Cache API
Cloudflare Developer platform AI Gateway Analytics Engine Assets Browser Rendering
D1 Durable Objects Hyperdrive Images KV Queues R2 Service Bindings Vectorize Workers for Platforms Workers AI Workflows こんだけあれば Workersでなんとかなるんじゃね
何が嬉しい? インフラを深く考える必要がない それなりに早い 色々周辺ツールが多い 帯域がタダ!!!!!! Cache操作系がやりやすい
Cloudflare Developer platform AI Gateway Analytics Engine Assets Browser Rendering
D1 Durable Objects Hyperdrive Images KV Queues R2 Service Bindings Vectorize Workers for Platforms Workers AI Cache API
Cloudflare Developer platform AI Gateway Analytics Engine Assets Browser Rendering
D1 Durable Objects Hyperdrive Images KV Queues R2 Service Bindings Vectorize Workers for Platforms Workers AI Cache API
構成図
Images Image R2 Master Data Cache D1 Worker Cache Durable
Object KV
Images Image R2 Master Data Cache D1 Worker Cache Durable
Object KV
R2 S3互換のオブジェクトストレージ 今回は画像・動画の保存用 Image 画像の変換とか軽量化ができるやつ 今回は画像最適化用
1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 app.get("/*", async (c) => { const object = await c.env.TEST_BUCKET.get(key); if (object === null || !("body" in object)) { return c.text("Object Not Found", 404); } const format = c.req.query("format") || "image/avif"; const width = c.req.query("w") ? Number(c.req.query("w")) : undefined; const response = ( await c.env.IMAGES.input(object.body) .transform({ width: width, }) .output({ format: format as any }) ).response(); return response; })
めっちゃ簡単に画像最適化ができる
Images Image R2 Master Data Cache D1 Worker Cache Durable
Object KV
D1 サーバーレスのSQLデータベース SQLiteベースなので同じクエリが使える KV グローバルに一貫性のあるKey-Valueストア 高速アクセス・低レイテンシが魅力
なぜ使い分けるか? D1 は filter / sortに強いが若干遅い (KV比) KV は 早いが
filter / sort に弱い なので 初回取得時はD1から取得し、条件等と共にTTLをつけてKV に保管する 2回目以降はKVから取得する 書き換えが発生した場合はKVの 中身をclearする 管理画面からはD1をみれるAPIを使う
Images Image R2 Master Data Cache D1 Worker Cache Durable
Object KV
Durable Object 強整合性のあるデータストア WebSocketのコネクション持てたりするおもろいやつ SQLite in Durable Objectとかもある D1 も
Durable Object 上で動いてる(らしい) Alermっていうおもろい産物がある
1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 import { DurableObject } from "cloudflare:workers"; export class AlarmExample extends DurableObject { constructor(ctx, env) { this.ctx = ctx; this.storage = ctx.storage; } async fetch(request) { const { seconds } = JSON.parse(request.body) let currentAlarm = await this.storage.getAlarm(); if (currentAlarm == null) { this.storage.setAlarm(Date.now() + 10 * SECONDS); } } async alarm() { // Alerm } }
めっちゃ簡単に予約投稿ができる
つらみ
つらみ D1にTransactionが存在しない KVのデータ変更タイミングでのリセット時にレスポンスが遅 くなる (D1に行くため) マルチテナントどうする問題
つらみ D1にTransactionが存在しない KVのデータ変更タイミングでのリセット時にレスポンスが遅 くなる (D1に行くため) マルチテナントどうする問題 → 何か良い案お持ちの方いたら懇親会とかで...
おまけ
Workers Analytics Engine テレメトリデータをStore / Getすることができるツール Cloudflareの内部で使われてる分析機能とおんなじ 1行につきindexとしての1つの値と、blob(string)が20個、 doubleが20個保管できるテーブルが用意されているイメージ Usage-based
Billingや不正利用検知に使える
1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 export default { async fetch(request, env, ctx) { env.ANALYTICS.writeDataPoint({ 'blobs': [ request.headers["CF-Connection-IP"] ], 'doubles': [ 1, 2, 4 ], 'indexes': [ userId, ] }); return new Response("Stored!"); }, };
まとめ 色んなサービスあります CMSつくってます!!! 画像最適化めっちゃ簡単なんでぜひ