{
  "meta": {
    "owner": "mai",
    "description": "Posimai 開発インフラ構成",
    "updated": "2026-04-10",
    "version": "3"
  },
  "nodes": [
    {
      "id": "ubuntu-pc",
      "label": "Ubuntu PC",
      "type": "device",
      "description": "常時起動の開発サーバー（実体）。posimai-dev・Claude Code 稼働中。Tailscale HTTPS でどこからでもアクセス可能。Syncthing でファイル同期。Synology NAS へ毎日 3:00 に rsync バックアップ。",
      "url": "https://100.77.11.43:3333",
      "health_url": "https://100.77.11.43:3333/api/health",
      "status": "active"
    },
    {
      "id": "posimai-dev",
      "label": "posimai-dev",
      "type": "service",
      "description": "ブラウザターミナル + Claude Code チャット。Ubuntu PC 上で常時稼働。音声入力・スラッシュコマンド・セッションログ対応。Station（全画面監視盤）も同一サーバーから提供。",
      "url": "https://100.77.11.43:3333",
      "health_url": "https://100.77.11.43:3333/api/health",
      "status": "active",
      "parent": "ubuntu-pc"
    },
    {
      "id": "windows-pc",
      "label": "Windows PC",
      "type": "device",
      "description": "maiさんのメイン操作端末。Cursor / Claude Code / ブラウザで Ubuntu PC に接続して開発。Syncthing で posimai-project を同期。",
      "status": "active"
    },
    {
      "id": "android-phone",
      "label": "スマートフォン",
      "type": "device",
      "description": "PWA テスト・モバイル動作確認。Tailscale 経由で posimai-dev にアクセス。",
      "status": "active"
    },
    {
      "id": "synology",
      "label": "Synology NAS",
      "type": "device",
      "description": "ローカルバックアップサーバー（Tailscale VPN 経由のみアクセス可 / 100.76.7.3）。Gitea・Uptime Kuma をホスト。Ubuntu PC の rsync バックアップ受け先（毎日 3:00）。旧 API・旧 PostgreSQL も待機中（フォールバック候補）。",
      "status": "active"
    },
    {
      "id": "gitea",
      "label": "Gitea",
      "type": "service",
      "description": "ローカル Git バックアップ。Synology 上で Docker 動作（100.76.7.3:3000）。全リポジトリのバックアップ用リモート。",
      "url": "http://100.76.7.3:3000",
      "status": "active",
      "parent": "synology"
    },
    {
      "id": "uptime-kuma",
      "label": "Uptime Kuma",
      "type": "service",
      "description": "死活監視ダッシュボード。Synology 上で Docker 動作（100.76.7.3:3001）。VPS・Ubuntu PC・各アプリの稼働状況を監視。※ 将来 VPS に移設予定（Eiji 提案）。",
      "url": "http://100.76.7.3:3001",
      "status": "active",
      "parent": "synology"
    },
    {
      "id": "tailscale",
      "label": "Tailscale",
      "type": "network",
      "description": "デバイス間 VPN メッシュ。Ubuntu PC・Windows PC・スマートフォン・Synology を安全に接続。tailnet: tail72e846.ts.net。VPS は公開 IP で直接アクセスするため不要。",
      "status": "active"
    },
    {
      "id": "vps-xserver",
      "label": "VPS",
      "type": "server",
      "description": "Posimai API 本番サーバー。共同開発者 Eiji 提供・管理（DNS 含む）。Ubuntu 25.04 / AMD EPYC 4コア / 5.8GB RAM / IP: 85.131.245.239。Nginx + Docker 構成。",
      "url": "https://api.soar-enrich.com",
      "health_url": "https://api.soar-enrich.com/brain/api/health",
      "status": "active"
    },
    {
      "id": "posimai-api",
      "label": "Posimai API",
      "type": "service",
      "description": "Node.js / Express（:8090）。認証（Magic Link + WebAuthn + Google OAuth + GitHub OAuth）・記事・RSS・TTS・Journal API を提供。PostgreSQL 16 と接続。Stripe Webhook も受信。",
      "url": "https://api.soar-enrich.com/brain/api",
      "status": "active",
      "parent": "vps-xserver"
    },
    {
      "id": "postgresql",
      "label": "PostgreSQL 16",
      "type": "service",
      "description": "VPS 本番 DB。articles / journal_posts / users / auth_sessions / site_config / reading_history / habit_habits / habit_log / pulse_log / lens_history / together_groups / together_members / together_shares / together_reactions / together_comments テーブル。users に plan（free/premium）・Stripe ID 管理。Supabase からの Together 完全移行済み（2026-04-06）。",
      "status": "active",
      "parent": "vps-xserver"
    },
    {
      "id": "gemini",
      "label": "Gemini API",
      "type": "cloud",
      "description": "Google Gemini 2.5 Flash。VPS 経由のみ利用。Brain 記事の AI 要約生成・Journal タグ提案・Together 投稿要約に使用。モデル固定: gemini-2.5-flash。",
      "status": "active"
    },
    {
      "id": "github",
      "label": "GitHub",
      "type": "cloud",
      "description": "ソースコード管理（posimai org）。push で Vercel 自動デプロイをトリガー。git push は gitea + github の2リモート同時に行う。",
      "url": "https://github.com/posimai",
      "status": "active"
    },
    {
      "id": "vercel",
      "label": "Vercel",
      "type": "cloud",
      "description": "全 posimai-* PWA のホスティング・CDN・自動デプロイ。27 本稼働中。GitHub push でトリガー。",
      "url": "https://vercel.com",
      "status": "active"
    },
    {
      "id": "posimai-apps",
      "label": "Posimai Apps (27)",
      "type": "app",
      "description": "brain / habit / pulse / feed / reader / journal / brief / daily / ambient / veil / lens / diff / clean / timer / digest / think / site / events / maps / tech-events / analytics / roadmap / together / atlas / dashboard / hotels など全 27 本。VPS JWT で認証。",
      "url": "https://posimai-dashboard.vercel.app",
      "status": "active",
      "parent": "vercel"
    },
    {
      "id": "resend",
      "label": "Resend",
      "type": "cloud",
      "description": "Magic Link メール送信のみ利用。noreply@soar-enrich.com から配信。",
      "status": "active"
    },
    {
      "id": "stripe",
      "label": "Stripe",
      "type": "cloud",
      "description": "決済処理。共同開発者 Eiji と共有アカウント。現在テストモードで稼働中（月額 ¥500 / 1日無料トライアル）。Webhook で決済完了を VPS に通知し plan カラムを premium に更新。本番モードへの切り替えは Eiji 確認後。",
      "url": "https://stripe.com",
      "status": "active"
    },
    {
      "id": "google-oauth",
      "label": "Google OAuth",
      "type": "cloud",
      "description": "Google アカウントでのログイン。Google Cloud Console「Posimai App」プロジェクトで発行。VPS の /auth/oauth/google エンドポイントで処理。",
      "status": "active"
    },
    {
      "id": "github-oauth",
      "label": "GitHub OAuth",
      "type": "cloud",
      "description": "GitHub アカウントでのログイン。GitHub OAuth App で発行。VPS の /auth/oauth/github エンドポイントで処理。",
      "status": "active"
    },
    {
      "id": "posimai-store",
      "label": "Posimai Store",
      "type": "app",
      "description": "Posimaiアプリ販売 LP。買い切り ¥500 モデル。Design A/B/C/D の4バリアント実装済み（Eiji と検討中）。Stripe Payment Link で決済。",
      "url": "https://posimai-store.vercel.app",
      "status": "active",
      "parent": "vercel"
    }
  ],
  "edges": [
    { "from": "windows-pc",       "to": "tailscale",       "type": "connects", "label": "VPN" },
    { "from": "ubuntu-pc",        "to": "tailscale",       "type": "connects", "label": "VPN" },
    { "from": "android-phone",    "to": "tailscale",       "type": "connects", "label": "VPN" },
    { "from": "synology",         "to": "tailscale",       "type": "connects", "label": "VPN" },

    { "from": "windows-pc",       "to": "ubuntu-pc",       "type": "connects", "label": "SSH / posimai-dev" },
    { "from": "android-phone",    "to": "posimai-dev",     "type": "connects", "label": "Tailscale HTTPS" },

    { "from": "posimai-dev",      "to": "ubuntu-pc",       "type": "runs-on" },
    { "from": "gitea",            "to": "synology",        "type": "runs-on" },
    { "from": "uptime-kuma",      "to": "synology",        "type": "runs-on" },

    { "from": "ubuntu-pc",        "to": "gitea",           "type": "push",    "label": "git push" },
    { "from": "ubuntu-pc",        "to": "github",          "type": "push",    "label": "git push" },
    { "from": "windows-pc",       "to": "gitea",           "type": "push",    "label": "git push" },
    { "from": "windows-pc",       "to": "github",          "type": "push",    "label": "git push" },
    { "from": "ubuntu-pc",        "to": "synology",        "type": "connects","label": "rsync backup" },

    { "from": "github",           "to": "vercel",          "type": "trigger", "label": "auto deploy" },
    { "from": "vercel",           "to": "posimai-apps",    "type": "hosts" },
    { "from": "vercel",           "to": "posimai-store",   "type": "hosts" },

    { "from": "posimai-api",      "to": "vps-xserver",     "type": "runs-on", "label": "Docker" },
    { "from": "postgresql",       "to": "vps-xserver",     "type": "runs-on" },
    { "from": "posimai-api",      "to": "postgresql",      "type": "calls",   "label": "SQL" },
    { "from": "posimai-api",      "to": "resend",          "type": "calls",   "label": "Magic Link メール" },
    { "from": "posimai-api",      "to": "google-oauth",    "type": "calls",   "label": "OAuth認証" },
    { "from": "posimai-api",      "to": "github-oauth",    "type": "calls",   "label": "OAuth認証" },

    { "from": "stripe",           "to": "posimai-api",     "type": "calls",   "label": "Webhook (決済完了)" },
    { "from": "posimai-store",    "to": "stripe",          "type": "calls",   "label": "Payment Link" },
    { "from": "posimai-apps",     "to": "posimai-api",     "type": "calls",   "label": "REST API (JWT認証)" },
    { "from": "posimai-api",      "to": "gemini",          "type": "calls",   "label": "AI 要約" },

    { "from": "uptime-kuma",      "to": "vps-xserver",     "type": "monitors","label": "死活監視" },
    { "from": "uptime-kuma",      "to": "ubuntu-pc",       "type": "monitors","label": "死活監視" },
    { "from": "uptime-kuma",      "to": "posimai-apps",    "type": "monitors","label": "死活監視" },

    { "from": "windows-pc",       "to": "vps-xserver",     "type": "connects","label": "SSH (deploy)" }
  ]
}
