{
  "generated_at": "2026-04-28T23:58:28.672Z",
  "system": {
    "id": "topolo-crm",
    "name": "TopoloCRM",
    "slug": "topolo-crm",
    "kind": "application",
    "summary": "CRM workflows, records, and SDR inbox/control-plane services exposed through the platform auth layer.",
    "aliases": [],
    "lifecycle": "active",
    "last_verified": "2026-04-25",
    "owners": [
      "crm"
    ],
    "repo_paths": [
      "PlatformApplications/TopoloCRM"
    ],
    "service_ids": [
      "srv_iCwM4jGXcwlj"
    ],
    "visibility": "public",
    "openapi": {
      "path": "PlatformApplications/TopoloCRM/packages/backend/openapi.yaml",
      "format": "yaml"
    },
    "api_contract": {
      "type": "openapi",
      "source": "PlatformApplications/TopoloCRM/packages/backend/openapi.yaml",
      "notes": "CRM owns its worker API contract and delegates browser login, cookie refresh, logout propagation, one-time `sso_code` callback exchange, and shared-launcher Auth data reads to the shared Auth client plus same-origin `/api/auth/*` Pages gateway. The explicit `/login` route renders the branded shared LoginPage without an initial refresh probe, embedded password-login success returns to the CRM route tree after shared Auth token persistence, shared Auth token update events are treated as already-persisted state, and the browser app does not expose a legacy `/sso?token=` token handoff route or app-local `/sso/exchange` parser. CRM keeps same-tab sessionStorage access-token restore enabled by default after login and refresh so normal reloads do not appear logged out before cookie refresh completes. The callback route guards one-time code exchange with a fixed `/dashboard` completion target so Auth home-path re-resolution cannot retry an already consumed `sso_code`. CRM exposes `GET /api/widget` with the shared `@topolo/sdk` widget response contract for TopoloOne live workspace."
    },
    "primary_hosts": [
      "https://crm.topolo.app"
    ],
    "doc_paths": [
      "applications/crm",
      "internal/apps/crm"
    ],
    "security_assurance": {
      "risk_tier": "high",
      "auth_boundary": "Topolo Auth `/validate` is the only accepted browser/API bearer-token authority; embedded password-login success is completed by CRM route-state after shared Auth token persistence with default same-tab access-token restore; CRM only performs CRM-record authorization after Auth returns user, organization, and service permissions.",
      "tenant_isolation": "organization_scoped",
      "external_inputs": [
        "browser",
        "api",
        "callback"
      ],
      "sensitive_data": [
        "identity",
        "org_data",
        "customer_content",
        "telemetry"
      ],
      "last_security_review": "2026-04-23",
      "security_review_status": "in_progress",
      "pentest_status": "not_started",
      "evidence_doc": "internal/apps/crm"
    },
    "dependencies": [
      "topolo-auth",
      "topolo-one",
      "applications-packages"
    ],
    "public_hub_url": "/systems/topolo-crm",
    "internal_hub_url": null,
    "application_api_url": "/reference/apps/topolo-crm",
    "generated_openapi_url": "/reference/generated/topolo-crm",
    "machine_urls": {
      "system": "/machine/systems/topolo-crm.json",
      "application": "/machine/applications/topolo-crm.json"
    }
  },
  "docs": {
    "public": [
      {
        "id": "applications/crm.mdx",
        "title": "TopoloCRM",
        "summary": "Public overview of the CRM service, pipeline surface, SDR inbox control plane, and developer-key access model.",
        "audience": "public",
        "tags": [
          "crm",
          "sales",
          "pipelines"
        ],
        "url": "/applications/crm.mdx",
        "last_verified": "2026-04-28"
      }
    ],
    "internal": [],
    "runbooks": []
  },
  "authority": {
    "owners": [
      "crm"
    ],
    "repo_paths": [
      "PlatformApplications/TopoloCRM"
    ],
    "service_ids": [
      "srv_iCwM4jGXcwlj"
    ],
    "dependencies": [
      "topolo-auth",
      "topolo-one",
      "applications-packages"
    ],
    "aliases": []
  },
  "interfaces": {
    "contract_type": "openapi",
    "contract_source": "PlatformApplications/TopoloCRM/packages/backend/openapi.yaml",
    "contract_source_exists": true,
    "openapi": {
      "title": "TopoloCRM API",
      "version": "1.0.0",
      "description": "A comprehensive Customer Relationship Management (CRM) API built on Cloudflare Workers.\n\nTopoloCRM provides full CRUD operations for contact management, sales pipeline tracking,\nnotes, file attachments, and data import/export capabilities.\n\n## Features\n- **Contact Management**: Full-text search, pagination, CRUD operations\n- **Sales Pipeline**: Kanban-style pipeline with drag-and-drop stage management\n- **Notes**: Rich note-taking with author tracking\n- **Attachments**: File upload/download with R2 storage\n- **Import/Export**: CSV data import and export\n- **Full-text Search**: FTS5-powered contact search\n\n## Authentication\nCurrently, authentication is handled through environment-based user context.\nJWT-based authentication will be implemented in future versions.\n\n## Rate Limiting\nAll endpoints are subject to rate limiting based on IP address.\nLimits are enforced using Cloudflare KV storage.\n",
      "servers": [
        {
          "url": "http://localhost:8787",
          "description": "Local development server"
        },
        {
          "url": "https://your-worker.your-subdomain.workers.dev",
          "description": "Production Cloudflare Worker"
        }
      ],
      "tags": [
        {
          "name": "system",
          "description": "System health and metadata"
        },
        {
          "name": "contacts",
          "description": "Contact management operations"
        },
        {
          "name": "notes",
          "description": "Contact notes and interactions"
        },
        {
          "name": "attachments",
          "description": "File upload and management"
        },
        {
          "name": "pipeline",
          "description": "Sales pipeline and stage management"
        },
        {
          "name": "import-export",
          "description": "Data import and export operations"
        }
      ],
      "securitySchemes": [],
      "defaultSecurity": [],
      "operations": [
        {
          "method": "GET",
          "path": "/health",
          "summary": "Health check",
          "description": "Returns API health status and timestamp",
          "tags": [
            "system"
          ],
          "security": [],
          "requestContentTypes": [],
          "responseCodes": [
            "200"
          ]
        },
        {
          "method": "GET",
          "path": "/api",
          "summary": "API information",
          "description": "Returns API metadata and available endpoints",
          "tags": [
            "system"
          ],
          "security": [],
          "requestContentTypes": [],
          "responseCodes": [
            "200"
          ]
        },
        {
          "method": "GET",
          "path": "/api/contacts",
          "summary": "List contacts",
          "description": "Retrieve a paginated list of contacts with optional full-text search.\nSupports advanced search using FTS5 for names, emails, companies, and tags.\n",
          "tags": [
            "contacts"
          ],
          "security": [],
          "requestContentTypes": [],
          "responseCodes": [
            "200",
            "500"
          ]
        },
        {
          "method": "POST",
          "path": "/api/contacts",
          "summary": "Create contact",
          "description": "Create a new contact with provided information",
          "tags": [
            "contacts"
          ],
          "security": [],
          "requestContentTypes": [
            "application/json"
          ],
          "responseCodes": [
            "201",
            "400",
            "500"
          ]
        },
        {
          "method": "GET",
          "path": "/api/contacts/{id}",
          "summary": "Get contact",
          "description": "Retrieve a specific contact by ID",
          "tags": [
            "contacts"
          ],
          "security": [],
          "requestContentTypes": [],
          "responseCodes": [
            "200",
            "404",
            "500"
          ]
        },
        {
          "method": "PUT",
          "path": "/api/contacts/{id}",
          "summary": "Update contact",
          "description": "Update an existing contact's information",
          "tags": [
            "contacts"
          ],
          "security": [],
          "requestContentTypes": [
            "application/json"
          ],
          "responseCodes": [
            "200",
            "400",
            "404",
            "500"
          ]
        },
        {
          "method": "DELETE",
          "path": "/api/contacts/{id}",
          "summary": "Delete contact",
          "description": "Soft delete a contact (sets deleted flag)",
          "tags": [
            "contacts"
          ],
          "security": [],
          "requestContentTypes": [],
          "responseCodes": [
            "200",
            "404",
            "500"
          ]
        },
        {
          "method": "GET",
          "path": "/api/contacts/{id}/notes",
          "summary": "List contact notes",
          "description": "Get paginated list of notes for a specific contact",
          "tags": [
            "notes"
          ],
          "security": [],
          "requestContentTypes": [],
          "responseCodes": [
            "200",
            "404",
            "500"
          ]
        },
        {
          "method": "POST",
          "path": "/api/contacts/{id}/notes",
          "summary": "Create note",
          "description": "Add a new note to a contact",
          "tags": [
            "notes"
          ],
          "security": [],
          "requestContentTypes": [
            "application/json"
          ],
          "responseCodes": [
            "201",
            "400",
            "404",
            "500"
          ]
        },
        {
          "method": "GET",
          "path": "/api/contacts/{contactId}/notes/{noteId}",
          "summary": "Get specific note",
          "description": "Retrieve a specific note by ID",
          "tags": [
            "notes"
          ],
          "security": [],
          "requestContentTypes": [],
          "responseCodes": [
            "200",
            "404",
            "500"
          ]
        },
        {
          "method": "PUT",
          "path": "/api/contacts/{contactId}/notes/{noteId}",
          "summary": "Update note",
          "description": "Update an existing note",
          "tags": [
            "notes"
          ],
          "security": [],
          "requestContentTypes": [
            "application/json"
          ],
          "responseCodes": [
            "200",
            "400",
            "404",
            "500"
          ]
        },
        {
          "method": "DELETE",
          "path": "/api/contacts/{contactId}/notes/{noteId}",
          "summary": "Delete note",
          "description": "Delete a note permanently",
          "tags": [
            "notes"
          ],
          "security": [],
          "requestContentTypes": [],
          "responseCodes": [
            "200",
            "404",
            "500"
          ]
        },
        {
          "method": "GET",
          "path": "/api/contacts/{id}/attachments",
          "summary": "List contact attachments",
          "description": "Get all attachments for a specific contact",
          "tags": [
            "attachments"
          ],
          "security": [],
          "requestContentTypes": [],
          "responseCodes": [
            "200",
            "404",
            "500"
          ]
        },
        {
          "method": "POST",
          "path": "/api/contacts/{id}/attachments",
          "summary": "Upload attachment",
          "description": "Upload a file attachment for a contact",
          "tags": [
            "attachments"
          ],
          "security": [],
          "requestContentTypes": [
            "multipart/form-data"
          ],
          "responseCodes": [
            "201",
            "400",
            "404",
            "413",
            "500"
          ]
        },
        {
          "method": "GET",
          "path": "/api/attachments/{id}",
          "summary": "Download attachment",
          "description": "Download an attachment file",
          "tags": [
            "attachments"
          ],
          "security": [],
          "requestContentTypes": [],
          "responseCodes": [
            "200",
            "404",
            "500"
          ]
        },
        {
          "method": "DELETE",
          "path": "/api/attachments/{id}",
          "summary": "Delete attachment",
          "description": "Delete an attachment permanently",
          "tags": [
            "attachments"
          ],
          "security": [],
          "requestContentTypes": [],
          "responseCodes": [
            "200",
            "404",
            "500"
          ]
        },
        {
          "method": "GET",
          "path": "/api/pipeline",
          "summary": "List pipelines",
          "description": "Get all available sales pipelines",
          "tags": [
            "pipeline"
          ],
          "security": [],
          "requestContentTypes": [],
          "responseCodes": [
            "200",
            "500"
          ]
        },
        {
          "method": "GET",
          "path": "/api/pipeline/{pipelineId}",
          "summary": "Get pipeline details",
          "description": "Get detailed information about a specific pipeline including stages",
          "tags": [
            "pipeline"
          ],
          "security": [],
          "requestContentTypes": [],
          "responseCodes": [
            "200",
            "404",
            "500"
          ]
        },
        {
          "method": "GET",
          "path": "/api/pipeline/{pipelineId}/board",
          "summary": "Get pipeline board",
          "description": "Get kanban board view with contacts grouped by pipeline stages",
          "tags": [
            "pipeline"
          ],
          "security": [],
          "requestContentTypes": [],
          "responseCodes": [
            "200",
            "404",
            "500"
          ]
        },
        {
          "method": "PUT",
          "path": "/api/pipeline/{contactId}/move",
          "summary": "Move contact to stage",
          "description": "Move a contact to a different pipeline stage",
          "tags": [
            "pipeline"
          ],
          "security": [],
          "requestContentTypes": [
            "application/json"
          ],
          "responseCodes": [
            "200",
            "400",
            "404",
            "500"
          ]
        },
        {
          "method": "GET",
          "path": "/api/pipeline/{contactId}/history",
          "summary": "Get contact pipeline history",
          "description": "Get the stage movement history for a contact",
          "tags": [
            "pipeline"
          ],
          "security": [],
          "requestContentTypes": [],
          "responseCodes": [
            "200",
            "404",
            "500"
          ]
        },
        {
          "method": "POST",
          "path": "/api/contacts/import",
          "summary": "Import contacts",
          "description": "Import contacts from CSV file with field mapping",
          "tags": [
            "import-export"
          ],
          "security": [],
          "requestContentTypes": [
            "multipart/form-data"
          ],
          "responseCodes": [
            "200",
            "400",
            "500"
          ]
        },
        {
          "method": "GET",
          "path": "/api/contacts/export",
          "summary": "Export contacts",
          "description": "Export contacts to CSV format",
          "tags": [
            "import-export"
          ],
          "security": [],
          "requestContentTypes": [],
          "responseCodes": [
            "200",
            "500"
          ]
        }
      ]
    },
    "readme": {
      "path": "PlatformApplications/TopoloCRM/README.md",
      "intro": [
        "Canonical documentation for TopoloCRM lives in `PlatformApplications/TopoloDocs`.",
        "Use this repository for implementation only. Local product and operational docs have been retired in favor of the docs application."
      ],
      "headings": [
        "TopoloCRM"
      ],
      "routeHighlights": [],
      "commandHighlights": []
    }
  },
  "auth": {
    "depends_on_topolo_auth": true,
    "api_key_scopes": [
      {
        "id": "aks_crm_activities_read",
        "name": "activities.read",
        "description": "View customer activities and history",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_activities_write",
        "name": "activities.write",
        "description": "Log customer activities and notes",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_api_keys_write",
        "name": "api_keys.write",
        "description": "Manage CRM machine credentials",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_attachments_read",
        "name": "attachments.read",
        "description": "View CRM attachments and files",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_attachments_write",
        "name": "attachments.write",
        "description": "Upload and manage CRM attachments and files",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_commissions_read",
        "name": "commissions.read",
        "description": "View commission records and payouts",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_commissions_write",
        "name": "commissions.write",
        "description": "Create and manage commission records and payouts",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_companies_read",
        "name": "companies.read",
        "description": "View companies and account records",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_companies_write",
        "name": "companies.write",
        "description": "Create and manage companies and account records",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_contacts_read",
        "name": "contacts.read",
        "description": "View customer contacts and profiles",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_contacts_write",
        "name": "contacts.write",
        "description": "Create and edit customer contacts",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_deals_read",
        "name": "deals.read",
        "description": "View sales deals and opportunities",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_deals_write",
        "name": "deals.write",
        "description": "Manage sales deals and pipeline",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_documents_read",
        "name": "documents.read",
        "description": "View CRM documents and transaction files",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_documents_write",
        "name": "documents.write",
        "description": "Create and manage CRM documents and transaction files",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_listings_read",
        "name": "listings.read",
        "description": "View property listings",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_listings_write",
        "name": "listings.write",
        "description": "Create and manage property listings",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_notes_read",
        "name": "notes.read",
        "description": "View CRM notes and contact history",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_notes_write",
        "name": "notes.write",
        "description": "Create and manage CRM notes",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_offers_read",
        "name": "offers.read",
        "description": "View offers and negotiation records",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_offers_write",
        "name": "offers.write",
        "description": "Create and manage offers and negotiation records",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_pipeline_read",
        "name": "pipeline.read",
        "description": "View pipeline stages and contact movement",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_pipeline_write",
        "name": "pipeline.write",
        "description": "Manage pipeline stages and contact movement",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_portal_connections_read",
        "name": "portal_connections.read",
        "description": "View portal and lead-source connections",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_portal_connections_write",
        "name": "portal_connections.write",
        "description": "Create and manage portal and lead-source connections",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_portal_leads_read",
        "name": "portal_leads.read",
        "description": "View portal lead intake and routing state",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_portal_leads_write",
        "name": "portal_leads.write",
        "description": "Manage portal lead intake and routing state",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_portal_sync_read",
        "name": "portal_sync.read",
        "description": "View portal sync status and runs",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_portal_sync_write",
        "name": "portal_sync.write",
        "description": "Manage portal sync runs and mappings",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_properties_read",
        "name": "properties.read",
        "description": "View property records and metadata",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_properties_write",
        "name": "properties.write",
        "description": "Create and manage property records and metadata",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_reports_read",
        "name": "reports.read",
        "description": "View CRM reports and analytics",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_sdr_override",
        "name": "sdr.override",
        "description": "Override SDR readiness and suppressions",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_sdr_read",
        "name": "sdr.read",
        "description": "View SDR control-plane data and readiness state",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_sdr_write",
        "name": "sdr.write",
        "description": "Create and manage SDR control-plane data and readiness state",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_search_read",
        "name": "search.read",
        "description": "Search CRM records and SDR data",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_settings_read",
        "name": "settings.read",
        "description": "View CRM settings and module configuration",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_settings_write",
        "name": "settings.write",
        "description": "Manage CRM settings and module configuration",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_showings_read",
        "name": "showings.read",
        "description": "View showings and visit schedules",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_showings_write",
        "name": "showings.write",
        "description": "Create and manage showings and visit schedules",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_tasks_read",
        "name": "tasks.read",
        "description": "View CRM tasks and follow-up queues",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_tasks_write",
        "name": "tasks.write",
        "description": "Create and manage CRM tasks and follow-up queues",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_transactions_read",
        "name": "transactions.read",
        "description": "View transaction records and milestones",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_crm_transactions_write",
        "name": "transactions.write",
        "description": "Create and manage transaction records and milestones",
        "resourcePattern": null,
        "kind": "api_key_scope"
      }
    ],
    "service_permissions": [
      {
        "id": "perm_crm_activities_read",
        "name": "activities:read",
        "description": "View customer activities and history",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_activities_write",
        "name": "activities:write",
        "description": "Log customer activities and notes",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_api_keys_write",
        "name": "api_keys:write",
        "description": "Manage CRM machine credentials",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_attachments_read",
        "name": "attachments:read",
        "description": "View CRM attachments and files",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_attachments_write",
        "name": "attachments:write",
        "description": "Upload and manage CRM attachments and files",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_commissions_read",
        "name": "commissions:read",
        "description": "View commission records and payouts",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_commissions_write",
        "name": "commissions:write",
        "description": "Create and manage commission records and payouts",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_companies_read",
        "name": "companies:read",
        "description": "View companies and account records",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_companies_write",
        "name": "companies:write",
        "description": "Create and manage companies and account records",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_contacts_read",
        "name": "contacts:read",
        "description": "View customer contacts and profiles",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_contacts_write",
        "name": "contacts:write",
        "description": "Create and edit customer contacts",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_deals_read",
        "name": "deals:read",
        "description": "View sales deals and opportunities",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_deals_write",
        "name": "deals:write",
        "description": "Manage sales deals and pipeline",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_documents_read",
        "name": "documents:read",
        "description": "View CRM documents and transaction files",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_documents_write",
        "name": "documents:write",
        "description": "Create and manage CRM documents and transaction files",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_listings_read",
        "name": "listings:read",
        "description": "View property listings",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_listings_write",
        "name": "listings:write",
        "description": "Create and manage property listings",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_notes_read",
        "name": "notes:read",
        "description": "View CRM notes and contact history",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_notes_write",
        "name": "notes:write",
        "description": "Create and manage CRM notes",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_offers_read",
        "name": "offers:read",
        "description": "View offers and negotiation records",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_offers_write",
        "name": "offers:write",
        "description": "Create and manage offers and negotiation records",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_pipeline_read",
        "name": "pipeline:read",
        "description": "View pipeline stages and contact movement",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_pipeline_write",
        "name": "pipeline:write",
        "description": "Manage pipeline stages and contact movement",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_portal_connections_read",
        "name": "portal_connections:read",
        "description": "View portal and lead-source connections",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_portal_connections_write",
        "name": "portal_connections:write",
        "description": "Create and manage portal and lead-source connections",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_portal_leads_read",
        "name": "portal_leads:read",
        "description": "View portal lead intake and routing state",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_portal_leads_write",
        "name": "portal_leads:write",
        "description": "Manage portal lead intake and routing state",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_portal_sync_read",
        "name": "portal_sync:read",
        "description": "View portal sync status and runs",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_portal_sync_write",
        "name": "portal_sync:write",
        "description": "Manage portal sync runs and mappings",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_properties_read",
        "name": "properties:read",
        "description": "View property records and metadata",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_properties_write",
        "name": "properties:write",
        "description": "Create and manage property records and metadata",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_reports_read",
        "name": "reports:read",
        "description": "View CRM reports and analytics",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_sdr_override",
        "name": "sdr:override",
        "description": "Override SDR readiness and suppressions",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_sdr_read",
        "name": "sdr:read",
        "description": "View SDR control-plane data and readiness state",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_sdr_write",
        "name": "sdr:write",
        "description": "Create and manage SDR control-plane data and readiness state",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_search_read",
        "name": "search:read",
        "description": "Search CRM records and SDR data",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_settings_read",
        "name": "settings:read",
        "description": "View CRM settings and module configuration",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_settings_write",
        "name": "settings:write",
        "description": "Manage CRM settings and module configuration",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_showings_read",
        "name": "showings:read",
        "description": "View showings and visit schedules",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_showings_write",
        "name": "showings:write",
        "description": "Create and manage showings and visit schedules",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_tasks_read",
        "name": "tasks:read",
        "description": "View CRM tasks and follow-up queues",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_tasks_write",
        "name": "tasks:write",
        "description": "Create and manage CRM tasks and follow-up queues",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_transactions_read",
        "name": "transactions:read",
        "description": "View transaction records and milestones",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_crm_transactions_write",
        "name": "transactions:write",
        "description": "Create and manage transaction records and milestones",
        "resourcePattern": null,
        "kind": "permission"
      }
    ]
  },
  "runtime": {
    "primary_hosts": [
      "https://crm.topolo.app"
    ],
    "repo_entries": [
      "PlatformApplications/TopoloCRM/README.md",
      "PlatformApplications/TopoloCRM/all-contacts.csv",
      "PlatformApplications/TopoloCRM/app/",
      "PlatformApplications/TopoloCRM/backend.log",
      "PlatformApplications/TopoloCRM/docs/",
      "PlatformApplications/TopoloCRM/frontend.log",
      "PlatformApplications/TopoloCRM/infra/",
      "PlatformApplications/TopoloCRM/migration.config.ts",
      "PlatformApplications/TopoloCRM/package-lock.json",
      "PlatformApplications/TopoloCRM/package.json",
      "PlatformApplications/TopoloCRM/packages/",
      "PlatformApplications/TopoloCRM/pnpm-lock.yaml",
      "PlatformApplications/TopoloCRM/postman-collection.json",
      "PlatformApplications/TopoloCRM/scripts/",
      "PlatformApplications/TopoloCRM/topolo.cloudcontrol.json"
    ],
    "wrangler_surfaces": [
      {
        "path": "PlatformApplications/TopoloCRM/app/wrangler.toml",
        "observabilityEnabled": true,
        "environments": [],
        "routes": [],
        "vars": [
          "AUTH_API_URL"
        ],
        "bindings": [],
        "cronTriggers": [],
        "workerName": "topolo-crm-frontend",
        "compatibilityDate": "2026-04-10"
      },
      {
        "path": "PlatformApplications/TopoloCRM/packages/backend/wrangler.toml",
        "observabilityEnabled": true,
        "environments": [
          "dev",
          "stg",
          "prod"
        ],
        "routes": [],
        "vars": [
          "API_KEY_HASH_ITERATIONS",
          "API_KEY_PREFIX",
          "ENVIRONMENT",
          "NEXUS_GATEWAY_URL",
          "NODE_ENV",
          "SALT_ROUNDS",
          "account_id"
        ],
        "bindings": [
          {
            "kind": "d1",
            "binding": "CRM_DB",
            "sourcePath": "PlatformApplications/TopoloCRM/packages/backend/wrangler.toml",
            "target": "00000000-0000-0000-0000-000000000000"
          },
          {
            "kind": "d1",
            "binding": "CRM_DB",
            "environment": "stg",
            "sourcePath": "PlatformApplications/TopoloCRM/packages/backend/wrangler.toml",
            "target": "cf93b0b6-8a56-4516-a0c7-4e2d8dee4157"
          },
          {
            "kind": "r2",
            "binding": "crm_attachments",
            "environment": "stg",
            "sourcePath": "PlatformApplications/TopoloCRM/packages/backend/wrangler.toml",
            "target": "edge-crm-attachments-staging"
          },
          {
            "kind": "d1",
            "binding": "CRM_DB",
            "environment": "prod",
            "sourcePath": "PlatformApplications/TopoloCRM/packages/backend/wrangler.toml",
            "target": "77e9aeb0-fb0d-48a7-adb1-e0ce6700ab89"
          },
          {
            "kind": "kv",
            "binding": "CRM_KV",
            "environment": "prod",
            "sourcePath": "PlatformApplications/TopoloCRM/packages/backend/wrangler.toml",
            "target": "2bf87302ccb04e43bda3c946a1d7f15b"
          },
          {
            "kind": "r2",
            "binding": "crm_attachments",
            "environment": "prod",
            "sourcePath": "PlatformApplications/TopoloCRM/packages/backend/wrangler.toml",
            "target": "edge-crm-attachments-production"
          }
        ],
        "cronTriggers": [],
        "workerName": "edge-crm",
        "main": "index.ts",
        "compatibilityDate": "2026-04-10",
        "assetsDirectory": "./public"
      }
    ],
    "packages": [
      {
        "path": "PlatformApplications/TopoloCRM/app/package.json",
        "name": "app",
        "scripts": [
          "dev",
          "build",
          "lint",
          "lint:fix",
          "format",
          "format:check",
          "typecheck",
          "test",
          "test:ui",
          "test:run",
          "test:coverage",
          "preview",
          "deploy:stg",
          "deploy:prod",
          "prepare"
        ],
        "scriptCommands": [
          {
            "name": "dev",
            "command": "vite"
          },
          {
            "name": "build",
            "command": "vite build"
          },
          {
            "name": "lint",
            "command": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 10000"
          },
          {
            "name": "lint:fix",
            "command": "eslint . --ext ts,tsx --fix"
          },
          {
            "name": "format",
            "command": "prettier --write \"src/**/*.{ts,tsx,json,css,md}\""
          },
          {
            "name": "format:check",
            "command": "prettier --check \"src/**/*.{ts,tsx,json,css,md}\""
          },
          {
            "name": "typecheck",
            "command": "tsc --noEmit"
          },
          {
            "name": "test",
            "command": "vitest"
          },
          {
            "name": "test:ui",
            "command": "vitest --ui"
          },
          {
            "name": "test:run",
            "command": "vitest run"
          },
          {
            "name": "test:coverage",
            "command": "vitest run --coverage"
          },
          {
            "name": "preview",
            "command": "vite preview"
          },
          {
            "name": "deploy:stg",
            "command": "VITE_API_URL=https://edge-crm-stg.topolo.workers.dev/api VITE_APP_NAME=TopoloCRM VITE_APP_VERSION=1.0.0 npm run build && npx wrangler pages deploy dist --project-name=topolo-crm-frontend-staging"
          },
          {
            "name": "deploy:prod",
            "command": "VITE_API_URL=https://crm-api.topolo.app/api VITE_APP_NAME=TopoloCRM VITE_APP_VERSION=1.0.0 npm run build && npx wrangler pages deploy dist --project-name=topolo-crm-frontend"
          },
          {
            "name": "prepare",
            "command": "husky"
          }
        ]
      },
      {
        "path": "PlatformApplications/TopoloCRM/package.json",
        "name": "topolo-crm",
        "description": "A lightweight, production-ready CRM built entirely on Cloudflare's edge platform",
        "scripts": [
          "dev",
          "dev:app",
          "dev:all",
          "dev:full",
          "dev:stg",
          "dev:shell",
          "dev:backend",
          "dev:frontend",
          "build",
          "build:app",
          "build:all",
          "deploy:stg",
          "deploy:prod",
          "deploy:app:stg",
          "deploy:app:prod",
          "deploy:all:stg"
        ],
        "scriptCommands": [
          {
            "name": "dev",
            "command": "npm run dev --workspace=packages/backend"
          },
          {
            "name": "dev:app",
            "command": "npm run dev --workspace=app"
          },
          {
            "name": "dev:all",
            "command": "concurrently \"npm run dev\" \"npm run dev:app\""
          },
          {
            "name": "dev:full",
            "command": "node scripts/dev.js"
          },
          {
            "name": "dev:stg",
            "command": "node scripts/dev.js --db stg"
          },
          {
            "name": "dev:shell",
            "command": "bash scripts/dev.sh"
          },
          {
            "name": "dev:backend",
            "command": "node scripts/dev.js --backend-only"
          },
          {
            "name": "dev:frontend",
            "command": "node scripts/dev.js --frontend-only"
          },
          {
            "name": "build",
            "command": "npm run build --workspace=packages/backend"
          },
          {
            "name": "build:app",
            "command": "npm run build --workspace=app"
          },
          {
            "name": "build:all",
            "command": "npm run build && npm run build:app"
          },
          {
            "name": "deploy:stg",
            "command": "npm run deploy:stg --workspace=packages/backend"
          },
          {
            "name": "deploy:prod",
            "command": "npm run deploy:prod --workspace=packages/backend"
          },
          {
            "name": "deploy:app:stg",
            "command": "npm run deploy:stg --workspace=app"
          },
          {
            "name": "deploy:app:prod",
            "command": "npm run deploy:prod --workspace=app"
          },
          {
            "name": "deploy:all:stg",
            "command": "npm run deploy:stg && npm run deploy:app:stg"
          }
        ]
      },
      {
        "path": "PlatformApplications/TopoloCRM/packages/backend/package.json",
        "name": "crm",
        "scripts": [
          "dev",
          "build",
          "build:deploy",
          "deploy:dry-run",
          "deploy:stg",
          "deploy:prod",
          "start",
          "test",
          "test:coverage",
          "cf-typegen",
          "seed",
          "seed:justcook",
          "lint",
          "lint:check",
          "lint:fix",
          "typecheck"
        ],
        "scriptCommands": [
          {
            "name": "dev",
            "command": "wrangler dev"
          },
          {
            "name": "build",
            "command": "tsc --noEmit && echo 'Build validation successful'"
          },
          {
            "name": "build:deploy",
            "command": "wrangler deploy --dry-run"
          },
          {
            "name": "deploy:dry-run",
            "command": "wrangler deploy --dry-run --outdir .wrangler/build"
          },
          {
            "name": "deploy:stg",
            "command": "wrangler deploy --env stg"
          },
          {
            "name": "deploy:prod",
            "command": "wrangler deploy --env prod"
          },
          {
            "name": "start",
            "command": "wrangler dev"
          },
          {
            "name": "test",
            "command": "vitest"
          },
          {
            "name": "test:coverage",
            "command": "vitest --coverage"
          },
          {
            "name": "cf-typegen",
            "command": "npx wrangler types"
          },
          {
            "name": "seed",
            "command": "wrangler d1 execute CRM_DB --local --file=scripts/seed-simple.sql"
          },
          {
            "name": "seed:justcook",
            "command": "echo 'JustCook seed data already created manually'"
          },
          {
            "name": "lint",
            "command": "eslint . --ext .ts,.js --config .eslint.cjs --ignore-path .gitignore"
          },
          {
            "name": "lint:check",
            "command": "eslint . --ext .ts,.js --config .eslint.cjs --ignore-path .gitignore"
          },
          {
            "name": "lint:fix",
            "command": "eslint . --ext .ts,.js --fix --config .eslint.cjs --ignore-path .gitignore"
          },
          {
            "name": "typecheck",
            "command": "tsc --noEmit"
          }
        ]
      }
    ]
  },
  "data": {
    "env_vars": [
      "API_KEY_HASH_ITERATIONS",
      "API_KEY_PREFIX",
      "AUTH_API_URL",
      "ENVIRONMENT",
      "NEXUS_GATEWAY_URL",
      "NODE_ENV",
      "SALT_ROUNDS",
      "account_id"
    ],
    "bindings": [
      {
        "kind": "d1",
        "binding": "CRM_DB",
        "sourcePath": "PlatformApplications/TopoloCRM/packages/backend/wrangler.toml",
        "target": "00000000-0000-0000-0000-000000000000"
      },
      {
        "kind": "d1",
        "binding": "CRM_DB",
        "environment": "stg",
        "sourcePath": "PlatformApplications/TopoloCRM/packages/backend/wrangler.toml",
        "target": "cf93b0b6-8a56-4516-a0c7-4e2d8dee4157"
      },
      {
        "kind": "r2",
        "binding": "crm_attachments",
        "environment": "stg",
        "sourcePath": "PlatformApplications/TopoloCRM/packages/backend/wrangler.toml",
        "target": "edge-crm-attachments-staging"
      },
      {
        "kind": "d1",
        "binding": "CRM_DB",
        "environment": "prod",
        "sourcePath": "PlatformApplications/TopoloCRM/packages/backend/wrangler.toml",
        "target": "77e9aeb0-fb0d-48a7-adb1-e0ce6700ab89"
      },
      {
        "kind": "kv",
        "binding": "CRM_KV",
        "environment": "prod",
        "sourcePath": "PlatformApplications/TopoloCRM/packages/backend/wrangler.toml",
        "target": "2bf87302ccb04e43bda3c946a1d7f15b"
      },
      {
        "kind": "r2",
        "binding": "crm_attachments",
        "environment": "prod",
        "sourcePath": "PlatformApplications/TopoloCRM/packages/backend/wrangler.toml",
        "target": "edge-crm-attachments-production"
      }
    ],
    "queue_bindings": [],
    "storage_kinds": [
      "d1",
      "r2",
      "kv"
    ],
    "workflow_signals": []
  },
  "deployment": {
    "commands": [
      {
        "name": "build",
        "command": "PlatformApplications/TopoloCRM/app/package.json :: vite build"
      },
      {
        "name": "preview",
        "command": "PlatformApplications/TopoloCRM/app/package.json :: vite preview"
      },
      {
        "name": "deploy:stg",
        "command": "PlatformApplications/TopoloCRM/app/package.json :: VITE_API_URL=https://edge-crm-stg.topolo.workers.dev/api VITE_APP_NAME=TopoloCRM VITE_APP_VERSION=1.0.0 npm run build && npx wrangler pages deploy dist --project-name=topolo-crm-frontend-staging"
      },
      {
        "name": "deploy:prod",
        "command": "PlatformApplications/TopoloCRM/app/package.json :: VITE_API_URL=https://crm-api.topolo.app/api VITE_APP_NAME=TopoloCRM VITE_APP_VERSION=1.0.0 npm run build && npx wrangler pages deploy dist --project-name=topolo-crm-frontend"
      },
      {
        "name": "build",
        "command": "PlatformApplications/TopoloCRM/package.json :: npm run build --workspace=packages/backend"
      },
      {
        "name": "build:app",
        "command": "PlatformApplications/TopoloCRM/package.json :: npm run build --workspace=app"
      },
      {
        "name": "build:all",
        "command": "PlatformApplications/TopoloCRM/package.json :: npm run build && npm run build:app"
      },
      {
        "name": "deploy:stg",
        "command": "PlatformApplications/TopoloCRM/package.json :: npm run deploy:stg --workspace=packages/backend"
      },
      {
        "name": "deploy:prod",
        "command": "PlatformApplications/TopoloCRM/package.json :: npm run deploy:prod --workspace=packages/backend"
      },
      {
        "name": "deploy:app:stg",
        "command": "PlatformApplications/TopoloCRM/package.json :: npm run deploy:stg --workspace=app"
      },
      {
        "name": "deploy:app:prod",
        "command": "PlatformApplications/TopoloCRM/package.json :: npm run deploy:prod --workspace=app"
      },
      {
        "name": "deploy:all:stg",
        "command": "PlatformApplications/TopoloCRM/package.json :: npm run deploy:stg && npm run deploy:app:stg"
      },
      {
        "name": "build",
        "command": "PlatformApplications/TopoloCRM/packages/backend/package.json :: tsc --noEmit && echo 'Build validation successful'"
      },
      {
        "name": "build:deploy",
        "command": "PlatformApplications/TopoloCRM/packages/backend/package.json :: wrangler deploy --dry-run"
      },
      {
        "name": "deploy:dry-run",
        "command": "PlatformApplications/TopoloCRM/packages/backend/package.json :: wrangler deploy --dry-run --outdir .wrangler/build"
      },
      {
        "name": "deploy:stg",
        "command": "PlatformApplications/TopoloCRM/packages/backend/package.json :: wrangler deploy --env stg"
      }
    ],
    "routes": [],
    "environments": [
      "dev",
      "stg",
      "prod"
    ],
    "assets_directories": [
      "./public"
    ],
    "observability_enabled": true
  },
  "debugging": {
    "failure_modes": [],
    "entrypoints": [
      "PlatformApplications/TopoloCRM/app/wrangler.toml",
      "PlatformApplications/TopoloCRM/packages/backend/wrangler.toml",
      "PlatformApplications/TopoloCRM/packages/backend/openapi.yaml",
      "PlatformApplications/TopoloCRM/README.md",
      "PlatformApplications/TopoloCRM/app/package.json",
      "PlatformApplications/TopoloCRM/package.json",
      "PlatformApplications/TopoloCRM/packages/backend/package.json"
    ]
  }
}