天然パーマです。

Cloudflare Developer Week 2024 まとめ!

今年もこの一週間がやってきて終わりました。Cloudflareを使って開発をする開発者大歓喜のDeveloper Weekです。 新製品、新機能の発表や、既存製品のアップデート、技術的解説などをブログで行うというものです。 4月1日(月)〜4月5日(金)に行われました。

すごい。数えてみたら21個のブログ記事がありました。各記事について雑な箇条書きをしてみます。

4/1 (月)

1. Welcome to Developer Week 2024

2. Making state easy with D1 GA, Hyperdrive, Queues and Workers Analytics Engine updates

3. Why Workers environment variables contain live objects

4. Building D1: a Global Database

4/2 (火)

5. Bringing Python to Workers using Pyodide and WebAssembly

つまりこのPythonコードが本当にWorkersで動きます!

from js import Response

async def on_fetch(request, env):
    # MY_KVというKVに値をput
    await env.MY_KV.put("bar", "baz")
    # 値をget
    bar = await env.MY_KV.get("bar")
    # Responseのボディに入れて返却
    return Response.new(bar)

6. Running fine-tuned models on Workers AI with LoRAs

7. Leveling up Workers AI: general availability and more new capabilities

4/3 (水)

8. How Picsart leverages Cloudflare’s Developer Platform to build globally performant services

9. Data Anywhere with Pipelines, Event Notifications, and Workflows

10. Improving Cloudflare Workers and D1 developer experience with Prisma ORM

11. R2 adds event notifications, support for migrations from Google Cloud Storage, and an infrequent access storage tier

4/4 (木)

12. Cloudflare Calls: millions of cascading trees all the way down

13. Announcing Pages support for monorepos, wrangler.toml, database integrations and more!

14. What’s new with Cloudflare Media: updates for Calls, Stream, and Images

  • https://blog.cloudflare.com/whats-next-for-cloudflare-media
  • Cloudflare Calls、Stream、Imagesのアップデートの紹介
  • Cloudflare Calls - オープンベータ
  • Cloudflare Stream - ビデオを再エンコードすることなくストリームからクリップをして共有できる「Live Clipping API」のオープンベータ
  • Cloudflare Images - 少しのコードだけであなたのアプリと統合できるアップロードウィジェット。人の顔の画像を拡大縮小してトリミングし、リサイズすることができる「Face Cropping」。どちらもクローズドベータ

15. New tools for production safety — Gradual deployments, Source maps, Rate Limiting, and new SDKs

  • https://blog.cloudflare.com/workers-production-safety
  • Cloudflare Workersの運用のための新しいツールの紹介
  • Gradual Deployments - いわゆるローリングデプロイメントがWorkersでも利用可能なった!オープンベータ
  • ソースマップスタックトレース - Tail Workersでのトレースがソースマップに対応。wrangler.tomlupload_source_maps = trueにする
  • Rate Limiting API - Workersから直接レートリミットが可能に。ratelimitというBindingsになる。オープンベータ
  • TypeScript、Python、Goの3つの言語でCloudflare API向けのSDKを提供
  • WebSocketハイバネーションのGA

Rate LimitingをHonoのミドルウェアで使うにはこのように書ける。

app.use(async (c, next) => {
  const { success } = await c.env.MY_RATE_LIMITER.limit({ key: c.req.path });
  if (!success) {
    return c.body(`429 Failure - rate limit exceeded for ${c.req.path}`, 429);
  }
  await next();
});

ちゃんと動いて感動〜。

4/5 (金)

16. Community Update: empowering startups building on Cloudflare and creating an inclusive community

17. We’ve added JavaScript-native RPC to Cloudflare Workers

このコード例だと右側がCalcっていうサービスで、左側がそれを利用する側。Calcは特化したの処理を行うWorkerになっている。 適切に設定してあげるとそれをenv.CALCといった他のBindingsと同じ方法でアクセスできる。 しかも、工夫次第でaddにTypeScriptの型が付く。

18. Blazing fast development with full-stack frameworks and Cloudflare

19. Cloudflare acquires PartyKit to allow developers to build real-time multi-user applications

  • https://blog.cloudflare.com/cloudflare-acquires-partykit
  • Cloudflareがリアルタイムマルチユーザーアプリを作るプラットフォーム「PartyKit」を買収!
  • 個人的に胸熱
  • PartyKitは元Cloudflareで以前のWranglerをバリバリ書いてたSunilが立ち上げてる会社。当時無名だったHonoのことを取り上げてくれてそれが励みになった。そんな彼らがCloudflareにジョインする!

20. Browser Rendering API GA, rolling out Cloudflare Snippets, SWR, and bringing Workers for Platforms to all users

21. Cloudflare acquires Baselime to expand serverless application observability capabilities