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
Materia.pdf
Search
TakutoYoshimura
January 25, 2019
Technology
260
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Materia.pdf
TakutoYoshimura
January 25, 2019
Transcript
20 slides
サービスバックエンドOSS Materia Takuto Yoshimura
[email protected]
自己紹介 本名 吉村 拓人 カラビナテクノロジー株式会社 社内のあだ名は つちろー 元はJava の金融系SIer 昨年より顧問エンジニアとしてElixir
でWeb システ ム開発はじめました
顧問エンジニアとは 月額定額で0 からのシステム開発をサポート Web サービス立ち上げのビジネスモデル構築など からお供いたします 数名の担当で複数のお客様のサービスを開発
2018 年の私
複数のお客様へ向けてWeb システム 開発を平行で行う日々
Phoenix が標準で担保しない、業務 システムでの必須機能 ユーザー認証機構(guardian) トランザクションスコープ 楽観/ 悲観排他ロジック etc
毎回実装するのがめんどくさ・・・
もとい、もっと開発生産性あげたい
共通機能作って再利用しよう
どうせならOSS として公開しよう
Materia とは 弊社カラビナテクノロジーで開発中の Elixir/Phoenix 製サービスバックエンドライブラリ SPA(Single Page Application) での開発を想定した バックエンドAPI
を提供 サービスとして特色のないユーザー管理や認証と いった部分のバックエンド機能を個別開発せず に、本来実装したいサービスの特色となる機能の 開発に注力 Qiita 記事: Web サービスバックエンドライブラリー Materia
Materia ファイミリー構成 MateriaUtils: 日付変換、Ector ラッパー実装など各 種ユーティリティ Materia: アカウント管理、JWT 認証、権限管理 MateriaCommerce:
商品・価格・税情報、購入契 約管理 他追加開発中
サービス構築時の構成 OriginalService = MateriaUtils + Materia + MateriaHogeHoge + OriginalElixirCode
導入のステップ |> deps.get |> config 設定 |> migration ファイル生成 |>
router.ex で必要な認証機構とAPI を定義 materia README
deps.get mix.exs defp deps do [ {:phoenix, "~> 1.3.2"}, ~
中略 ~ {:cowboy, "~> 1.0"}, {:materia, "~> 0.1.2"} # add here ] > mix deps.get
con g 設定 jwt 認証(guardian) の設定 Repo の設定 参考 materia
README Materia を導入してログイン認証してみる
migration ファイル作成 > mix guardian.db.gen.migration > mix materia.gen.migration > mix
ecto.create > mix ecto.migrate > mix run priv/repo/seeds.exs
ルーティング設定 pipeline で認証ロジックの設定 pipeline :user_auth do plug Materia.UserAuthPipeline end pipe_through
でAPI 毎にパイプラインを指定 scope "/api", MateriaWeb do pipe_through [ :api, :user_auth] get "/user", UserController, :show_me post "/grant", GrantController, :get_by_role end
ログインAPI リクエスト POST http://localhost:4000/api/sign-in HTTP/1.1 Content-Type: application/json { "email": "
[email protected]
",
"password": "hogehoge" }
ログインAPI レスポンス HTTP/1.1 201 Created server: Cowboy date: Fri, 14
Dec 2018 08:16:32 GMT content-length: 740 content-type: application/json; charset=utf-8 cache-control: max-age=0, private, must-revalidate { "refresh_token": "hogehoge", "id": 1, "access_token": "fugafuga" }
More Decks by TakutoYoshimura
See All by TakutoYoshimura
gcp_gke_infla_design.pdf
takutoyoshimura
0
320
Other Decks in Technology
See All in Technology
OpenTelemetryで変わった 新時代のCloudWatchメトリクス監視
tsukuboshi
0
500
SBOM 生成ツールで 2026 Minimum Elements はどこまで満たせるのか
gokken
0
160
20261119_AgentCore
takuyay0ne
2
280
現場に渡し、構造で守る AI エージェントを活用したセルフサーブのデータ基盤の運用
legalontechnologies
PRO
0
110
パスワードのない鍵で、 データを手元に置く
ginjihayashi
0
400
Is the Website Dying?
miriamschwab
0
160
AIフレンドリーなGenerative UIをJSXで
uhyo
2
140
お風呂場をサーバルームにしよう
yusuke427
0
400
「個社」ではなく「業界」の課題を解く AI 対話開発 ー 価値を広げる設計と、価値を守るエンジニアリング ー
ivry_presentationmaterials
4
870
ブース設計、 お前もプロダクトだったのか / So Booth Design Was a Product All Along
akihiro0038
0
150
落とし穴にハマってわかった 開発生産性を測るときに気をつけたいこと
munakata
3
490
データから見る AI時代のエンジニア転職と採用
junya_okura
4
1.3k
Featured
See All Featured
The Curse of the Amulet
leimatthew05
4
17k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
4
1.2k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
3k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.3k
sira's awesome portfolio website redesign presentation
elsirapls
0
520
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Raft: Consensus for Rubyists
vanstee
143
7.9k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
850
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
580
Believing is Seeing
oripsolob
1
290
Google's AI Overviews - The New Search
badams
0
1.7k