読了時間 : 12 minutes

SupabaseのシンプルさとSpring Bootのパワーの間で選ぶのではなく、両方を組み合わせてみませんか?各テクノロジーの長所を活かしたハイブリッドアーキテクチャを見つけてください。

コンコン

[]

現代建築の偽ジレンマ

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

  • バックエンド・アズ・ア・サービスソリューションにすべてを賭ける(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 "PostgreSQL" as db #LightGray {
  package "スキーマ: auth (Supabase)" #LightGreen {
    [users]
    [sessions]
    [identities]
  }

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

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

component "サプベース" 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

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

フラックスのオーケストレーション

フラックス 1 : 中央集中型認証

@startuml
skinparam backgroundColor #FEFEFE
autonumber

actor "ユーザー" as user
participant "JBake" as jbake
participant "Supabase Auth" as auth
participant "スプリングブート" 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 "スケジューラー\n(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 "スパベース" #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 "サプベース" #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 "成長フェーズ\n(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 "フェーズスケール
(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 "フェーズスケール
(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 "ビジネスバックエンド (Spring Boot)" #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 の分析

  • 内部ツールSupabaseのCRUD、Spring Bootのワークフロー

起動チェックリスト

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

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

Phase 2 - MVP (第2-3週)

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

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

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

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

�❌ しないでください:

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

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

  • 認証を自分でコードする

  • Spring Boot を使用してシンプルな CRUD を行う

  • 開始からオーバーアーキテクチャーする

  • SupabaseのRow Level Securityを無視

✅ むしろする :

  • 1つの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 ユーザー)

_ 私たちは100% Supabaseで始めました。 5,000ユーザーに達したとき、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. APIを消費する最初のJBakeページを作成してください

  5. GitHub Pagesにデプロイ

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

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


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

良い開発を! 🚀


この記事を共有して、他の開発者が正しいアーキテクチャの選択をできるように手助けすると思う場合は。

関連記事