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
ヘキサゴナルアーキテクチャをFastAPIで考える
Search
Tatsunobu.
June 03, 2026
22
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ヘキサゴナルアーキテクチャをFastAPIで考える
Tatsunobu.
June 03, 2026
More Decks by Tatsunobu.
See All by Tatsunobu.
ESP-EYEによるAI非依存の 入退場人数カウント手法
5656systems
0
32
全⽇本ビルドインサーバ 本番環境利⽤禁⽌協会〜〜 (Flaskフレームワークの場合)
5656systems
0
32
DXの道も一歩から ~業務作業短縮の一例~
5656systems
0
110
Featured
See All Featured
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
520
Tell your own story through comics
letsgokoyo
1
1.1k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
450
How to build a perfect <img>
jonoalderson
1
6.1k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
630
The Spectacular Lies of Maps
axbom
PRO
1
1.1k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.6k
Fantastic passwords and where to find them - at NoRuKo
philnash
53
4k
Google's AI Overviews - The New Search
badams
0
1.6k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
360
Chasing Engaging Ingredients in Design
codingconduct
0
360
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
500
Transcript
ヘ キ サ ゴ ナ ル ア ー キ テ
ク チ ャ を F a s t A P I で 考 え る ゴロゴロシステムズ
趣味 自 己 紹 介 た
つ の ぶ ( @ 5 6 5 6 s y s t e m s ) 職業 介護福祉領域の事業承継支援会社の技術役員(CTO) ゴロゴロシステムズ(個人事業主:エンジニア) 水門の遠隔操作システム開発者・生体認証基盤保守開発者←NEW お米会社のIT顧問 / 心理相談室のHP改善担当 社会保険労務士事務所の社内SE / M&Aプラットフォーム開発者 「人事・労務・業務・メンタルヘルス課題のDX」を通じてこころの労働負荷を削減する 担当実績 モットー ボカロ鑑賞・カフェ巡り・技術探求・ゴロゴロすること 2027年の 社会保険労務士試験 合格したいゾ 💪 ...etc
Hexagonal Architectureは 2005年頃にAlistair Cockburn(アリスター・コバーン)氏 によって提唱された アーキテクチャパターン
ビジネスロジックを外部技術から独立 させること 最 大 の 目 的
フ ォ ル ダ ー 構 成 例
① D o m a i n 層 ( E
n t i t y ) 業務ルールを持つ、システムのコアです。ピュアなPythonコードで記述 し、PydanticやSQLAlchemyなどのライブラリには依存させません。
② P o r t 定 義 ( I n
t e r f a c e ) Repositoryの「仕様」だけを定義する抽象クラスです。
③ A p p l i c a t i
o n 層 ( U s e C a s e ) Portを利用して業務ロジックを組み立てます。
④ I n f r a s t r u
c t u r e 層 ( A d a p t e r の 実 装 ) SQLAlchemy等のORMを利用して、Port(仕様) を満たす具象処理を実装します。
⑤ P r e s e n t a t
i o n 層 ( F a s t A P I R o u t e r ) FastAPIのRouterは、HTTPリクエストをアプリケーションが理解できる形に変換 してUseCaseに渡す「入力アダプター」です。FastAPIの強力な機能である Depends を使って、UseCaseへAdapterを注入します。
ま と め Hexagonal Architectureの本質は 「業務ロジックを外部技術から守る」こと!! FastAPIとしてはRouter部分のみを担当し Domain UseCase Port
を中心に設計することで 保守性・テスト容易性・拡張性の高いシステムを構築できる 💪
ありがとうございました