Slide 1

Slide 1 text

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. 開発者を魅了する オープンソースソフトウェア Supabase タイラー (Tyler Shukert) G - 0 - 1 DevRel & Flutter Developer Supabase Inc. 松⽥ 和樹 Startup Solutions Architect Amazon Web Services Japan G.K.

Slide 2

Slide 2 text

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. タイラー / Supabase inc. DevRel & Flutter Developer オーストリア⽣まれの⽇⽶ハーフで、ここ数年は Flutter で楽しくアプリを 開発する⽇々。Twitter で⾒つけた Supabase というサービスに⼀⽬惚れし、 Flutter での開発にも使うべく Flutter ⽤の SDK 開発を⼿伝ったのち Supabase に Join。プライベートではスポーツと猫が⼤好き😻 松⽥ 和樹 / Amazon Web Services Japan G.K. Startup Solutions Architect 出⾃がインフラエンジニアなスタートアップソリューションアーキテクト。 創業期のスタートアップにいて、上場直前まで様々な業務に従事した後に AWS にJoin。Amplify や Supabase など、フロントエンド開発の敷居を 下げてくれるサービスが好きです。Supabase が Amazon Aurora で 動くようにパッチを出したりもしています。 トリ🐤、、ではなく⽝が好きです。

Slide 3

Slide 3 text

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. • Supabase とは何か、何を可能にするのかを理解する。 • Supabase がどの様に動いているかを知り、 適切な技術選定が出来るようになる。 本セッションのゴール

Slide 4

Slide 4 text

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. • Supabase とは • Under the Hood at Supabase • Self-hosting • パネルディスカッション / QA アジェンダ

Slide 5

Slide 5 text

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. What is ? ~ How Supabase works ~

Slide 6

Slide 6 text

Supabase

Slide 7

Slide 7 text

世界で⼀番⽣産的な 開発者プラットフォームを作る

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

Database 全てのプロジェクトに PostgreSQLを提供。リアル タイム機能も対応でスケー ルするアプリ開発を支援。 Auth メールアドレスやOAuthを使 った認証を簡単に実装。デ ータベースにもセキュアに アクセス! S3のストレージにクライア ントからセキュアにアクセ スできる仕組みを提供。 Storage Denoを使ってEdge Functionsを簡単にデプロイ 。 Functions オープンソースツールの集合体

Slide 12

Slide 12 text

既存のオープンソースツールを使う。 無ければ⾃分たちで作り、オープンソース化する。

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

こんな⼈に使ってもらいたい SQL をよく知っている⼈ - ⽣の PostgreSQL が提供されているので使い⽅は⾃在 - 既存の PostgreSQL 上で動いているサービスの移⾏も楽 SQL をまだ知らない⼈ - GUI から操作ができる - 使っていくうちに SQL・PostgreSQL に詳しくなる 【 PostgreSQL だから効率的に開発できる】

Slide 15

Slide 15 text

クライアントライブラリ

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

const { data, error } = await supabase .from('messages') .select('*') .match({user_id:'my_user_id'}) .order('created_at') クライアントライブラリ select * from messages where user_id = 'my_user_id' order by created_at; SQL

Slide 18

Slide 18 text

Demo

Slide 19

Slide 19 text

Build in a weekend, scale to millions

Slide 20

Slide 20 text

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. Under the Hood at

Slide 21

Slide 21 text

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. Architecture (High-Level) API アクセス クライアント API データベース

Slide 22

Slide 22 text

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. Architecture (Low-Level) API Gateway APIs Database

Slide 23

Slide 23 text

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. Kong Gateway • 実体は OpenResty (Nginx + Lua) と独⾃の拡張機能群 • 開発元は Kong 社 Supabase での役割 • 各コンポーネントへのルーティング • API Key (anon key) の検証 • ⾼度な認証認可は⾏っていない オ ー プ ン ソ ー ス の A P I G a t e w a y ( O p e n R e s t y )

Slide 24

Slide 24 text

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. GoTrue (Auth API) • フォーク元は Netlify 社が開発 • 各種フェデレーション等が追加されている Supabase での役割 • Access Token の払い出し • Google や Twitter 等とのフェデレーション • 認証⽤メールの送信(要:SMTP サーバー) オ ー プ ン ソ ー ス の 認 証 A P I ( G o l a n g )

Slide 25

Slide 25 text

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. PostgREST (Rest API) • PostgreSQL に接続するだけで API が⾃動⽣成される • RESTful API からテーブル操作することが可能 Supabase での役割 • データの CRUD 処理 (RLS) • GraphQL の処理(要:pg_graphql ) オ ー プ ン ソ ー ス の R E S T f u l A P I ( H a s k e l l )

Slide 26

Slide 26 text

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. Supabase Realtime • PostgreSQL のロジカルレプリケーションの機能を利⽤し、 データの変更をクライアントに json 形式で伝える Supabase での役割 • データの変更の伝播 (RLS) リ ア ル タ イ ム ア プ リ ケ ー シ ョ ン の た め の W e b s o c k e t A P I ( E l i x i r )

Slide 27

Slide 27 text

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. Supabase Storage • API は S3 互換だが、権限制御は GoTrue の発⾏した Token を利⽤ • ファイルの実体はローカルのファイルシステム or S3 に配置 • Supabase Storage にも Bucket の概念があるが、バックエンドに S3 を 利⽤している場合はそのパスにマッピングされる Supabase での役割 • 画像等のアップロード、参照⽤の API の提供 • 提供されるのは S3 相当の機能なので CDN の利⽤を推奨 S 3 互 換 の オ ブ ジ ェ ク ト ス ト レ ー ジ ( T y p e S c r i p t )

Slide 28

Slide 28 text

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. Postgres Meta API • PostgreSQL 管理⽤の API を提供 • TypeScript ⽤の型定義や OpenAPI の定義⽣成などのヘルパー機能を提供 • 主に Supabase Studio 経由で利⽤される Supabase での役割 • 主に Supabase Studio で利⽤されている • 基本的にサービス内では利⽤しない • service_role ⽤の API Key が無いと動作しないように API Gateway で設定されている P o s t g r e S Q L 管 理 ⽤ の R E S T f u l A P I ( T y p e S c r i p t )

Slide 29

Slide 29 text

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. Architecture (High-Level) Supabase Studio 開発者 管理⽤ API API アクセス クライアント API データベース

Slide 30

Slide 30 text

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. Supabase Studio • テーブル設計やクエリの実⾏が可能 • 効率的に開発を⾏うことができる • Supabase Cloud と⼀部機能差あり N E X T . J S 製 の 管 理 コ ン ソ ー ル ( オ ー プ ン ソ ー ス )

Slide 31

Slide 31 text

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. Self-hosting

Slide 32

Slide 32 text

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. Self-hosting • 全てのコンポーネントがオープンソース • コンテナイメージも公開されている • 開発者は好きな環境で Supabase を動かせる • ドキュメントも整備されている • 公式のガイドは docker-compose のみ • その他の環境は⾃分で設計する必要がある

Slide 33

Slide 33 text

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. Self-hosting or Supabase Cloud 直ぐにはじめたい 👉 Supabase Cloud • Supabase Cloud を使う場合も、将来的にどの様な拡張ができるのかを 把握しておくことはとても重要 より⾃分でコントロールする必要がある場合 👉 Self-hosting • 可⽤性やスケーリングの制御(現状、Supabase Cloud は単⼀インスタンス) • マルチリージョン対応 • 業界ごとのセキュリティ基準への対応 判断には「ビジネス背景」が⾮常に重要

Slide 34

Slide 34 text

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. Self-hosting with AWS デ ー タ ベ ー ス の 実 ⾏ 環 境 • ⾃由に拡張機能等を⼊れられる (Supabase の想定するフル機能が使える) • AMI ビルド⽤のコードとコンテナイメージ が Supabase 社から公開されている • AWS Marketplace への AMI 登録が進⾏中 • データベースの運⽤は⾃分で⾏う PostgreSQL on EC2 Amazon Aurora PostgreSQL • 拡張機能等を⼊れることが出来ない (Supabase の⼀部機能が利⽤不可) • 動的にスケールアップ可能な Aurora Serverless v2 が利⽤可能 • データベースの運⽤の⼤部分は マネージドサービスの機能で補える

Slide 35

Slide 35 text

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. Self-hosting with AWS

Slide 36

Slide 36 text

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. まとめ

Slide 37

Slide 37 text

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. まとめ - Supabase とは • 世界⼀⽣産的な開発者プラットフォーム(を⽬指している) • 使いやすいフロントエンド / モバイルクライアント • 慣れ親しんだリレーショナルデータベース (PostgreSQL) • Supabase は OSS の集合体 • 要件に合わせて⾃⼰拡張可能 • Supabase Cloud 利⽤時も理解しておくことは重要 • ビジネスにおいて要件が変わることは⾮常に多い • 仕組みが分かることにより適切な技術選定がしやすくなる

Slide 38

Slide 38 text

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. 告知 - Supabase on AWS ワークショップ (11/11) https://bit.ly/supabase-aws-workshop

Slide 39

Slide 39 text

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. パネルディスカッション & QA

Slide 40

Slide 40 text

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. Thank you! © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. タイラー DevRel & Flutter Developer Supabase Inc. 松⽥ 和樹 Startup Solutions Architect Amazon Web Services Japan G.K.