{
  "schema_version": "2026-07-09",
  "example": true,
  "live_api": false,
  "name": "Metrics Collector Backend Example",
  "slug": "metrics-collector",
  "description": "A public example of the backend contract Spala can help create for metrics ingestion: events, dashboards, alerts, incidents, auth, API keys, and docs.",
  "audience": "SaaS teams, internal analytics tools, product teams",
  "boundary": "Illustrative backend contract only. This is not a live customer API, not Spala source code, and not private platform architecture.",
  "suggested_tables": [
    {
      "name": "users",
      "purpose": "Example users resource for the metrics-collector backend contract.",
      "fields": [
        "id",
        "created_at",
        "updated_at"
      ],
      "note": "Exact fields should be generated, reviewed, and validated in the Spala project."
    },
    {
      "name": "workspaces",
      "purpose": "Example workspaces resource for the metrics-collector backend contract.",
      "fields": [
        "id",
        "created_at",
        "updated_at"
      ],
      "note": "Exact fields should be generated, reviewed, and validated in the Spala project."
    },
    {
      "name": "api_keys",
      "purpose": "Example api_keys resource for the metrics-collector backend contract.",
      "fields": [
        "id",
        "created_at",
        "updated_at"
      ],
      "note": "Exact fields should be generated, reviewed, and validated in the Spala project."
    },
    {
      "name": "metric_events",
      "purpose": "Example metric_events resource for the metrics-collector backend contract.",
      "fields": [
        "id",
        "created_at",
        "updated_at"
      ],
      "note": "Exact fields should be generated, reviewed, and validated in the Spala project."
    },
    {
      "name": "dashboards",
      "purpose": "Example dashboards resource for the metrics-collector backend contract.",
      "fields": [
        "id",
        "created_at",
        "updated_at"
      ],
      "note": "Exact fields should be generated, reviewed, and validated in the Spala project."
    },
    {
      "name": "alerts",
      "purpose": "Example alerts resource for the metrics-collector backend contract.",
      "fields": [
        "id",
        "created_at",
        "updated_at"
      ],
      "note": "Exact fields should be generated, reviewed, and validated in the Spala project."
    },
    {
      "name": "incidents",
      "purpose": "Example incidents resource for the metrics-collector backend contract.",
      "fields": [
        "id",
        "created_at",
        "updated_at"
      ],
      "note": "Exact fields should be generated, reviewed, and validated in the Spala project."
    }
  ],
  "suggested_endpoints": [
    {
      "method": "POST",
      "path": "/api/ingest",
      "operationId": "post_ingest",
      "auth": "bearer_user_or_project_token",
      "note": "Example route shape only. Validate request, response, ownership, and error behavior in the generated Spala project."
    },
    {
      "method": "GET",
      "path": "/api/metrics",
      "operationId": "get_metrics",
      "auth": "bearer_user_or_project_token",
      "note": "Example route shape only. Validate request, response, ownership, and error behavior in the generated Spala project."
    },
    {
      "method": "GET",
      "path": "/api/dashboards",
      "operationId": "get_dashboards",
      "auth": "depends_on_route",
      "note": "Example route shape only. Validate request, response, ownership, and error behavior in the generated Spala project."
    },
    {
      "method": "POST",
      "path": "/api/alerts",
      "operationId": "post_alerts",
      "auth": "bearer_user_or_project_token",
      "note": "Example route shape only. Validate request, response, ownership, and error behavior in the generated Spala project."
    },
    {
      "method": "GET",
      "path": "/api/incidents",
      "operationId": "get_incidents",
      "auth": "depends_on_route",
      "note": "Example route shape only. Validate request, response, ownership, and error behavior in the generated Spala project."
    },
    {
      "method": "PATCH",
      "path": "/api/incidents/{id}",
      "operationId": "patch_incidents_id",
      "auth": "bearer_user_or_project_token",
      "note": "Example route shape only. Validate request, response, ownership, and error behavior in the generated Spala project."
    }
  ],
  "auth_boundary": "Dashboard routes use user auth. Ingestion uses scoped API keys and should validate workspace ownership and payload shape.",
  "frontend_handoff": {
    "summary": "Frontend receives ingestion format, dashboard query parameters, auth/API-key rules, error format, and generated docs.",
    "include": [
      "published API base URL",
      "OpenAPI or generated Markdown API docs",
      "auth routes and token behavior",
      "protected route rules",
      "CORS origin",
      "upload/realtime rules when relevant",
      "error format",
      "publish state",
      "exact project MCP URL after auth and project selection"
    ]
  },
  "proof_of_concept_steps": [
    "Create a low-risk Spala project.",
    "Ask AI Copilot to generate this backend contract.",
    "Review tables, endpoints, auth rules, backend logic, and generated docs.",
    "Test public, protected, success, failure, validation, and ownership paths.",
    "Publish only after validation and review."
  ]
}