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
Next.js で Ruby をプログラミング&実行できるアプリを作る
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
uutan1108
January 18, 2024
Programming
2k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Next.js で Ruby をプログラミング&実行できるアプリを作る
エンジニアの自由研究発表会vol.9
https://tech-street.connpass.com/event/305362/
uutan1108
January 18, 2024
More Decks by uutan1108
See All by uutan1108
Designing a Cross-Disciplinary Engineering Community Through Anime
ohmori_yusuke
3
80
コミュニティ・勉強会を作るのは目的じゃない
ohmori_yusuke
1
380
映画のエンドロール風の動画を自動生成するツールを作った
ohmori_yusuke
2
83
アウトプットは“成果物”じゃなく“副産物”だった話
ohmori_yusuke
1
120
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
870
仕様がそのままテストになる!Javaで始める振る舞い駆動開発
ohmori_yusuke
8
6.1k
勉強会から始まった僕のDevRel~新卒エンジニアがつないだ2年間の軌跡~
ohmori_yusuke
2
520
WebエンジニアがSwiftをブラウザで動かすプレイグラウンドを作ってみた
ohmori_yusuke
0
370
アニメがエンジニアをつなぐ!「エンジニアニメ」勉強会が巻き起こすCo-Creationの波
ohmori_yusuke
0
340
Other Decks in Programming
See All in Programming
Oxlintはいいぞ(続)
yug1224
1
280
ドリフトを絶対に許さない(?)CDK運用 / CDK Ops with Zero Tolerance for Drifts (?)
akihisaikeda
1
220
170k Jobs a Day on GKE: Scaling Mercari's CI Platform - and What's Next for AI-Native Development
junyaokabe
0
120
バグを直したら useEffect が消えた
colorful12
3
660
夏だ!祭りだ!祭りとはドメインモデリングでは?
ryugen04
0
340
Detecting Compromised CI with eBPF and Cilium Tetragon
lizrice
0
220
KotlinConf Extended South Korea 2026 Keynote
l2hyunwoo
0
110
これって Effect でできたのでは? / TSKaigi Mashup Kansai #2
susisu
0
250
Claude CodeとAgentCore Gatewayを繋ぐ際の認証認可 / Authentication and authorization when connecting Claude Code with AgentCore Gateway
har1101
2
340
Jindong: Introducing Declarative Haptics in Compose Multiplatform
l2hyunwoo
0
120
楽しそうなつよつよエンジニアと目が死んでる僕/A brilliant engineer having a blast, and dead-eyed me.
3l4l5
2
210
Cloudflare is Agents
chimame
0
170
Featured
See All Featured
Visualization
eitanlees
152
17k
Google's AI Overviews - The New Search
badams
0
1.1k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
400
We Have a Design System, Now What?
morganepeng
55
8.3k
We Are The Robots
honzajavorek
0
300
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
660
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
210
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
790
GitHub's CSS Performance
jonrohan
1033
470k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
340
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
How to make the Groovebox
asonas
2
2.3k
Transcript
Next.js で Ruby を プログラミング&実行できる アプリを作る エンジニアの自由研究発表会vol.9 うーたん
自己紹介 • うーたん • 新卒サーバーサイドエンジニア ◦ 株式会社ゆめみ • 趣味 ◦
アニメを見ること • X ◦ @uutan1108
目次 - 作ったもの - 仕組み - Server Actions - @ruby/wasm-wasi
- 終わりに
作ったもの
None
None
Ruby のコードを Next.js のみで実行できる
仕組み
仕組み ・Server ActionsはNext.js 14でStableになった機能です。 サーバー側で関数を実行できます。 ・サーバー側の実行結果をクエリパラメータに与えリダイ レクト させます。
実行前 実行後
Server Actions
Server Actions and Mutations サーバーアクションは、サーバー上で実行される非同期関数で す。サーバーコンポーネントやクライアントコンポーネントで使 用し、Next.jsアプリケーションのフォーム送信やデータを処理し ます。 https://nextjs.org/docs/app/building-your-application /data-fetching/server-actions-and-mutations
Server Actions ・フォームのsubmitが押 さ れた時にサーバーで 関数 が実行される。 ・フォームの入力内容を 受 け取り処理をでき る。 ・onAction関数にRuby を 実行するコードを書 く 引
用:https://future-architect.github.io/articles/20231130a
wasm
WebAssembly とは何か この機能はウェブプラットフォームにとって大きな意味を持ちま す。ウェブ上で動作するクライアントアプリで従来は実現できな かった、ネイティブ水準の速度で複数の言語で記述されたコー ドをウェブ上で動作させる方法を提供します。 今回はサーバー側でWasmを実行しています。 https://developer.mozilla.org/ja/docs/WebAssembl y/Concepts
@ruby/wasm-wasi ・先ほどのonAction関数内のコー ド。 ・npmでインストールできる。 ・wasmを読み込んでユーザーから 受け取ったコードを実行する。 ・Rubyで標準入力を与え、標準 出 力を取得するコードを追加す る。
終わりに
感想 • 意外と簡単に実装できた • Next.js 14 の新しい機能 Server Actions を使ってみたが、
便利そうな気がする • OHMORIYUSUKE/ruby-web でコードを公開しているので 見てください! • 作ってみると楽しい
ご清聴ありがとうございました🙇