新しい CDN Edge Worker, Deno Deploy について

3/29 に突如リリースされた Deno Deploy についてまとめる

Deno Deploy とは

Deno Deloy は Node オリジナル作者であり、 Deno 作者の Ryan Dahl が作った会社のサービス

Announcing the Deno Company | Deno Blog

面白いのは、 Vercel の Guillermo Rauch が出資してる

In order to vigorously pursue these ideas, we have raised 4.9 million dollars of seed capital. Our investors are Dan Scholnick from Four Rivers Ventures, Guillermo from Rauch Capital, Lee Jacobs from Long Journey Ventures, the Mozilla Corporation, Shasta Ventures, and our long-time collaborator Ben Noordhuis.


めちゃくちゃ簡単だが、スクリーンショットを取り忘れたので概要だけ。 から GitHub でログイン。

New Project を選択して、GitHub リポジトリを選択

連携用に GitHub で雑なリポジトリを作って、Hello World をコピペした


addEventListener("fetch", (event) => {
    new Response("Hello world!", {
      status: 200,
      headers: {
        server: "denosr",
        "content-type": "text/plain",





Deno Deploy | Deno Deploy Docs

Builds on the Web: use fetch, WebSocket, or URL just like in the browser
Built-in support for TypeScript and JSX: type safe code, and intuitive server side rendering without a build step
Web compatible ES modules: import dependencies just like in a browser, without the need for explicit installation
Direct GitHub integration: push to a branch, review a deployed preview, and merge to release to production
Extremely fast: deploy in less than a second, serve globally close to users
Deploy from URL: deploy code with nothing more than a URL
API compatible with Cloudflare Workers®: benefit from a large existing ecosystem

Deno がデプロイできる Edge Worker 。 Cloduflare Workers と API 互換といってるが、 Cloudflare Workers は Service Worker の模倣なので、要は Service Worker Style


本当にCDN Edge か疑ってたので、とりあえず ping 投げてみた

$ ping                                                                       725ms 
PING ( 56 data bytes
64 bytes from icmp_seq=0 ttl=116 time=5.325 ms
64 bytes from icmp_seq=1 ttl=116 time=11.702 ms
64 bytes from icmp_seq=2 ttl=116 time=5.929 ms
64 bytes from icmp_seq=3 ttl=116 time=6.211 ms
64 bytes from icmp_seq=4 ttl=116 time=6.074 ms
64 bytes from icmp_seq=5 ttl=116 time=12.270 ms
--- ping statistics ---
6 packets transmitted, 6 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 5.325/7.918/12.270/2.894 ms

だいたい 5ms で速い。これは tokyo リージョンがありそう。


# install
$ deno install --allow-read --allow-write --allow-env --allow-net --allow-run --no-check -f

# run
$ deployctl run