This document outlines the architectural decisions, networking flow, and security principles driving the KyleHub platform.
The infrastructure is split into two security zones connected by secure tunnels:
| Zone | Location | Purpose |
|---|---|---|
| Gateway | Cloud VPS (Hetzner) | Public ingress, authentication, reverse proxy |
| Homelab | Private Network | Compute, storage, AI workloads, private services |
graph TD
subgraph "Internet"
User((User))
Cloudflare[Cloudflare DNS/Proxy]
end
subgraph "Gateway VPS"
Traefik[Traefik v3]
Pangolin[Pangolin Server]
Zitadel[Zitadel IAM]
Gerbil[Gerbil WireGuard]
end
subgraph "Homelab Network"
DreamMachine[DreamMachine Pro]
AdGuard[AdGuard Home]
Proxmox[Proxmox VE]
NEWT[NEWT Agent]
Services[Services: Langfuse, etc.]
end
User -->|HTTPS :443| Cloudflare
Cloudflare -->|HTTPS| Traefik
Traefik -->|Route| Pangolin
Pangolin -->|Auth| Zitadel
Pangolin -->|Tunnel Config| Gerbil
NEWT -.->|WireGuard Tunnel| Gerbil
NEWT --> Services
Services --> Proxmox
DreamMachine --> AdGuard
DreamMachine --> Proxmox
The homelab maintains zero open ports on the router/firewall. All ingress traffic:
- Enters through the VPS (ports 80/443)
- Routes through Traefik → Pangolin
- Traverses the WireGuard tunnel to NEWT
- Reaches the target service internally
This eliminates the need for DDNS, port forwarding, or exposing the home IP.
| Component | Role | IP/Network |
|---|---|---|
| UniFi DreamMachine Pro | Router/Firewall | Gateway for all networks |
| AdGuard Home | DNS + Ad blocking | Container on Proxmox |
| Proxmox VE | Hypervisor | Hosts all VMs/LXCs |
| NEWT Agent | Tunnel client | Connects to VPS |
| Component | Role | Ports |
|---|---|---|
| Gerbil | WireGuard server | 51820/udp, 21820/udp |
| Traefik | Edge router | 80, 443 |
| Pangolin | Zero Trust proxy | Internal: 3000-3002 |
| Zitadel | Identity provider | Internal: 8080 |
For applications with built-in authentication (using Identity Kit):
User → Cloudflare → Traefik → Pangolin → NEWT Tunnel → App
↓
App validates
token with Zitadel
- Pangolin acts as a pure tunnel/load balancer
- App handles its own OIDC flow with Zitadel
- No double authentication
For tools without native SSO (Proxmox, Portainer, legacy apps):
User → Cloudflare → Traefik → Pangolin → Zitadel Auth Check
↓
If Authenticated
↓
NEWT Tunnel → App
- Pangolin enforces authentication before allowing access
- User must log in via Zitadel OIDC
- Zero Trust access to internal tools
| Feature | Implementation |
|---|---|
| Protocol | OIDC (OpenID Connect) |
| Location | VPS (high availability) |
| Organization | KHOps (management org) |
| Project | KyleHub |
| Application | KyleHub-Auth |
Two-layer role system for flexible access control:
| Type | Examples | Purpose |
|---|---|---|
| Category Roles | admin, homelab, media, dev |
Grant access to service categories |
| Service Roles | access_grafana, access_proxmox |
Grant access to specific services |
- Pangolin: Uses Zitadel for auth gateway (Pattern B)
- Custom Apps: Use Identity Kit for OIDC
- Proxmox: Direct OIDC integration (optional)
- Grafana/Portainer: Native OIDC support
When exposing a new service through Pangolin:
- Create Site → Logical grouping (e.g., "Homelab Services")
- Add NEWT Agent → Connects homelab to VPS tunnel
- Create Resource → Define subdomain, target IP/port
- Configure Auth → Enable Zitadel protection if needed
- DNS Auto-Config → Pangolin manages Cloudflare DNS
sequenceDiagram
participant Admin
participant Pangolin Dashboard
participant Traefik
participant Cloudflare
participant NEWT Agent
participant Service
Admin->>Pangolin Dashboard: Create Resource
Pangolin Dashboard->>Cloudflare: Create DNS Record
Pangolin Dashboard->>Traefik: Update Routing
Pangolin Dashboard->>NEWT Agent: Configure Tunnel
Note over Traefik,Service: Traffic flows through tunnel
The repository supports partial deployment:
# VPS: Only pulls gateway-vps/
git sparse-checkout set gateway-vps
# Homelab: Only pulls homelab-core/
git sparse-checkout set homelab-coreBenefits:
- Secrets stay isolated per environment
- Smaller deployments
- Clear separation of concerns
.env.example → .env → init_config.sh → config.yml
↓
docker compose up
↓
Post-deploy config in Pangolin Dashboard
| Feature | Status | Notes |
|---|---|---|
| AdGuard Home integration | Planned | Network-wide DNS/ad blocking |
| Additional NEWT sites | Planned | Multi-location homelab support |
| Backup automation | Planned | Automated volume backups |
| Monitoring stack | Future | Grafana, Prometheus, Loki |
| AI/LLM infrastructure | In Progress | Langfuse, Ollama, etc. |
- Zero Trust: Every request is authenticated, even internal
- Defense in Depth: Multiple layers (Cloudflare → Firewall → Pangolin → App)
- Least Privilege: Role-based access with minimal permissions
- Encrypted Transit: All traffic over HTTPS or WireGuard
- Secret Management: Environment variables, not committed to git
Last Updated: January 2026