Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Vercel Edge Functions を使って作る画像メーカー
Search
Doarakko
April 10, 2024
Programming
100
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Vercel Edge Functions を使って作る画像メーカー
https://zenn.dev/peperoncicicino/articles/04ddadba105194
Doarakko
April 10, 2024
Transcript
18 slides
Vercel Edge Functions を使って作る 画像メーカー Engineer Guild Lightning Talk @Doarakko
# 経歴 BtoB SaaS、HR、EC(現職) # 仕事 金融系新規プロダクトの開発チームリード バックエンド、フロントエンド、インフラとフルサイクルに開発 # 趣味
・海外サッカー観戦 ・個人開発 たなあみ @Doarakko 2
自分の体型に一番近いポケモンを見つけられるサービス「PokeFit」 3
Vercel とは 4 ・簡単に言うと Web アプリを公開するためにいろいろなものを提供してくれるサービス ・Next.js は Vercel
が作ってます ・最近は Postgres・Redis・Storage なども提供 → Vercel だけでいろいろなサービスを作れる💪
Vercel Edge Functions とは 5 ・JavaScript のコードを CDN 上で動かせるようにするもの ・超簡単に言うと、ユーザーにより近いところで処理が行われるので速い
🍍 ランタイムを「edge」にするだけ
画像メーカーの例 6 https://gigazine.net/news/20201015-ghibli-subtitles-maker/ https://web.save-editor.com/pic/picture_text_jojo_tool.html
画像メーカー? 7
画像メーカーには OGP 画像が必要不可欠(個人的な意見) 8 生成した画像を SNS で拡散してほしい → 画像付き投稿はアカウント連携しないとできない(X など)
→ 画像をローカルに保存してから投稿するのめんどくさい → 画像投稿だとサイト URL は共有されずらい 🍇 Web Share API では PC で対応されていない環境がある(2024年4月現在)
画像メーカーには OGP 画像が必要不可欠(個人的な意見) 9 URL 投稿により OGP 画像が展開されるようにすることで アカウント連携なしで間接的に画像を SNS
に共有できるようにする
OGP ありの画像メーカーを作るつらみ 10 ・生成された画像ごとにページを生成、ページごとの OGP 画像を作成する必要が ・画像メーカーなので画像が大量生成される → 読み込み、書き込み、保存し続けることにお金がかかる💰
「PokeFit」では約30万枚の画像が生成されています 11
Vercel Edge Functions を使って無料で運用 12
Vercel Edge Functions がリクエストの度にOGP 画像を動的に生成 13 クローラー OGP 画像の URL
Vercel Edge Functions 画像を保存するストレージ
画像を返すAPIを実装してメタタグにパスを埋め込み 14 index.tsx /api/og/index.tsx 🍎 HTML/CSS を SVG に変換するライブラリ「vercel/satori」を使用
🚨 永遠に無料で運用はできません 15 ・Vercel Edge Functions の無料枠(月50万回:2024年4月現在) を超えるとお金がかかる ・生成された画像ごとにユニークなページを作成している →
ページ ID と内容(今回はポケモンの ID)を保存するためのデータストアが必要 → データストアの無料枠を超えるとお金がかかる(今回は Supabase を使用) 🎉 相当使われないと無料枠は超えません、超えた時は逆に喜びましょう
仕組みは Vercel が用意してくれているので あとは何をどう表示するのか考えるだけ
まとめ 17 ・今 Edge が熱い ・オリジナリティも出せて短期間でアウトプットできるので 勉強ついでに何かアプリを作りたい方に画像メーカーの開発おすすめです ・楽しんでものづくりしてます
Vercel Edge Functions を使って作る 画像メーカー Engineer Guild Lightning Talk @Doarakko
More Decks by Doarakko
See All by Doarakko
Cloudflare Workers で X(Twitter)のボットを作ってみた
doarakko
0
340
JOIN して1ヶ月のエンジニアに聞いた Liiga の良いところ 3 選
doarakko
0
94
わんわおーん
doarakko
0
83
職場を明るくする
doarakko
0
350
コードレビューの時間を削減しました
doarakko
0
120
仕事中に隠れてテレビ番組表を見るぞ
doarakko
0
230
GitHub Project の運用を自動化しました
doarakko
0
140
GitHub Actions に入門しました
doarakko
0
1.4k
積ん読を消化するために
doarakko
0
1.4k
Other Decks in Programming
See All in Programming
地方こそサーバーレス — 10年続けた、顔が見えるチームで確かな基盤を / Serverless Matters Most in Regional Areas — 10 Years of Building Reliable Foundations with Close-Knit Teams
seike460
PRO
1
470
GraphQL の onError と Nullability のこれから
quramy
0
220
Web3Dライブラリを作ってVue Custom Rendererの仕組みを理解しよう / lets learn vue custom renderer by making 3d library
drumath2237
1
140
AI時代のFlutter品質設計 — アプリ品質を守るQuality Layers
omatty198
0
380
社内AIエージェント「Askワンバン」における コストチューニングの取り組み
t0yohei
0
170
AI時代のIaC入門 〜なぜインフラをコードで管理したいのか?〜 / Introduction to IaC in the AI Era
akihisaikeda
6
1.5k
LLM 101: Exploring LLMs, Starting with Tokens.
dalinaum
0
110
AIが生成したコードは読むべきか?抽象化設計とコードの品質保証 / abstraction-design-and-quality
minodriven
16
9.3k
AI時代のシニアエンジニアとは
yosuke_furukawa
PRO
15
12k
SODA - FACT BOOK(JP)
sodainc
1
40k
AI Augmentation Techniques with Liberty
ivargrimstad
1
500
Spec-driven Development with AI
simas
PRO
0
2.3k
Featured
See All Featured
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
2
2.1k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
330
The Language of Interfaces
destraynor
162
27k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
490
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.6k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
520
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.9k
Optimising Largest Contentful Paint
csswizardry
37
4k
Navigating Team Friction
lara
192
16k
Agile that works and the tools we love
rasmusluckow
331
22k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Ruling the World: When Life Gets Gamed
codingconduct
0
440