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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
コミュニティ・勉強会を作るのは目的じゃない
ohmori_yusuke
1
330
映画のエンドロール風の動画を自動生成するツールを作った
ohmori_yusuke
2
67
アウトプットは“成果物”じゃなく“副産物”だった話
ohmori_yusuke
1
110
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
830
仕様がそのままテストになる!Javaで始める振る舞い駆動開発
ohmori_yusuke
8
6k
勉強会から始まった僕のDevRel~新卒エンジニアがつないだ2年間の軌跡~
ohmori_yusuke
2
510
WebエンジニアがSwiftをブラウザで動かすプレイグラウンドを作ってみた
ohmori_yusuke
0
360
アニメがエンジニアをつなぐ!「エンジニアニメ」勉強会が巻き起こすCo-Creationの波
ohmori_yusuke
0
320
組織が大きく変わろうとするとき、自分はどうありたいかを考えている
ohmori_yusuke
19
7.7k
Other Decks in Programming
See All in Programming
言語を使う側から、作る側へ。 自作 Lisp で得た新たな気づき。
andpad
0
110
Honoでのサプライチェーン侵害対策 〜 3つのライブラリに学ぶ
yusukebe
7
1.8k
技術記事、 専門家としてのプログラマ、 言語化
mizchi
14
7.4k
そのテスト、説明できますか?~LWテスト戦略FW~のご紹介
nakahara
0
200
【やさしく解説 設計編・中級 #6】良いアーキテクチャとは ~ 一本の登り道の、行き先 ~
panda728
PRO
0
140
Haskell/Servantを通してWebミドルウェアを捉え直す
pizzacat83
1
480
任せる範囲はこう広がった / How the Scope of AI Delegation Has Expanded
nrslib
1
250
Snowflake Summitでの新機能 CoCo / CoWork / snowflake-summit-2026-overall-what-new-coco
tatsuhiro
1
220
壊れたパーサから始める関数型設計と構成的なパーサ #fp_matsuri
raiga0310
2
190
Vue × Nuxt × Oxc どこまで使える?実運用の現在地
andpad
0
370
Webフレームワークの ベンチマークについて
yusukebe
0
200
Hatena Engineer Seminar #37「言語モデルの活用に関する研究」
slashnephy
0
510
Featured
See All Featured
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1.1k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
63
55k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
GitHub's CSS Performance
jonrohan
1033
470k
Ethics towards AI in product and experience design
skipperchong
2
330
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.7k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
230
Code Reviewing Like a Champion
maltzj
528
40k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.9k
Designing for Performance
lara
611
70k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
220
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 でコードを公開しているので 見てください! • 作ってみると楽しい
ご清聴ありがとうございました🙇