Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Next.js で Ruby をプログラミング&実行できるアプリを作る
Search
uutan1108
January 18, 2024
Programming
0
1.8k
Next.js で Ruby をプログラミング&実行できるアプリを作る
エンジニアの自由研究発表会vol.9
https://tech-street.connpass.com/event/305362/
uutan1108
January 18, 2024
Tweet
Share
More Decks by uutan1108
See All by uutan1108
仕様がそのままテストになる!Javaで始める振る舞い駆動開発
ohmori_yusuke
8
5.2k
勉強会から始まった僕のDevRel~新卒エンジニアがつないだ2年間の軌跡~
ohmori_yusuke
2
320
WebエンジニアがSwiftをブラウザで動かすプレイグラウンドを作ってみた
ohmori_yusuke
0
210
アニメがエンジニアをつなぐ!「エンジニアニメ」勉強会が巻き起こすCo-Creationの波
ohmori_yusuke
0
170
組織が大きく変わろうとするとき、自分はどうありたいかを考えている
ohmori_yusuke
19
6.9k
技術以外をきっかけに交流するエンジニア向け勉強会
ohmori_yusuke
0
72
デザインって“感覚”だけじゃないVibe Codingからの気づき
ohmori_yusuke
3
110
MDN Web Docs に日本語翻訳でコントリビュートしたくなる
ohmori_yusuke
1
170
PHPで始める振る舞い駆動開発(Behaviour-Driven Development)
ohmori_yusuke
1
670
Other Decks in Programming
See All in Programming
ゆくKotlin くるRust
exoego
1
140
Microservices rules: What good looks like
cer
PRO
0
1.6k
生成AI時代を勝ち抜くエンジニア組織マネジメント
coconala_engineer
0
330
LLMで複雑な検索条件アセットから脱却する!! 生成的検索インタフェースの設計論
po3rin
4
940
LLM Çağında Backend Olmak: 10 Milyon Prompt'u Milisaniyede Sorgulamak
selcukusta
0
130
実は歴史的なアップデートだと思う AWS Interconnect - multicloud
maroon1st
0
250
AIエージェントを活かすPM術 AI駆動開発の現場から
gyuta
0
460
大規模Cloud Native環境におけるFalcoの運用
owlinux1000
0
180
エディターってAIで操作できるんだぜ
kis9a
0
750
認証・認可の基本を学ぼう後編
kouyuume
0
250
これならできる!個人開発のすゝめ
tinykitten
PRO
0
120
Cap'n Webについて
yusukebe
0
150
Featured
See All Featured
GraphQLとの向き合い方2022年版
quramy
50
14k
How to make the Groovebox
asonas
2
1.8k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
81
BBQ
matthewcrist
89
9.9k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Scaling GitHub
holman
464
140k
Statistics for Hackers
jakevdp
799
230k
Six Lessons from altMBA
skipperchong
29
4.1k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
84
Designing for Timeless Needs
cassininazir
0
88
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
31
We Have a Design System, Now What?
morganepeng
54
7.9k
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 でコードを公開しているので 見てください! • 作ってみると楽しい
ご清聴ありがとうございました🙇