Game Framework
Billing & Usage

Billing Features

Game Framework tracks 10 features across all plans. Features are either limit-based (with usage counts) or boolean (on/off).

Limit-Based Features

1. Max Packages

Type: Count-based limit

Tracks the total number of packages in a workspace .

PlanLimit
Free5 packages
Pro50 packages
EnterpriseUnlimited

Enforced During: Package creation

Usage Example:

// Before creating a package
if err := billingService.EnforceFeature(ctx, workspaceID, billing.FeatureKeyMaxPackages); err != nil {
    return errs.PaymentRequired("package limit exceeded")
}

2. Max Storage

Type: Size-based limit (bytes)

Tracks total artifact storage consumed.

PlanLimit
Free10GB (10,737,418,240 bytes)
Pro100GB (107,374,182,400 bytes)
Enterprise1TB (1,099,511,627,776 bytes)

Enforced During: Artifact upload

Can be Extended: Yes, with storage addons ($20 per 100GB/month)

3. Max Downloads

Type: Count-based limit (monthly)

Tracks monthly package downloads.

PlanLimit
Free1,000/month
Pro100,000/month
EnterpriseUnlimited

Enforced During: Artifact streaming/download

Resets: Monthly on subscription anniversary

4. Max Versions

Type: Count-based limit (per package)

Tracks versions per package.

PlanLimit
Free10 versions/package
Pro100 versions/package
EnterpriseUnlimited

Enforced During: Version creation

5. Max Bandwidth

Type: Size-based limit (bytes, monthly)

Tracks monthly data transfer.

PlanLimit
Free50GB/month
Pro1TB/month
Enterprise10TB/month

Enforced During: Downloads (tracked after completion)

Resets: Monthly on subscription anniversary

Can be Extended: Yes, with bandwidth addons ($10 per 100GB/month)

Boolean Features

6. API Access

Type: Boolean (on/off)

Enables API key creation and programmatic access.

PlanAvailable
Free
Pro
Enterprise

Enables:

  • API key creation
  • Programmatic package publishing
  • CI/CD integration
  • Automated workflows

7. Advanced Analytics

Type: Boolean (on/off)

Enables detailed download statistics, geo-distribution, and trend analysis.

PlanAvailable
Free
Pro
Enterprise

Provides:

  • Download trends over time
  • Geographic distribution
  • Version popularity
  • Custom date ranges
  • Export capabilities

8. CDN Distribution

Type: Boolean (on/off)

Enables global CDN delivery for faster downloads worldwide.

PlanAvailable
Free
Pro
Enterprise

Benefits:

  • Global edge locations
  • Faster download speeds
  • Reduced latency
  • Better reliability

9. Priority Support

Type: Boolean (on/off)

Faster response times and dedicated support channel.

PlanAvailableSLA
FreeCommunity
Pro48 hours
Enterprise4 hours

Includes:

  • Dedicated support channel
  • Faster response times
  • Phone support
  • Dedicated account manager

10. Team Features

Type: Boolean (on/off)

Enables multi-user collaboration with roles and permissions.

PlanAvailable
Free
Pro
Enterprise

Enables:

  • Multiple workspace members
  • Role-based permissions
  • Member invitations
  • Audit logging

Feature Enforcement

All features use hard-block enforcement - operations are prevented when limits are exceeded.

Enforcement Example

func (h *PackageHandler) Create(c forge.Context) error {
    workspaceID := getWorkspaceID(c)
    
    // Enforce package limit
    if err := h.billing.EnforceFeature(ctx, workspaceID, billing.FeatureKeyMaxPackages); err != nil {
        return errs.PaymentRequired("package limit exceeded - upgrade to create more packages")
    }
    
    // Create package...
}

Error Response

When a limit is exceeded:

{
  "error": {
    "code": "FEATURE_LIMIT_EXCEEDED",
    "message": "Package limit exceeded - upgrade to create more packages",
    "details": {
      "feature": "max_packages",
      "current_usage": 5,
      "limit": 5,
      "plan": "free",
      "upgrade_url": "/billing/plans"
    }
  }
}

Clients receive a 402 Payment Required status code when limits are exceeded, allowing them to show upgrade prompts to users.

Checking Feature Access

Check Access Status

GET /v1/workspaces/:workspaceId/billing/features

Response:

{
  "features": [
    {
      "key": "max_packages",
      "type": "limit",
      "limit": 5,
      "current_usage": 3,
      "can_proceed": true,
      "warning_threshold": 4,
      "warning_msg": null
    },
    {
      "key": "api_access",
      "type": "boolean",
      "enabled": false,
      "can_proceed": false
    }
  ]
}

Get Specific Feature

GET /v1/workspaces/:workspaceId/billing/features/max_packages

Usage Tracking

Usage is tracked automatically:

  • Packages: Counted on creation/deletion
  • Storage: Calculated from artifact sizes
  • Downloads: Incremented on each download
  • Versions: Counted per package
  • Bandwidth: Tracked after successful downloads

View usage summary:

GET /v1/workspaces/:workspaceId/billing/usage