{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/codebase-design/json-schema/codebase-design-community-leaderboard-row-schema.json",
  "title": "CommunityLeaderboardRow",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/codebase-design-openapi.yml#/components/schemas/CommunityLeaderboardRow",
  "type": "object",
  "properties": {
    "rank": {
      "type": "integer"
    },
    "builderId": {
      "type": "string"
    },
    "alias": {
      "type": "string",
      "maxLength": 28
    },
    "planId": {
      "type": "string",
      "enum": [
        "free",
        "starter",
        "builder",
        "pro",
        "team",
        "founder"
      ]
    },
    "voteWeight": {
      "type": "integer",
      "minimum": 0,
      "maximum": 5
    },
    "tokensUsed": {
      "type": "integer",
      "format": "int64"
    },
    "completedProjects": {
      "type": "integer"
    },
    "publishedBuilds": {
      "type": "integer"
    },
    "weightedUpvotes": {
      "type": "integer",
      "format": "int64"
    },
    "upvoteCount": {
      "type": "integer"
    },
    "score": {
      "type": "integer",
      "format": "int64",
      "description": "round(tokens/1000) + completed*250 + weighted_upvotes*100"
    },
    "featuredBuild": {
      "$ref": "#/$defs/CommunityFeaturedBuild"
    }
  },
  "$defs": {
    "CommunityFeaturedBuild": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "projectId": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "tags": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "publishedAt": {
          "type": "integer",
          "format": "int64",
          "description": "epoch ms"
        },
        "viewCount": {
          "type": "integer"
        },
        "forkCount": {
          "type": "integer"
        },
        "weightedUpvotes": {
          "type": "integer",
          "format": "int64"
        },
        "viewerHasVoted": {
          "type": "boolean",
          "description": "Present only when authenticated"
        }
      }
    }
  }
}