|
| 1 | +--- |
| 2 | +title: 'Cloud Architecture' |
| 3 | +description: 'How Morphik Cloud UI and Morphik Core interact in production deployments.' |
| 4 | +--- |
| 5 | + |
| 6 | +Morphik Cloud is split into two services that communicate over HTTPS: |
| 7 | + |
| 8 | +- **Morphik Cloud UI**: The control plane that handles users, orgs, billing, and app provisioning. |
| 9 | +- **Morphik Core**: The data plane that stores documents and embeddings, runs ingestion, and serves retrieval and chat. |
| 10 | + |
| 11 | +This separation keeps your application management in the UI while all document data lives in the core API. |
| 12 | + |
| 13 | +## Components at a glance |
| 14 | + |
| 15 | +| Component | Primary role | Typical hosting | |
| 16 | +| --- | --- | --- | |
| 17 | +| Cloud UI | Auth, orgs, billing, app metadata, dashboards | Vercel (or your web host) | |
| 18 | +| Morphik Core | Ingestion, storage, retrieval, search, graphs, chat | EC2 or Kubernetes | |
| 19 | +| Embedding GPU (optional) | Multimodal embeddings (ColPali API mode) | Lambda GPU, on-prem GPU | |
| 20 | +| Postgres + pgvector | Documents, embeddings, app isolation | Neon or any Postgres | |
| 21 | +| Object storage | Raw files and chunk payloads | S3 or local disk | |
| 22 | +| Redis + worker | Async ingestion pipeline | Same VPC as core | |
| 23 | + |
| 24 | +## Morphik URI: the contract between UI and Core |
| 25 | + |
| 26 | +When you create an app, Morphik Core returns a Morphik URI: |
| 27 | + |
| 28 | +``` |
| 29 | +morphik://<app-name>:<jwt-token>@<host> |
| 30 | +``` |
| 31 | + |
| 32 | +The Cloud UI parses this URI, extracts the token, and uses it for API calls: |
| 33 | + |
| 34 | +``` |
| 35 | +Authorization: Bearer <jwt-token> |
| 36 | +``` |
| 37 | + |
| 38 | +The token contains the `app_id`, and Morphik Core uses that to isolate data per app. |
| 39 | + |
| 40 | +## Provisioning flow (control plane) |
| 41 | + |
| 42 | +App creation is a control-plane operation that provisions an app and returns a Morphik URI. |
| 43 | + |
| 44 | +```mermaid |
| 45 | +sequenceDiagram |
| 46 | + participant Browser |
| 47 | + participant UI as Cloud UI |
| 48 | + participant Core as Morphik Core |
| 49 | + participant DB as Core Postgres |
| 50 | +
|
| 51 | + Browser->>UI: Create app |
| 52 | + UI->>Core: POST /cloud/generate_uri |
| 53 | + Core->>DB: Create app + token |
| 54 | + Core-->>UI: morphik://... URI |
| 55 | + UI-->>Browser: App created |
| 56 | +``` |
| 57 | + |
| 58 | +In a dedicated-cluster setup, the UI can call the cluster directly (instead of the shared API) and pass an admin secret to mint the URI. |
| 59 | + |
| 60 | +## Runtime flow (data plane) |
| 61 | + |
| 62 | +Once an app exists, the UI talks to Morphik Core directly from the browser. Core verifies the token and scopes all reads and writes by `app_id`. |
| 63 | + |
| 64 | +### Ingestion |
| 65 | + |
| 66 | +```mermaid |
| 67 | +sequenceDiagram |
| 68 | + participant Browser |
| 69 | + participant Core as Morphik Core |
| 70 | + participant Redis |
| 71 | + participant Worker |
| 72 | + participant GPU as Embedding API |
| 73 | + participant DB as Postgres + pgvector |
| 74 | +
|
| 75 | + Browser->>Core: POST /ingest/file (Bearer token) |
| 76 | + Core->>DB: Create document record |
| 77 | + Core->>Redis: Enqueue ingestion job |
| 78 | + Worker->>GPU: Embed (ColPali API mode) |
| 79 | + Worker->>DB: Store embeddings + metadata |
| 80 | + Core-->>Browser: Ingest accepted |
| 81 | +``` |
| 82 | + |
| 83 | +If you run in local embedding mode, the worker generates embeddings on the core instance instead of calling the external GPU. |
| 84 | + |
| 85 | +### Retrieval and chat |
| 86 | + |
| 87 | +```mermaid |
| 88 | +sequenceDiagram |
| 89 | + participant Browser |
| 90 | + participant Core as Morphik Core |
| 91 | + participant DB as Postgres + pgvector |
| 92 | +
|
| 93 | + Browser->>Core: POST /query or /retrieve/chunks |
| 94 | + Core->>DB: Vector search scoped by app_id |
| 95 | + Core-->>Browser: Results and citations |
| 96 | +``` |
| 97 | + |
| 98 | +## Agent mode (server-side) |
| 99 | + |
| 100 | +Agent mode runs in a server route (Cloud UI) so it can call your LLM provider securely. The agent uses Morphik Core as a tool: |
| 101 | + |
| 102 | +- The UI calls `/api/agent/chat` on the Cloud UI. |
| 103 | +- The server route calls Morphik Core for retrieval (using the app token). |
| 104 | +- The server route streams the LLM response back to the browser. |
| 105 | + |
0 commit comments