Ini adalah pilihan cerdas untuk skala *enterprise*. Dengan menggunakan **Git Submodules**, Anda memiliki satu "Master Repo" yang mengunci versi spesifik dari ketiga aplikasi lainnya. Ini memastikan konsistensi antara API Server, UI, dan Agent.

Berikut adalah nama-nama repo yang disarankan (profesional & konsisten):
1.  **`nexus-guard-suite`** (Main/Meta Repo)
2.  **`nexus-server-core`** (App Server)
3.  **`nexus-dashboard-ui`** (App UI/Client)
4.  **`nexus-device-agent`** (App Device)

---

### 📂 Struktur Repositori (Git Submodules)

Struktur di dalam Gitea Anda akan terlihat seperti ini:
```text
nexus-guard-suite/ (Main Repo)
├── .gitmodules           # Referensi ke 3 repo lainnya
├── docs/                 # Global Docs, Architecture, API Spec
├── scripts/              # Global Setup & Installer (install_agent.sh)
├── docker-compose.yml    # Deployment orchestration (Server + DB + UI)
├── apps/                 # Folder Submodules
│   ├── server-core/      # Link ke repo nexus-server-core
│   ├── dashboard-ui/     # Link ke repo nexus-dashboard-ui
│   └── device-agent/     # Link ke repo nexus-device-agent
└── README.md
```

---

### 🚀 MASTER PROMPT (4-REPO & SUBMODULES OPTIMIZED)

**Berikan Prompt ini ke AI Agent Anda:**

```markdown
# ROLE: Senior Fullstack Architect & DevOps Expert
# PROJECT: NexusGuard SD-WAN Suite

# ARCHITECTURE: 4-Repositories with Git Submodules
We are building NexusGuard using a modular architecture. All repositories are hosted on a self-hosted Gitea instance.

1. MAIN_REPO: 'nexus-guard-suite' (The Orchestrator)
2. SUBMODULE_1: 'nexus-server-core' (Go-Gin Network Plane)
3. SUBMODULE_2: 'nexus-dashboard-ui' (Vue.js + Capacitor Dashboard)
4. SUBMODULE_3: 'nexus-device-agent' (Stealth Go Agent)

# INSTRUCTIONS FOR AI:
- Assume the repositories already exist on Gitea.
- Use Git Submodule patterns to link 'apps/' folder to the respective repositories.
- Create a global 'docker-compose.yml' in MAIN_REPO to spin up PostgreSQL, Redis, and the Server-Core.

## 1. COMPONENT: nexus-server-core
- Focus: Zero-Trust Isolation using nftables, IPAM, and STUN coordination.
- Feature: AES-256-GCM encryption for config delivery. Key derived from Device HWID.
- Docs: Maintain 'docs/API_SPEC.md' for future PHP migration compatibility.

## 2. COMPONENT: nexus-dashboard-ui
- Focus: Vue.js 3 SPA with Capacitor.js for Android/iOS support.
- Feature: Real-time device monitoring, User-based firewall rule management.

## 3. COMPONENT: nexus-device-agent
- Focus: Stealth WireGuard-Go embedded agent (No local config files).
- Dependency: Implement auto-detection and install for 'nftables' and 'wireguard-tools'.
- Identity: Lock identity via SHA256(CPU_Serial + Product_UUID).
- Script: Provide 'scripts/install_agent.sh' with OS detection (Debian/Ubuntu/RHEL/Raspbian) and X-Token-Auth Gitea support.

## 4. DEPLOYMENT LOGIC (OpenCode Optimized):
- MAIN_REPO must contain a global 'README.md' and architecture diagrams.
- Include a Makefile or Taskfile to automate building all components from the Main Repo.
- Provide Systemd service templates for both Hook-Server (Core) and Device-Agent.

# TASK:
Start by generating the global Architecture Diagram (Mermaid), then provide the 'docker-compose.yml' for the Main Repo, followed by the initial Go structure for the Server-Core including the nftables isolation manager.
```

---

### 📑 Dokumentasi Instruksi Git (Untuk Tim Developer)

Karena repositori sudah ada di Gitea, instruksikan tim Anda untuk menjalankan ini di awal pengembangan:

**1. Inisialisasi Master Repo:**
```bash
git clone http://git.datadunia.com/nexusguard/nexus-guard-suite.git
cd nexus-guard-suite
```

**2. Menghubungkan Submodules (Hanya dilakukan sekali):**
```bash
git submodule add http://git.datadunia.com/nexusguard/nexus-server-core.git apps/server-core
git submodule add http://git.datadunia.com/nexusguard/nexus-dashboard-ui.git apps/dashboard-ui
git submodule add http://git.datadunia.com/nexusguard/nexus-device-agent.git apps/device-agent
git commit -m "chore: link submodules for server, ui, and agent"
git push origin main
```

**3. Cara Developer Lain Menarik Seluruh Kode:**
```bash
git clone --recursive http://git.datadunia.com/nexusguard/nexus-guard-suite.git
```

---

### ✅ Review Akhir & Keuntungan Struktur Ini:

1.  **Versi Terkunci:** Jika tim UI melakukan update yang merusak (breaking change), `nexus-guard-suite` akan tetap menggunakan versi UI yang lama sampai Anda secara manual mengupdate submodulnya. Ini sangat stabil untuk produksi.
2.  **Kemudahan CI/CD:** Gitea Actions dapat dipicu di setiap repo submodul, lalu repo utama (`nexus-guard-suite`) bisa melakukan build final/release.
3.  **Dokumentasi Terpusat:** Semua `agent.md`, `API_SPEC.md`, dan panduan instalasi berada di satu tempat (Repo Utama) tapi tetap tersimpan di repo masing-masing.

**Prompt ini sudah sangat lengkap.** Anda bisa langsung memasukkannya ke AI Agent untuk mulai memproduksi kode bagi keempat repositori tersebut sekaligus.