Projects · Mini Hostpapa

High-Level Architecture

The major systems of HostKid at executive level: physical infrastructure, application architecture, and business flows.

Updated Aug 2, 2026 · 15 min read

High-Level Architecture

Whiteboard time.

You already know why we picked the stack (Technical decisions). This page is how the boxes connect before you drown in VLANs and Helm charts.

Customer on the left. Metal on the right. Everything in between is HostKid.

Decisions first, diagrams second

If a box on this page surprises you, go back to Technical decisions & stack rationale. Architecture without the why is just clipart.

Living document

I'm building this page in three domains. You get the executive map now; we fill in each domain in passes. Firewall SKU, VLAN IDs, Helm values? Those land in the handbook volumes, not here.

The rule for this page

Boxes and arrows. No port numbers. If you can't explain it to a smart non-engineer over coffee, it's not executive-level yet.


Three domains: how to read this page

Hosting architecture isn't one diagram. It's three questions people keep mixing together:

DomainQuestion it answersStatus on this page
A. Physical & platform infrastructureWhere does it run? Rack, network zones, CloudStack layout?Starter footprint (below) + GitOps operations flow
B. Application & control-plane architectureWhat software talks to what? Where do trust boundaries sit?Scaffold (spine below gives you the shape)
C. Business & operational flowsWhat happens when someone pays, breaks something, or leaves?Scaffold (headline flows only for now)
Think of it like a building: Domain A is the foundation and power. Domain B is the wiring and apps inside. Domain C is how people actually move through the place when real life happens.

The spine: whole company in one flow

Memorize this vertical picture first. Every domain below is a zoom-in on part of this stack.

Preparing diagram

Always-on sidecars (they don't sit in the main column, but the company stops without them):


Domain A: Physical & platform infrastructure

This is the metal and the factory floor: colo rack, network zones, CloudStack on KVM, storage. Not "we own a Tier IV building." We rent serious space in Tunisia and own what happens inside our rack.

Real talk: you don't win hosting customers by flexing who poured the concrete. You win by owning what crosses your rack boundary with discipline.

Colocation: what the provider gives vs what we bring

Colocation (colo) means you rent rack space and connectivity inside someone else's datacenter. The provider runs the building. You run the design inside your rack.

PartyTypical responsibility
Colo providerBuilding, power feeds, cooling, physical security, carrier cross-connects, remote hands
HostKidServers, switches, firewall, cabling, IP plan, CloudStack topology, segmentation policy

HostKid starts in a Tier III/IV-class facility in Tunisia (Maghreb first zone). Tier is an industry label for how redundant power and cooling are. Tier IV is stricter than Tier III. You don't have to memorize the standard. You do have to read your contract: kW per rack, dual power feeds (A+B), and how many upstream carriers you get.

Preparing diagram

The rack: what is 42U?

A rack is a standard metal cabinet for mounting gear. U means rack unit (about 4.4 cm / 1.75 inches of vertical height). A common full-height cabinet is 42U: roughly 42 stacked "slots" for servers, switches, and patch panels.

Why it matters: every hardware purchase sheet says "2U server" or "1U switch". If you plan a starter cluster without counting U and power (kW), you arrive at the datacenter with boxes that don't fit or trip the breaker.

Loading media
Rows of server racks in a datacenter aisle with perforated doors and cable management.
Server racks in a colo floor. You rent space inside cabinets like these; you populate them with your gear.

Starter footprint (one 42U rack, conceptual):

Rack areaEquipmentQty (starter)
Network rowEdge firewall/router, top-of-rack (ToR) switch1 + 1
OOB (out-of-band)Small management switch for IPMI only1
Control planeCloudStack management servers2
ComputeKVM hypervisor hosts (libvirt/QEMU)3 to 4
StorageNFS storage server (primary + secondary exports)1
Preparing diagram
Honest starter caveat

One firewall and one ToR is common at launch. That is a single point of failure. Document it, monitor it, plan HA pairs as a sub-decision in Volume 5.


Network: zones you can draw before VLAN IDs

Top-of-rack (ToR) switch is the switch at the top (or middle) of your rack. It connects every server in the rack with short copper or fiber cables. Edge firewall sits between the internet uplink from colo and your internal zones.

Loading media
Network switch ports with many ethernet cables plugged in, green and orange link lights visible.
Top-of-rack switching: every server in the cabinet home-runs into this box. VLANs separate traffic logically on the same wires.
Loading media
Person working at a laptop with a holographic-style security lock overlay, representing network perimeter security.
Edge firewall: company perimeter. Customer VM firewalls are a different layer (CloudStack Virtual Router).

At executive level we name zones first. Numbered VLANs come in Volume 5.

ZonePlain EnglishWhat connects here
WAN / uplinkInternet from colo or carrierFirewall outside interface
Edge / DMZPublic ingress you controlLater: portal load balancer, authoritative DNS
ManagementOps and control trafficCloudStack UI/API path, hypervisor mgmt, IPMI
Guest / productionCustomer VM trafficHypervisor data NICs, CloudStack guest networks
StorageDisk traffic off the customer pathNFS/iSCSI between KVM hosts and storage box
OOBOut-of-band: lights-on when OS is deadIPMI/iDRAC on a switch with no route to internet
Preparing diagram
Two firewalls in your head: the physical edge (company perimeter) and CloudStack Virtual Router (customer VPC/isolated networks). Confusing them is how engineers argue for three days straight.

CloudStack on KVM: starter topology

Apache CloudStack is the IaaS control plane (decision record). KVM is the hypervisor on each compute host. Infra IT configures the platform catalog with Terraform GitOps; customers never get CloudStack admin write access.

Management servers run the CloudStack API, UI, and orchestration database. Run two for basic HA. They are not where customer VMs live.

Loading media
Technician working inside an open server chassis in a datacenter, installing or servicing hardware.
CloudStack management servers: brains of the IaaS plane. Small but critical; backup the database like your company depends on it, because it does.

Hypervisor hosts are the workhorses. Each runs KVM (via libvirt/QEMU). Customer VPS instances execute here.

Loading media
Server racks in a datacenter with multiple mounted machines, representing KVM hypervisor hosts in the compute tier.
KVM compute hosts: 2U/4U servers mounted in the rack. Customer VPS instances run on these boxes, orchestrated by CloudStack.

CloudStack vocabulary for the Maghreb starter zone:

ObjectStarter valueWhat it means
Zonetunisia-maghreb-1One geographic / legal footprint (Tunisia first)
Podtun-pod-1Hosts in the same facility row / rack group
Clusterkvm-prod-1Hypervisors sharing the same type (KVM) and storage pool
Hosts3 minimum, 4 nicerPhysical servers registered as CloudStack hypervisors
System VMsVR, SSVM, CPVMCloudStack platform VMs on the cluster, not separate metal
Preparing diagram

System VMs in plain English:

  • VR (Virtual Router): software router for guest networks (NAT, firewall rules, load balancing hooks).
  • SSVM (Secondary Storage VM): moves templates and snapshots on secondary storage.
  • CPVM (Console Proxy VM): customer console access through CloudStack.

Storage: primary vs secondary

CloudStack splits storage into two jobs. Confusing them breaks templates, snapshots, or live disks.

Loading media
Analytics dashboard charts on a screen, used here to represent storage capacity and performance monitoring.
Storage management: primary fills up and sales stop. Monitor capacity and IOPS before customers feel slowdowns.
TypeCloudStack roleStarter approach
Primary storageRunning VM disk volumesNFS export on dedicated storage server, storage VLAN
Secondary storageTemplates, ISO images, snapshot stagingSeparate NFS export (same box at tiny scale, split later)
Preparing diagram
Starter honesty: NFS on one well-built storage node is enough to launch VPS in one zone. Ceph or enterprise SAN is a scale-out sub-decision when metrics say you need it, not day-one cosplay.

CloudStack configuration: GitOps in practice

Alright. Domain A is not only racks and hypervisors. It is also how Infra IT is allowed to change the factory.

Every CloudStack object we care about (zones, offerings, affinity groups, network tags, the catalog Product Engineering sells against) lives in Terraform inside a private GitLab repo. Humans do not write production config through the CloudStack UI. They write code, open a merge request, and let the pipeline apply it. The why and the non negotiable rules are in Technical decisions: Configuration model (Terraform and GitOps). This section is the motion picture: what happens when someone actually ships a change.

Read-only UI, declarative writes

Standard Infra admins get read-only CloudStack UI access to observe and troubleshoot. One break-glass account exists for disaster recovery. Every normal change flows Git → pipeline → CloudStack API. Same decision record: Configuration model and pipeline security.

Lab first, production second. We keep a lab CloudStack workspace (separate Terraform state, topology mirrored to prod: same object types, smaller footprint). A new service offering or affinity rule lands in lab first. Operator verifies. Only then does a promotion merge request target the production workspace and state file. No "I tested in my head" applies.

Approval hierarchy (boring on purpose):

StageWho actsWhat must be true
ProposeInfra contributorBranch with Terraform edit, merge request opened
ValidateGitLab runnerterraform fmt, validate, gitleaks, plan attached to MR
Review labInfra supervisor / engineering managerHuman reads diff + plan output, approves or rejects
Apply labRunner on protected branchterraform apply against lab state; operator smoke tests
Promote prodContributor + supervisorSecond MR or gated job for prod workspace; supervisor approves again
Apply prodRunner onlyState lock, plan, apply, state save, pipeline audit log

Where the GitLab runner lives. Self-hosted runners sit on VMs in the management VLAN: same zone as CloudStack management servers, not on the public internet and not on shared SaaS runner pools. Firewall policy is tight:

Runner may talk toRunner must not
GitLab (single controlled VCS endpoint)Random internet egress
CloudStack management APIHuman laptop paths to API write
Vault (or sealed secrets injector) for API keysSecrets committed in Git (gitleaks blocks this)
Remote Terraform state backendAd hoc UI clicks as source of truth

That placement is how we get declarative ops: the operator's hands are on Git and merge requests. The runner's hands are on the API. The manager's hands are on the approve button. Nobody's tribal notebook is the system of record.

Sequence: forward change and revert

Preparing diagram

Revert is not a panic click in the UI. If a service offering or affinity group was wrong, Infra opens a merge request that reverts the Git commit (or restores the previous .tf files). The pipeline runs terraform plan on prod. The plan shows exactly what will roll back. Supervisor approves. Runner applies. State file updates. Git history shows who authorized the rollback. That is the same muscle as forward change, just walking backward.

Imperative ops is "who remembers what the UI looked like Tuesday?" GitOps is "show me the merge request." This diagram is Domain A because it is part of how the physical platform is operated, not a sidebar in a billing doc.

Pipeline wiring, module layout, and hook config: Volume 7, Infrastructure as Code. CloudStack object mapping: Volume 4.


Domain A starter checklist

Before you call the factory floor "production," you should be able to tick these mentally:

  1. Colo contract: power kW, IPs, carrier path, remote hands
  2. One 42U rack populated: network row, MS x2, KVM x3+, storage
  3. Zones drawn: WAN, mgmt, guest, storage, OOB isolated
  4. CloudStack: one zone, one pod, one KVM cluster, system VMs healthy
  5. Primary and secondary storage registered in CloudStack (Terraform in Git)
  6. Infra admins read-only on CloudStack UI; writes through GitOps pipeline
What we deliberately defer

Second rack, second geographic zone, HA firewall pair, Ceph cluster, VMware cluster: all valid roadmap items. They are not required to explain Domain A at launch.

TopicHandbook volume
CloudStack zones, pods, clusters, KVM hostsVolume 4
Physical and virtual networking, VLANsVolume 5
Primary/secondary storage designVolume 6
Datacenter ops, expansion, DRVolume 27
CloudStack GitOps flow (lab → prod, revert)This page, GitOps in practice
Why CloudStack on KVM (decision record)Technical decisions, Volume 3

Domain B: Application & control-plane architecture

This is the software map: portal, private API, identity, ERP, provisioning workers, observability on k3s. The customer sees the storefront. They never see the stockroom.

Next pass on this domain

Full trust-zone diagram: internet → portal SSR → private FastAPI → Keycloak / RedOps / queue / workers → CloudStack API. Internal vs customer-facing split drawn once, referenced everywhere.

At this altitude, the story is simple:

  • Public edge: Next.js hybrid portal (static + SSR). The only app customers touch on the internet.
  • Private orchestration: FastAPI platform API. Browsers never get a route to it (Technical decisions).
  • Identity: Keycloak for login. RedOps/ERPNext for money and entitlements. Don't merge those in your head.
  • Provisioning: queue and workers talk to CloudStack. Long jobs don't block a page render.
  • Runtime: k3s scales portal, API, and workers when Maghreb traffic shows up.

Internal platform runs the company: portal server, platform API, workers, monitoring, admin tools on k3s.

Customer products are what we sell: VPS on CloudStack, DNS, mail, shared hosting later. Nobody gets kubeconfig to our internal cluster. That's not a flex. That's hygiene.

LayerPurposeHandbook volume
Customer portalBuy, manage, get help (SSR/BFF)Volume 10
IdentityWho is this human?Volume 9
Corporate ERPMoney, entitlements, company opsVolume 11
Provisioning engineOrder → running serviceVolume 19
Partner API (later)Public REST when resellers need itVolume 20
Internal k8s platformDeploy and scale the app planeVolume 8
ObservabilityMetrics, logs, alertsVolume 17, Volume 18

Coming next: trust-zone diagram (internet / DMZ / app private / management / CloudStack API).


Domain C: Business & operational flows

Diagrams show boxes. Flows show life. This domain is what happens when a real customer pays, a renewal fails, or something breaks at 2 a.m.

Next pass on this domain

Swimlanes and polish on three flows: order-to-live, payment failure/suspend, support/incident. Journey and revenue language stay in their own docs; we link, we don't copy-paste.

Three flows we're documenting properly in the next pass. Headlines for now:

1. Order-to-live (the provision spine)

Preparing diagram

This is the row that makes or kills a hosting company. Volume 19 is built around it.

2. Payment failure and lifecycle

Preparing diagram

Money stopped. Capacity can't stay free forever. Policy must be boring and automated.

3. Support and incident

Preparing diagram

Go deeper on the customer story in Customer lifecycle & journey and Business model & revenue. Implementation lives in Volume 19 and Volume 23.

Coming next: swimlane version (Customer / Portal / ERP / Engine / CloudStack / Support) for the same three flows.


Critical integration points

These arrows break real hosts. They cut across all three domains. When one lies, customers feel it before your dashboard turns red.

IntegrationWhy it hurts when wrong
Billing ↔ ProvisioningPaid but not provisioned, or provisioned but not billed
Portal ↔ IdentityLogin works but wrong account sees wrong services
Engine ↔ CloudStackOrphan VMs, wrong zone, quota drift
DNS ↔ PortalDomain bought but no records; "hosting is broken"
Monitoring ↔ SupportCustomer knows before we do; trust dies
ERP ↔ Product catalogSKU sells something CloudStack cannot deliver
Volume 19 exists because the billing ↔ provisioning ↔ CloudStack row is the company's spine. Everything else is support cast.

What this doc does not cover

This page is the map. The handbook volumes are the manual. Don't expect VLAN IDs here.

Not hereWhere it lives
VLAN IDs, firewall rules, routing tablesVolume 5
CloudStack install and offering designVolume 4
Terraform modules and GitOps pipelinesVolume 7
API sequence diagrams and webhooksVolume 19, Volume 20
Why we picked each stack componentTechnical decisions
SLOs and executive metricsExecutive metrics & SLOs (next doc)

Next: Executive metrics & SLOs. The architecture is a blueprint; metrics tell you if anyone should live in the building.