Cost tracking should be optional but can be used to determine P/L.
Scope
DB changes
- Add optional cost fields to
ip_range:
cost_per_ip: monthly cost per IP address (smallest currency units)
cost_currency: currency code (e.g. USD, EUR)
- Add optional cost fields to
vm_host:
monthly_cost: recurring monthly cost of the host (rent/colo fee)
investment_cost: one-time capital cost (hardware purchase) for break-even calculation
cost_currency: currency code
Admin API
PATCH /api/v1/admin/ip-range/{id} — set cost_per_ip, cost_currency
PATCH /api/v1/admin/host/{id} — set monthly_cost, investment_cost, cost_currency
P/L calculation (to be specified in a follow-up issue)
- Total monthly cost = sum of host monthly costs + (IPs assigned × cost_per_ip for each range)
- Total monthly revenue = sum of active VM renewal amounts (already tracked in
vm_payment)
- Break-even tracking =
investment_cost amortised against cumulative profit
Notes
- All cost fields are optional — omitting them means no cost data for that resource (no behaviour change)
- Currency conversion will be needed when costs and revenues are in different currencies — defer to follow-up
- Cost data is admin-only; never exposed to end users
Cost tracking should be optional but can be used to determine P/L.
Scope
DB changes
ip_range:cost_per_ip: monthly cost per IP address (smallest currency units)cost_currency: currency code (e.g.USD,EUR)vm_host:monthly_cost: recurring monthly cost of the host (rent/colo fee)investment_cost: one-time capital cost (hardware purchase) for break-even calculationcost_currency: currency codeAdmin API
PATCH /api/v1/admin/ip-range/{id}— setcost_per_ip,cost_currencyPATCH /api/v1/admin/host/{id}— setmonthly_cost,investment_cost,cost_currencyP/L calculation (to be specified in a follow-up issue)
vm_payment)investment_costamortised against cumulative profitNotes