読了時間 : 12 minutes

SupabaseのシンプルさとSpring Bootのパワーの間で選択するのではなく、両方を組み合わせてみませんか?それぞれの技術の長所を活かしたハイブリッドアーキテクチャをご紹介します。

強迫性障害

[]

現代建築の偽りのジレンマ

静的フロントエンドを使ってモダンなアプリケーションを構築するとき、しばしば二者択一の選択に直面することになります:

  • Backend-as-a-Serviceのソリューションにすべてを賭ける。(Supabase, Firebase) - シンプルだが制限がある

  • 完全なバックエンドを構築する(Spring Boot, Node.js) - 強力だが複雑

この選択は誤った二択です。ハイブリッドアーキテクチャは第三の道を提案します: 各テクノロジーが得意とする場所で使用する。

建�築ビジョン

伝統的なアーキテクチャ: モノリシック

@startuml
skinparam backgroundColor #FEFEFE
skinparam componentStyle rectangle

package "伝統的建築" {
  actor Utilisateur as user
  component "フロントエンド" as frontend #LightBlue
  component "モノリシックバックエンド" as backend #LightCoral {
    [Authentification]
    [CRUD]
    [Logique Métier]
    [Jobs]
    [APIs Tierces]
  }
  database "データベース" as db #LightGray

  user --> frontend
  frontend --> backend : Toutes les requêtes
  backend --> db
}

note right of backend
  Tout passe par le backend
  même les opérations simples

  ⚠️ Point de congestion unique
  ⚠️ Complexité dès le départ
  ⚠️ Couplage fort
end note
@enduml

このアプローチでは、最も単純な操作(記事の読み込み、コメントの作成)であっても、すべてバックエンドを経由する必要があります。最初の日から複雑さのコストを支払うことになります。

BaaSアーキテクチャ:全代表者

@startuml
skinparam backgroundColor #FEFEFE
skinparam componentStyle rectangle

package "アーキテクチャ BaaS ピュア" {
  actor Utilisateur as user
  component "フロントエンド" as frontend #LightBlue
  cloud "Supabase / Firebase" as baas #LightGreen {
    [Auth]
    [Database]
    [Storage]
    [Edge Functions]
  }

  user --> frontend
  frontend --> baas : Toutes les opérations
}

note right of baas
  Développement rapide
  Pas de serveur à gérer

  ⚠️ Limité pour logique complexe
  ⚠️ Vendor lock-in
  ⚠️ Edge Functions contraintes
end note
@enduml

逆に、すべてをBaaSに委ねるのは最初は魅力的ですが、ビジネスロジックが複雑になるとすぐに限界が露呈します。

ハイブリッドアーキテクチャ: 責任の分離

@startuml
skinparam backgroundColor #FEFEFE
skinparam componentStyle rectangle

actor Utilisateur as user #LightBlue

package "フロントエンド層" {
  component "JBakeの静的サイト" as frontend #SkyBlue
}

package "シンプルな層 (Supabase)" #LightGreen {
  component "認証" as auth
  component "CRUD基本" as crud
  component "ファイル ストレージ" as storage
  component "リアルタイム" as realtime
}

package "ビジネスレイヤー (Spring Boot)" #Coral {
  component "複雑なロジック" as logic
  component "オーケストレーション" as orchestration
  component "計画されたジョブ" as jobs
  component "統合" as integrations
}

database "PostgreSQL 共有" as db #LightGray

user --> frontend

frontend --> auth : OAuth2, JWT
frontend --> crud : Articles, Profils
frontend --> storage : Images, Fichiers
frontend --> realtime : Notifications

frontend --> logic : Calculs, Rapports
frontend --> orchestration : Workflows
logic --> integrations : Stripe, APIs
orchestration --> db
jobs --> db

crud --> db
auth --> db

note bottom of db
  **Une seule source de vérité**
  Partagée entre Supabase et Spring Boot
end note

note right of auth
  **Gratuit jusqu'à 50k users**
  Configuration en quelques clics
  OAuth2 multi-providers
end note

note right of logic
  **Activé seulement si nécessaire**
  Kotlin + Coroutines
  Transactions complexes
end note
@enduml

ハイブリッドアーキテクチャは、複雑さと操作の性質に応じて、責任をはっきりと分離します。

設計原則

原則1:シンプルに始め、賢く進化させる

@startuml
skinparam backgroundColor #FEFEFE

rectangle "フェーズ 1 : MVP" #LightGreen {
  component "JBake + Supabase" as mvp
  note right
    ✓ Développement en jours
    ✓ Coût : 0€
    ✓ Validation concept
  end note
}

rectangle "**フェーズ 2: 成長**" #LightYellow {
  component "JBake + Supabase
+ Spring Boot (オプション)" as growth
  note right
    ✓ Logique métier émerge
    ✓ Premiers jobs planifiés
    ✓ Intégrations tierces
  end note
}

rectangle "フェーズ 3 : スケール" #LightCoral {
  component "完全なアーキテクチャ" as scale
  note right
    ✓ Orchestration complexe
    ✓ Performances optimisées
    ✓ Cache distribué
  end note
}

mvp -down-> growth : Quand la complexité\nle justifie
growth -down-> scale : Optimisation\ncontinue
@enduml

必要でなければ、Spring Bootを構築しないでください。Supabaseで始めて、複雑さが必要とされるときにSpring Bootを追加してください。

原則2 : 操作の性質による分離

@startmindmap
skinparam backgroundColor #FEFEFE
* Opérations\nApplicatives

left side

** Opérations Simples\n(Supabase)
***_ CRUD Standard
****_ Lecture
****_ Création
****_ Mise à jour
****_ Suppression
***_ Authentification
****_ Login/Logout
****_ OAuth2
****_ Gestion session
***_ Stockage
****_ Upload fichiers
****_ CDN automatique
***_ Temps Réel
****_ WebSocket
****_ Notifications

right side

** Opérations Complexes\n(Spring Boot)
***_ Logique Métier
****_ Calculs complexes
****_ Règles métier
****_ Validations avancées
***_ Orchestration
****_ Multi-services
****_ Transactions distribuées
****_ Saga patterns
***_ Tâches Planifiées
****_ Rapports périodiques
****_ Synchronisations
****_ Nettoyages
***_ Intégrations
****_ Paiements (Stripe)
****_ APIs tierces
****_ Services ML/AI

@endmindmap

原則 3 : 単一の真実の源

@startuml
skinparam backgroundColor #FEFEFE

database "ポストグレスQL" as db #LightGray {
  package "スキーマ: auth (Supabase)" #LightGreen {
    [users]
    [sessions]
    [identities]
  }

  package "スキーマ: 公開 (共有)" #SkyBlue {
    [articles]
    [comments]
    [profiles]
  }

  package "スキーマ: ビジネス (Spring Boot)" #Coral {
    [orders]
    [payments]
    [reports]
  }
}

component "Supabase" as supabase #LightGreen
component "スプリングブート" as spring #Coral

supabase -down-> users : Gère
supabase -down-> sessions : Gère
supabase -down-> articles : Accède
supabase -down-> comments : Accède
supabase -down-> profiles : Accède

spring -down-> articles : Accède
spring -down-> profiles : Accède
spring -down-> orders : Gère
spring -down-> payments : Gère
spring -down-> reports : Gère

note right of db
  **Avantages :**
  • Pas de synchronisation complexe
  • JOINs possibles entre tables
  • Cohérence garantie
  • Migrations unifiées
end note
@enduml

同じPostgreSQLインスタンスを共有することで、SupabaseとSpring Bootは複雑な同期なしに同じデータを扱います。

フローのオーケストレーション

フラックス 1: 中央認証

@startuml
skinparam backgroundColor #FEFEFE
autonumber

actor "ユーザー" as user
participant "JBake" as jbake
participant "Supabase認証" as auth
participant "Spring Boot" as spring
database "PostgreSQL" as db

== Authentification ==
user -> jbake : Clique "ログイン"
jbake -> auth : Redirect OAuth2 (Google/GitHub)
auth -> user : Consent screen
user -> auth : Autorise
auth -> auth : Génère JWT
auth -> jbake : Retourne JWT + Refresh Token
jbake -> jbake : Stocke tokens (sessionStorage)

== Accès aux Ressources ==
group Opération Simple (CRUD)
  user -> jbake : Crée un article
  jbake -> db : POST avec JWT
  note right: Supabase Row Level Security\nvérifie le JWT automatiquement
  db -> jbake : Article créé
end

group Opération Complexe (Métier)
  user -> jbake : Génère un rapport
  jbake -> spring : POST /api/reports\navec JWT
  spring -> spring : Valide JWT Supabase
  spring -> spring : Extrait claims (user_id, roles)
  spring -> db : Requêtes complexes
  spring -> jbake : Rapport généré
end

note over auth, spring
  **Le JWT est universel**
  Valide par Supabase ET Spring Boot
  Pas de double authentification
end note
@enduml

重要なポイント一つの認証プロセス、一つのJWT、どこでも使える。

フラックス 2 : ビジネスプロセスの複雑なオーケストレーション

@startuml
skinparam backgroundColor #FEFEFE
autonumber

actor "クライアント" as user
participant "JBake" as jbake
participant "スプリングブート" as spring
participant "Supabase データベース" as supadb
participant "Stripe API" as stripe
participant "在庫サービス" as inventory
participant "メールサービス" as email
database "PostgreSQL" as db

user -> jbake : Passe commande
jbake -> spring : POST /api/orders/create

== Orchestration Spring Boot ==
spring -> db : BEGIN TRANSACTION

par Vérifications Parallèles
  spring -> inventory : Vérifier stock
  inventory -> spring : Stock OK
else
  spring -> db : Vérifier profil client
  db -> spring : Client vérifié
end

spring -> stripe : Créer Payment Intent
stripe -> spring : Intent créé (ID: pi_xxx)

spring -> db : Créer Order (status: PENDING)
db -> spring : Order créé

spring -> stripe : Confirmer paiement
stripe -> spring : Paiement confirmé

spring -> db : Update Order (status: PAID)
spring -> inventory : Décrémenter stock
spring -> db : COMMIT TRANSACTION

par Notifications Asynchrones
  spring -> email : Email confirmation
else
  spring -> supadb : Insert notification
  note right: Notification temps réel\nvia Supabase Realtime
end

spring -> jbake : Order confirmé
jbake -> user : Affiche confirmation

note over spring
  **Responsabilités Spring Boot :**
  • Transaction ACID
  • Orchestration multi-services
  • Rollback automatique si erreur
  • Gestion des cas limites
end note
@enduml

Spring Bootがもたらすもの: 信頼性の高い複数のシステムに関わる複雑なプロセスのオーケストレーション、トランザクション保証付き。

フラックス 3 : 予定されたジョブと同期

@startuml
skinparam backgroundColor #FEFEFE

participant "スケジューラ
(Spring Boot)" as scheduler
participant "レポートサービス" as report
participant "PostgreSQL" as db
participant "外部 API" as api
participant "メールサービス" as email
participant "Supabase ストレージ" as storage

== Job Quotidien : 2h00 ==
activate scheduler
scheduler -> report : Déclenche génération rapport

activate report
report -> db : Récupère données\ndes dernières 24h
db -> report : Dataset

report -> report : Calculs & Agrégations
report -> report : Génération PDF

report -> storage : Upload PDF
storage -> report : URL publique

report -> email : Envoie aux admins\navec lien PDF
deactivate report

== Job Hebdomadaire : Dimanche 3h00 ==
scheduler -> report : Synchronisation externe

activate report
report -> api : Fetch données externes
api -> report : Nouvelles données

report -> db : Mise à jour tables
report -> db : Nettoyage données obsolètes
deactivate report

== Job Mensuel : 1er du mois ==
scheduler -> report : Facturation

activate report
report -> db : Liste clients actifs
report -> report : Calcul montants
report -> api : Génération factures (Stripe)
report -> email : Envoi factures
deactivate report

deactivate scheduler

note right of scheduler
  **Impossible avec Supabase seul**
  Edge Functions non adaptées
  pour jobs longs et récurrents
end note
@enduml

Spring Bootがもたらすもの: 状態管理、自動リトライ、および保証された実行を備えた信頼性の高いスケジュールされたジョブ

意思決定マトリクス

Supabaseを使うべき時は?

@startuml
skinparam backgroundColor #FEFEFE

start

:Nouvelle fonctionnalité à implémenter;

if (CRUD simple ?) then (oui)
  :✅ **Supabase**;
  stop
else (non)
  if (Authentification ?) then (oui)
    :✅ **Supabase Auth**;
    stop
  else (non)
    if (Upload fichiers ?) then (oui)
      :✅ **Supabase Storage**;
      stop
    else (non)
      if (Temps réel ?) then (oui)
        :✅ **Supabase Realtime**;
        stop
      else (non)
        if (Row Level Security\nsuffisante ?) then (oui)
          :✅ **Supabase + Policies**;
          stop
        else (non)
          :⚠️ **Considérer Spring Boot**;
          #Coral:Passer à l'arbre\nde décision Spring Boot;
          stop
        endif
      endif
    endif
  endif
endif

@enduml

Spring Bootを使うべき時は?

@startuml
skinparam backgroundColor #FEFEFE

start

:Nouvelle fonctionnalité complexe;

if (Orchestration\nmulti-services ?) then (oui)
  :✅ **Spring Boot**;
  stop
else (non)
  if (Transaction ACID\ncritique ?) then (oui)
    :✅ **Spring Boot**;
    stop
  else (non)
    if (Job planifié ?) then (oui)
      :✅ **Spring Boot Scheduler**;
      stop
    else (non)
      if (Intégration API\ntierce complexe ?) then (oui)
        :✅ **Spring Boot**;
        stop
      else (non)
        if (Calculs lourds\n> 10 secondes ?) then (oui)
          :✅ **Spring Boot**;
          stop
        else (non)
          if (Cache distribué\nnécessaire ?) then (oui)
            :✅ **Spring Boot + Redis**;
            stop
          else (non)
            :⚠️ **Probablement Supabase**;
            #LightGreen:Revenir à l'arbre\nde décision Supabase;
            stop
          endif
        endif
      endif
    endif
  endif
endif

@enduml

プロジェクトタイプ別の建築例

ブログ / ポートフォリオ

@startuml
skinparam backgroundColor #FEFEFE
skinparam componentStyle rectangle

package "個人ブログ - 95% Supabase" {
  component "JBake" as jbake #SkyBlue

  package "Supabase (無料)" #LightGreen {
    [Auth: OAuth2 Google]
    [Articles (CRUD)]
    [Commentaires]
    [Images (Storage)]
    [Notifications Realtime]
  }

  package "Spring Boot (オプション)" #LightCoral {
    [Newsletter Mensuelle]
    note bottom: Job planifié uniquement
  }

  database "PostgreSQL" as db

  jbake --> [Auth: OAuth2 Google]
  jbake --> [Articles (CRUD)]
  jbake --> [Commentaires]
  jbake --> [Images (Storage)]
  jbake --> [Notifications Realtime]

  [Articles (CRUD)] --> db
  [Commentaires] --> db
  [Newsletter Mensuelle] --> db
}

note bottom of "Spring Boot (オプション)"
  **Spring Boot pas obligatoire**
  Newsletter peut être gérée
  par un service tiers (Mailchimp)
end note
@enduml

評決: 100% Supabaseは十分すぎるほどです。

SaaS アプリケーション

@startuml
skinparam backgroundColor #FEFEFE
skinparam componentStyle rectangle

package "アプリケーション SaaS - ハイブリッド アーキテクチャ" {
  component "JBake / React" as frontend #SkyBlue

  package "Supabase" #LightGreen {
    [Auth Multi-tenant]
    [Profils Utilisateurs]
    [Données Simples]
    [Storage Documents]
  }

  package "スプリング ブート" #Coral {
    [Facturation (Stripe)]
    [Analytics Avancées]
    [Rapports Mensuels]
    [Quotas & Limites]
    [Webhooks Stripe]
  }

  cloud "外部サービス" {
    [Stripe API]
    [SendGrid Email]
  }

  database "PostgreSQL 共有" as db

  frontend --> [Auth Multi-tenant]
  frontend --> [Profils Utilisateurs]
  frontend --> [Données Simples]
  frontend --> [Facturation (Stripe)]
  frontend --> [Analytics Avancées]

  [Auth Multi-tenant] --> db
  [Profils Utilisateurs] --> db
  [Données Simples] --> db

  [Facturation (Stripe)] --> db
  [Facturation (Stripe)] --> [Stripe API]
  [Analytics Avancées] --> db
  [Rapports Mensuels] --> db
  [Rapports Mensuels] --> [SendGrid Email]
  [Webhooks Stripe] ..> [Stripe API] : Écoute
}

note right of "スプリング ブート"
  **Nécessaire pour :**
  • Gestion abonnements
  • Facturation récurrente
  • Quotas dynamiques
  • Analytics complexes
  • Webhooks fiables
end note
@enduml

判決: ハイブリッドアーキテクチャが必要です。Supabase は基本部分に、Spring Boot はクリティカルな部分(支払い、請求)に使用します。

Eコマース

@startuml
skinparam backgroundColor #FEFEFE
skinparam componentStyle rectangle

package "Eコマース - 70% Spring Boot" {
  component "ストアフロント(JBake/React)" as frontend #SkyBlue

  package "Supabase" #LightGreen {
    [Auth Clients]
    [Catalogue Produits\n(lecture seule)]
    [Images Produits]
  }

  package "Spring Boot (コアビジネス)" #Coral {
    [Gestion Commandes]
    [Paiements Stripe]
    [Gestion Stock]
    [Calcul Frais Port]
    [Génération Factures]
    [Synchronisation ERP]
    [Emails Transactionnels]
  }

  cloud "統合" {
    [Stripe]
    [Transporteur API]
    [ERP Externe]
  }

  database "PostgreSQL" as db

  frontend --> [Auth Clients]
  frontend --> [Catalogue Produits\n(lecture seule)]
  frontend --> [Gestion Commandes]

  [Auth Clients] --> db
  [Catalogue Produits\n(lecture seule)] --> db

  [Gestion Commandes] --> db
  [Paiements Stripe] --> [Stripe]
  [Gestion Stock] --> db
  [Calcul Frais Port] --> [Transporteur API]
  [Génération Factures] --> db
  [Synchronisation ERP] --> [ERP Externe]
  [Synchronisation ERP] --> db
}

note right of "Spring Boot (コアビジネス)"
  **Spring Boot indispensable :**
  • Transactions critiques
  • Orchestration complexe
  • Intégrations multiples
  • Conformité légale
  • Jobs de synchronisation
end note
@enduml

判決Spring Bootは不可欠です。Supabaseは認証とカタログのみに使用します。

段階的移行戦略

@startuml
skinparam backgroundColor #FEFEFE

|Semaine 1-2|
start
:Créer projet Supabase;
:Configurer Auth (Google, GitHub);
:Définir schéma PostgreSQL initial;
:Implémenter CRUD de base sur JBake;
:Déployer MVP sur GitHub Pages;
note right
  **Livrable :** Application fonctionnelle
  **Coût :** 0€
  **Temps :** 1-2 semaines
end note

|Semaine 3-4|
:Observer utilisation réelle;
:Identifier limitations;

|Décision|
if (Logique complexe\némerge ?) then (non)
  |Supabase|
  :Continuer avec Supabase seul;
  :Ajouter Edge Functions si besoin;
  stop
else (oui)
  |Spring Boot|
  :Créer projet Spring Boot;
  :Configurer validation JWT Supabase;
  :Migrer logique complexe vers Spring Boot;
  note right
    **Migration sélective**
    Seulement ce qui est complexe
  end note
endif

|Semaines suivantes|
:Déployer Spring Boot (Cloud Run, EC2);
:Connecter à PostgreSQL Supabase;
:Implémenter premiers jobs planifiés;
:Intégrer APIs tierces;

stop

note right
  **Architecture finale hybride**
  Supabase + Spring Boot
  en parfaite harmonie
end note
@enduml

コストと運営上の考慮事項

コスト構造

@startuml
skinparam backgroundColor #FEFEFE

package "月次推定コスト" {

  rectangle "MVPフェーズ
(0-1000 ユーザー)" #LightGreen {
    [JBake (GitHub Pages): 0€]
    [Supabase: 0€]
    [Spring Boot: N/A]
    note bottom: **Total: 0€/mois**
  }

  rectangle "成長フェーズ
(1k-10k ユーザー)" #LightYellow {
    [JBake (GitHub Pages): 0€]
    [Supabase: 0€]
    [Spring Boot (Cloud Run): 20-50€]
    [PostgreSQL (si séparé): 0-30€]
    note bottom: **Total: 20-80€/mois**
  }

  rectangle "フェーズ スケール\n(10k-100k ユーザー)" #LightCoral {
    [JBake (Netlify Pro): 19€]
    [Supabase Pro: 25€]
    [Spring Boot (instances multiples): 100-300€]
    [Redis Cache: 20-50€]
    [Monitoring: 20€]
    note bottom: **Total: 184-414€/mois**
  }
}

note right of "フェーズ スケール\n(10k-100k ユーザー)"
  À ce stade, les revenus
  justifient largement les coûts
end note
@enduml

オペレーションの責任

@startuml
skinparam backgroundColor #FEFEFE

package "誰が何を担当しているか?" {

  rectangle "Supabase によって管理されている (0 労力)" #LightGreen {
    [Authentification]
    [Base de données]
    [Backups automatiques]
    [Scaling automatique]
    [Monitoring DB]
    [Sécurité DB]
  }

  rectangle "GitHubによって管理されています(0の労力)" #SkyBlue {
    [Hébergement site statique]
    [HTTPS/SSL]
    [CDN global]
    [Déploiement automatique]
  }

  rectangle "Spring Boot を管理する" #LightCoral {
    [Déploiement application]
    [Monitoring APM]
    [Logs centralisés]
    [Scaling horizontal]
    [Mises à jour sécurité]
  }
}

note bottom of "Spring Boot を管理する"
  **Minimisable avec :**
  • Cloud Run (serverless)
  • Kubernetes (si nécessaire)
  • Services managés (RDS, etc.)
end note
@enduml

結論:完璧なバランス

Supabase + Spring Bootのハイブリッドアーキテクチャは妥協ではなく、これはシナジー.

覚えておくべき原則

@startmindmap
skinparam backgroundColor #FEFEFE
* Architecture\nHybride

** Commencer Simple
***_ MVP avec Supabase
***_ 0€ de coût initial
***_ Validation rapide

** Évoluer Intelligemment
***_ Ajouter Spring Boot\nsi nécessaire
***_ Migration progressive
***_ Pas de refonte totale

** Exploiter les Forces
***_ Supabase: Simplicité
***_ Spring Boot: Puissance
***_ PostgreSQL: Source unique

** Minimiser la Complexité
***_ Pas de synchronisation
***_ Pas de duplication
***_ Architecture claire

** Optimiser les Coûts
***_ Gratuit au départ
***_ Scaling progressif
***_ ROI évident

@endmindmap

このアーキテクチャを選ぶのはいつですか?

�✅ このアーキテクチャは理想的です、もし:

  • すぐに始めたい(MVPは日単位で、月単位ではない)

  • ビジネスの複雑さの増加を見越しています

  • 初期コストを最小限に抑えたい

  • PostgreSQL が好きで、単一の真実のソースが欲しい

  • あなたはKotlinとコルーチンをビジネスコードのために気に入っています

  • あなたは完全なベンダーロックインを避けたい

�❌ このアーキテクチャは適していない場合:

  • あなたのプロジェクトはシンプルで、そのまま保たれます (個人ブログ → Supabase 100% で十分)

  • あなたは既にマスターしているバックエンドスタックを持っています。

  • あなたは伝統的なモノリスを好みます

  • .NET、Python、またはその他のバックエンド言語が必要です。

最終的な概観

@startuml
skinparam backgroundColor #FEFEFE

package "完全なハイブリッドアーキテクチャ" {

  actor "ユーザー" as users

  rectangle "フロントエンド (静的)" #SkyBlue {
    [JBake / GitHub Pages]
    note right: Gratuit, CDN global
  }

  rectangle "シンプルバックエンド(Supabase)" #LightGreen {
    [Auth OAuth2]
    [CRUD APIs]
    [Storage]
    [Realtime]
    note right
      Gratuit jusqu'à 50k users
      Zéro configuration serveur
    end note
  }

  rectangle "業務バックエンド (スプリングブート)" #Coral {
    [Orchestration]
    [Jobs Planifiés]
    [Intégrations]
    [Transactions]
    note right
      Activé uniquement
      si nécessaire
    end note
  }

  database "PostgreSQL
唯一の真実のソース" as db #LightGray

  users --> [JBake / GitHub Pages]

  [JBake / GitHub Pages] --> [Auth OAuth2]
  [JBake / GitHub Pages] --> [CRUD APIs]
  [JBake / GitHub Pages] --> [Storage]
  [JBake / GitHub Pages] --> [Realtime]
  [JBake / GitHub Pages] --> [Orchestration]

  [Auth OAuth2] --> db
  [CRUD APIs] --> db
  [Orchestration] --> db
  [Jobs Planifiés] --> db
  [Intégrations] --> db
}

note bottom of db
  **Une seule base, deux consommateurs**
  • Supabase pour le simple
  • Spring Boot pour le complexe
  • Aucune synchronisation requise
end note

@enduml

両方の世界のベスト

このアーキテクチャは、あなたに与えます:

🚀 Supabaseの速度

  • 起動は時間単位、週単位ではない

  • 数回クリックでOAuth2認証

  • 自動生成されたREST API

  • ゼロ構成サーバー

💪 Spring Bootの力

  • Kotlin と コルーチン を使ったエレガントな非同期コード

  • 複雑な業務プロセスのオーケストレーション

  • 信頼できるスケジュールされたジョブ

  • ACIDトランザクションが保証されます

  • 完全なSpringエコシステム

💰 プログレッシブ経済

  • 0€開始および検証するために

  • 成長に従うコスト

  • 時期尚早な過剰設計なし

🎯 建築の柔軟性

  • 段階的な移行、リフォームなし

  • Spring Boot は必要な場合のみ追加する

  • 総ベンダーロックインはありません

  • 進化的アーキテクチャ

さらに進む

技術的リソース

Supabase ドキュメント :

Spring Boot ドキュメント :

補足記事 :

  • JWTを使用したAPIセキュリティ

  • PostgreSQLのパフォーマンス最適化

  • 段階的な移行パターン

  • 分散アーキテクチャにおけるエラー管理

実際のユースケース

このハイブリッドアーキテクチャは、以下で成功裏に使用されています :

  • SaaS B2B: Supabase認証, Spring Boot 請求

  • マーケットプレイス: Supabaseカタログ, Spring Bootのトランザクション

  • コンテンツプラットフォーム: Supabase記事, Spring Bootアナリティクス

  • 内部ツール: CRUD Supabase, ワークフロー Spring Boot

スタートアップチェックリスト

フェーズ 1 - 基礎 (第1週)

  • Supabaseアカウントを作成 - [ ] PostgreSQL プロジェクトを設定する - [ ] 認証を有効にする (Google, GitHub) - [ ] 初期スキーマを定義 - [ ] Row Level Security を設定する - [ ] JBakeからAPIをテストする

フェーズ2 - MVP (第2-3週)

  • 主要ページを実装する - [ ] OAuth2認証を統合する - [ ] CRUDフォームの作成 - [ ] ファイル用のストレージを設定 - [ ] GitHub Pagesにデプロイ - [ ] 実際の条件でテストする

フェーズ3 - 進化(ニーズに応じて)

  • 複雑なロジックのニーズを特定 - [ ] 必要に応じて Spring Boot プロジェクトを作成 - [ ] スーパーベースのJWTバリデーションを設定する - [ ] Supabase PostgreSQLに接続 - [ ] 複雑な機能を移行する - [ ] スケジュールされたジョブを実装する - [ ] Spring Boot をデプロイ (Cloud Run など)

避けるべきアンチパターン

❌ しないで :

  • SupabaseとSpring Boot間でデータを複製する

  • PostgreSQLの別々のデータベース2つを作成

  • 自分で認証をコードしてください

  • Spring Bootを使ってシンプルなCRUDを実装する

  • 最初からオーバーアーキテクトする

  • SupabaseのRow Level Securityを無視

むしろやる:

  • 単一のPostgreSQLデータベースを共有する

  • Supabase に認証を任せる

  • Spring Bootを複雑さのためだけに使用する

  • シンプルに始めて、徐々に進化させる

  • 各テクノロジーの強みを活用する

  • データベースレベルのRLSで保護する

進化の展望

新しい機能の追加

@startuml
skinparam backgroundColor #FEFEFE

rectangle "現在のアーキテクチャ" #SkyBlue {
  [JBake]
  [Supabase]
  [Spring Boot]
}

rectangle "可能な進化" #LightYellow {

  package "パフォーマンス" {
    [Redis Cache]
    [CDN pour Assets]
    [PostgreSQL Replicas]
  }

  package "モニタリング" {
    [Grafana]
    [Prometheus]
    [Sentry]
  }

  package "CI/CD" {
    [GitHub Actions]
    [Tests Automatisés]
    [Déploiement Continu]
  }

  package "機能" {
    [Search (ElasticSearch)]
    [Queue (RabbitMQ)]
    [Event Sourcing]
  }
}

[Spring Boot] .down.> [Redis Cache] : Peut ajouter
[Spring Boot] .down.> [Queue (RabbitMQ)] : Peut ajouter
[Spring Boot] .down.> [Search (ElasticSearch)] : Peut ajouter

[Supabase] .down.> [PostgreSQL Replicas] : Peut ajouter

note bottom
  **Architecture extensible**
  Chaque ajout est indépendant
  Pas de refonte globale nécessaire
end note
@enduml

水平スケーリング

アプリケーションが成長すると、ハイブリッドアーキテクチャは自然にスケールします:

Supabase:

  • 自動的に何百万回もの操作にスケールします

  • 読み取りレプリカ(読み取りパフォーマンス用)

  • セキュリティのためのポイントインタイムリカバリ

Spring Boot:

  • ロードバランサーの背後に複数のインスタンス

  • ステートレス設計は水平スケーリングを容易にする

  • 必要に応じて、Kubernetesをオーケストレーションに使用する

PostgreSQL:

  • 大規模なテーブル用のパーティショニング

  • 接続プール (PgBouncer)

  • シャーディングは本当に必要です(稀)。

建築的証言

スタートアップ SaaS (50k ユーザー)

_ 私たちはSupabaseで100%スタートしました。5kユーザーに到達したとき、Stripeの請求と月次レポートのためだけにSpring Bootを追加しました。1年後、私たちの操作の80%はまだSupabaseを経由しています。Spring Bootはクリティカルな部分のみを管理します。この分離により、リファクタリングを行わずにスケールすることができました。 _

Eラーニングプラットフォーム (10k ユーザー)

_ SupabaseのOAuth2認証により、開発に3週間の時間を節約できました。自動生成されたAPIが、コースカタログ全体を管理しています。Spring BootはPDF証明書と進捗メールにのみ使用されています。シンプルで保守性が高く、拡張性のあるアーキテクチャです。 _

B2Bマーケットプレイス(3kユーザー)

_ Spring Bootは、買い手と売り手の間のトランザクションを管理します(重要)。Supabaseは、残りのすべてを管理します:プロフィール、リアルタイムメッセージング、ドキュメント。同じPostgreSQLデータベースを共有しているため、複雑な同期を避けることができます。これは、私たちがこれまでに行った中で最高のアーキテクチャ選択です。 _

要約:モダンな建築パラダイム

Supabase と Spring Boot を組み合わせたハイブリッド アーキテクチャは、新しいパラダイムを示しています:建築分野の専門化。

@startuml
skinparam backgroundColor #FEFEFE

rectangle "古いパラダイム" #LightCoral {
  card "バックエンドの中のすべて" {
    [Auth]
    [CRUD]
    [Logique Métier]
    [Jobs]
    [Storage]
    [Realtime]
  }
  note bottom
    Complexité maximale
    dès le jour 1
  end note
}

rectangle "新しいパラダイム" #LightGreen {
  card "Supabase
(便利)" {
    [Auth]
    [CRUD Simple]
    [Storage]
    [Realtime]
  }

  card "Spring Boot
(差別化)" {
    [Logique Métier]
    [Jobs]
    [Intégrations]
  }

  note bottom
    Complexité progressive
    ajoutée seulement si nécessaire
  end note
}

[Ancien Paradigme] -right-> [Nouveau Paradigme] : Évolution

@enduml

基本原理 :既にサービスとして存在するものを構築しないでください。あなたのアプリケーションを差別化する点に集中してください。

80/20の法則

ほとんどのアプリケーションでは:

  • 80% の操作標準のCRUDです → Supabase

  • 20% の操作ビジネスロジックが必要です → Spring Boot

この自然なルールはハイブリッドアーキテクチャを正当化します。

@startuml
skinparam backgroundColor #FEFEFE

package "作業の配分" {

  rectangle "80% - 標準操作" #LightGreen {
    [Lecture de données]
    [Création d'entités]
    [Mise à jour simple]
    [Suppression]
    [Upload fichiers]
    [Authentification]

    note bottom: **Géré par Supabase**
  }

  rectangle "20% - ビジネスロジック" #Coral {
    [Calculs complexes]
    [Workflows multi-étapes]
    [Transactions critiques]
    [Intégrations tierces]
    [Jobs planifiés]

    note bottom: **Géré par Spring Boot**
  }
}

note right
  **Focus optimal :**
  Votre temps de développement
  concentré sur les 20% qui
  différencient votre produit
end note
@enduml

最終結論

ハイブリッドアーキテクチャは技術的な妥協ではありません。それは戦略的決定。

したがって、あなたは以下のことができます:

  • ✅ 機能的なMVPで素早く始める

  • �✅ 市場を検証する 重大な投資なしで

  • 複雑さが求められるときに段階的に進化する

  • 各段階でコストを管理する

  • 各テクノロジーのベストを活用する

  • �✅ 過早なオーバーエンジニアリングを避ける

  • �✅ 将来のために柔軟性を保つ

彼女が表す:

  • 🎯実用主義彼女が得意とするすべての技術

  • 🚀速度: 最小のタイム・トゥ・マーケット

  • 💰経済価値に合わせたコスト

  • �🔮拡張性: アーキテクチャはあなたと共に成長します

  • �🛡️堅牢性実績のある信頼できるサービス

あなたの次のステップ

このアーキテクチャがあなたに響くなら、ここで始める場所はこちらです:

  1. Supabaseアカウントを作成してください(無料)

  2. 最小限のデータスキーマを定義してください

  3. OAuth2認証を設定してください

  4. 最初のJBakeページを作成し、APIを消費する

  5. GitHub Pagesにデプロイしてください

機能するMVPが手に入ります数日.

Spring Boot は必要になったとき自然にやってきます。それより前ではない。


ハイブリッドアーキテクチャとは、必要なものを必要なときに正確に構築することである。

良い開発を! 🚀


この記事を、他の開発者が適切なアーキテクチャの選択をするのに役立つと思う場合はシェアしてください。

関連記事