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
Taiyu Yoshizawa
September 04, 2025
Technology
13
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
Transcript
39 slides
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つくってます!!! 画像最適化めっちゃ簡単なんでぜひ
More Decks by Taiyu Yoshizawa
See All by Taiyu Yoshizawa
MapLibre の CJK レンダリング / CJK Rendering in MapLibre
nekoya3
0
210
The Present and Future of CJK Rendering in MapLibre
nekoya3
0
16
Kartore: A Style Editor and Toolkit for MapLibre
nekoya3
0
23
Kartore: Maplibre のための Style Editor とその Toolkit
nekoya3
0
140
Flagship という素晴らしいもの / This awesome thing called Flagship
nekoya3
0
7
10分で完全に理解出来る Cloudflare Workers + HyperDrive / Cloudflare Workers + HyperDrive: You Might Understand It in Just 10 Minutes
nekoya3
0
33
Cloudflare Realtime と Workers でつくるサーバーレス WebRTC
nekoya3
1
2k
北海道新型コロナウイルスまとめサイトでのいろいろなこと
nekoya3
0
480
Other Decks in Technology
See All in Technology
セキュリティチームは どのコンテナイメージの脆弱性対応を優先すべきか 〜CISA新指針とSCCで作る脆弱性トリアージ〜
swdtkuy
0
340
認知の質も文化醸成も。数年取り組んで見えてきた技術広報のKPI設計 / Tech PR KPIs: Lessons on Awareness Quality and Culture After Several Years
bitkey
PRO
0
220
お風呂場をサーバルームにしよう
yusuke427
0
400
AI-Ready なデータ基盤ってなに? & 新卒未経験が、いま考えていること
imuta
0
1.1k
AWS Client VPNの設定でハマったポイントとその過程での気づき
amarelo_n24
1
440
AWS Blocksで AIエージェント作れるの知ってます?
kmiya84377
1
170
フロントエンドのテストカバレッジは 100%強制がいい
bengo4com
7
2.6k
SBOM 生成ツールで 2026 Minimum Elements はどこまで満たせるのか
gokken
0
160
社内アプリ基盤「Quartz」による、 非エンジニアとAIに本番デプロイを 任せても壊れないプラットフォームの設計
staka121
PRO
1
240
Go でトランザクション、どう書いてますか?
knwoop
2
620
Web Performance Is a Journey [PerfNow 2026]
tammyeverts
2
160
リリースしたで終わらない。 観測できるフロントエンド開発
yamakenji24
4
530
Featured
See All Featured
RailsConf 2023
tenderlove
30
1.6k
So, you think you're a good person
axbom
PRO
2
2.3k
Discover your Explorer Soul
emna__ayadi
2
1.3k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
320
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
1
250
Between Models and Reality
mayunak
4
610
Ruling the World: When Life Gets Gamed
codingconduct
0
450
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
570
The Pragmatic Product Professional
lauravandoore
37
7.5k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Build your cross-platform service in a week with App Engine
jlugia
234
19k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
7.1k