# apache/predictionio architecture

> Architecture diagram of the GitHub repository apache/predictionio, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/apache/predictionio
- Repository: https://github.com/apache/predictionio

## Overview

Apache PredictionIO is a machine-learning framework for collecting events, configuring engines, training and evaluating algorithms, deploying prediction services, and querying results through REST APIs. The graph highlights that user journey plus app/access-key administration, storage backends, webhook ingestion, and plugin extension points. The sampled Engine implementation shows training data being read, prepared, and passed to algorithms; other links are limited to explicit README capability statements or SOURCE INDEX references. Workflow, API-server, and CLI internals are not fully sampled, so their connections are shown only where supported.

Main entry points: [`core/src/main/scala/org/apache/predictionio/controller/Engine.scala`](https://github.com/apache/predictionio/blob/develop/core/src/main/scala/org/apache/predictionio/controller/Engine.scala) (Engine runtime), [`data/src/main/scala/org/apache/predictionio/data/storage/LEvents.scala`](https://github.com/apache/predictionio/blob/develop/data/src/main/scala/org/apache/predictionio/data/storage/LEvents.scala) (Event storage), [`tools/src/main/scala/org/apache/predictionio/tools/commands/App.scala`](https://github.com/apache/predictionio/blob/develop/tools/src/main/scala/org/apache/predictionio/tools/commands/App.scala) (App administration), [`data/src/main/scala/org/apache/predictionio/data/api/EventServer.scala`](https://github.com/apache/predictionio/blob/develop/data/src/main/scala/org/apache/predictionio/data/api/EventServer.scala) (Event server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Event Ingestion"]
  node_events_api["Event server<br/>[EventServer.scala]"]
  node_webhooks["Webhook connectors<br/>[Webhooks.scala]"]
  node_event_model["Event model<br/>[Event.scala]"]
  node_event_store[("Event storage<br/>[LEvents.scala]")]
end

subgraph group_engine["Engine Lifecycle"]
  node_engine_config["Engine parameters<br/>[EngineParams.scala]"]
  node_engine_runtime["Engine runtime<br/>[Engine.scala]"]
  node_data_source["Training data source"]
  node_preparator["Data preparator"]
  node_algorithm["Algorithm"]
  node_workflow["Training workflow"]
  node_evaluation["Evaluation<br/>[Evaluation.scala]"]
end

subgraph group_serving["Serving and Extensions"]
  node_rest_api["Prediction REST API<br/>[CreateServer.scala]"]
  node_plugins["Server plugins"]
end

subgraph group_platform["Management and Storage"]
  node_engine_instances[("Engine instances")]
  node_app_admin["App administration<br/>[App.scala]"]
  node_access_keys["Access keys<br/>[AccessKey.scala]"]
  node_storage_config["Storage configuration<br/>[Storage.scala]"]
  node_storage_backends[("Storage backends")]
  node_developer_api["Developer API annotation<br/>[DeveloperApi.java]"]
  node_experimental_api["Experimental annotation<br/>[Experimental.java]"]
end

node_developer(("Developer or user"))

node_developer -.->|"submits events"| node_events_api
node_developer -.->|"connects sources"| node_webhooks
node_developer -.->|"configures engine"| node_engine_config
node_developer -.->|"evaluates algorithms"| node_evaluation
node_developer -.->|"queries predictions"| node_rest_api
node_engine_runtime -->|"reads training data"| node_data_source
node_engine_runtime -->|"prepares data"| node_preparator
node_engine_runtime -->|"trains model"| node_algorithm
node_engine_runtime -->|"configures workflow"| node_workflow
node_engine_runtime -->|"uses parameters"| node_engine_config
node_workflow -.->|"records runs"| node_engine_instances
node_event_model -.->|"persists events"| node_event_store
node_events_api -.->|"stores events"| node_event_store
node_webhooks -->|"forwards events"| node_event_store
node_app_admin -->|"uses storage"| node_storage_config
node_storage_config -.->|"configures clients"| node_storage_backends
node_app_admin -->|"manages keys"| node_access_keys
node_engine_runtime -->|"uses API"| node_developer_api
node_plugins -.->|"extends server"| node_rest_api

click node_events_api "https://github.com/apache/predictionio/blob/develop/data/src/main/scala/org/apache/predictionio/data/api/EventServer.scala"
click node_webhooks "https://github.com/apache/predictionio/blob/develop/data/src/main/scala/org/apache/predictionio/data/api/Webhooks.scala"
click node_event_model "https://github.com/apache/predictionio/blob/develop/data/src/main/scala/org/apache/predictionio/data/storage/Event.scala"
click node_event_store "https://github.com/apache/predictionio/blob/develop/data/src/main/scala/org/apache/predictionio/data/storage/LEvents.scala"
click node_engine_config "https://github.com/apache/predictionio/blob/develop/core/src/main/scala/org/apache/predictionio/controller/EngineParams.scala"
click node_engine_runtime "https://github.com/apache/predictionio/blob/develop/core/src/main/scala/org/apache/predictionio/controller/Engine.scala"
click node_data_source "https://github.com/apache/predictionio/blob/develop/core/src/main/scala/org/apache/predictionio/core/BaseDataSource.scala"
click node_preparator "https://github.com/apache/predictionio/blob/develop/core/src/main/scala/org/apache/predictionio/core/BasePreparator.scala"
click node_algorithm "https://github.com/apache/predictionio/blob/develop/core/src/main/scala/org/apache/predictionio/core/BaseAlgorithm.scala"
click node_workflow "https://github.com/apache/predictionio/blob/develop/core/src/main/scala/org/apache/predictionio/workflow/CreateWorkflow.scala"
click node_evaluation "https://github.com/apache/predictionio/blob/develop/core/src/main/scala/org/apache/predictionio/controller/Evaluation.scala"
click node_engine_instances "https://github.com/apache/predictionio/blob/develop/data/src/main/scala/org/apache/predictionio/data/storage/EngineInstances.scala"
click node_rest_api "https://github.com/apache/predictionio/blob/develop/core/src/main/scala/org/apache/predictionio/workflow/CreateServer.scala"
click node_plugins "https://github.com/apache/predictionio/blob/develop/core/src/main/scala/org/apache/predictionio/workflow/EngineServerPluginContext.scala"
click node_app_admin "https://github.com/apache/predictionio/blob/develop/tools/src/main/scala/org/apache/predictionio/tools/commands/App.scala"
click node_access_keys "https://github.com/apache/predictionio/blob/develop/tools/src/main/scala/org/apache/predictionio/tools/commands/AccessKey.scala"
click node_storage_config "https://github.com/apache/predictionio/blob/develop/data/src/main/scala/org/apache/predictionio/data/storage/Storage.scala"
click node_storage_backends "https://github.com/apache/predictionio/blob/develop/storage/elasticsearch/src/main/scala/org/apache/predictionio/data/storage/elasticsearch/StorageClient.scala"
click node_developer_api "https://github.com/apache/predictionio/blob/develop/common/src/main/java/org/apache/predictionio/annotation/DeveloperApi.java"
click node_experimental_api "https://github.com/apache/predictionio/blob/develop/common/src/main/java/org/apache/predictionio/annotation/Experimental.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_events_api,node_webhooks,node_event_model,node_event_store,node_developer toneBlue
class node_engine_config,node_engine_runtime,node_data_source,node_preparator,node_algorithm,node_workflow,node_evaluation toneAmber
class node_rest_api,node_plugins toneMint
class node_engine_instances,node_app_admin,node_access_keys,node_storage_config,node_storage_backends,node_developer_api,node_experimental_api toneRose
```

## Components

### Event Ingestion

- [Event server](https://github.com/apache/predictionio/blob/develop/data/src/main/scala/org/apache/predictionio/data/api/EventServer.scala): `data/src/main/scala/org/apache/predictionio/data/api/EventServer.scala`
- [Webhook connectors](https://github.com/apache/predictionio/blob/develop/data/src/main/scala/org/apache/predictionio/data/api/Webhooks.scala): `data/src/main/scala/org/apache/predictionio/data/api/Webhooks.scala`
- [Event model](https://github.com/apache/predictionio/blob/develop/data/src/main/scala/org/apache/predictionio/data/storage/Event.scala): `data/src/main/scala/org/apache/predictionio/data/storage/Event.scala`
- [Event storage](https://github.com/apache/predictionio/blob/develop/data/src/main/scala/org/apache/predictionio/data/storage/LEvents.scala): `data/src/main/scala/org/apache/predictionio/data/storage/LEvents.scala`

### Engine Lifecycle

- [Engine parameters](https://github.com/apache/predictionio/blob/develop/core/src/main/scala/org/apache/predictionio/controller/EngineParams.scala): `core/src/main/scala/org/apache/predictionio/controller/EngineParams.scala`
- [Engine runtime](https://github.com/apache/predictionio/blob/develop/core/src/main/scala/org/apache/predictionio/controller/Engine.scala): `core/src/main/scala/org/apache/predictionio/controller/Engine.scala`
- [Training data source](https://github.com/apache/predictionio/blob/develop/core/src/main/scala/org/apache/predictionio/core/BaseDataSource.scala): `core/src/main/scala/org/apache/predictionio/core/BaseDataSource.scala`
- [Data preparator](https://github.com/apache/predictionio/blob/develop/core/src/main/scala/org/apache/predictionio/core/BasePreparator.scala): `core/src/main/scala/org/apache/predictionio/core/BasePreparator.scala`
- [Algorithm](https://github.com/apache/predictionio/blob/develop/core/src/main/scala/org/apache/predictionio/core/BaseAlgorithm.scala): `core/src/main/scala/org/apache/predictionio/core/BaseAlgorithm.scala`
- [Training workflow](https://github.com/apache/predictionio/blob/develop/core/src/main/scala/org/apache/predictionio/workflow/CreateWorkflow.scala): `core/src/main/scala/org/apache/predictionio/workflow/CreateWorkflow.scala`
- [Evaluation](https://github.com/apache/predictionio/blob/develop/core/src/main/scala/org/apache/predictionio/controller/Evaluation.scala): `core/src/main/scala/org/apache/predictionio/controller/Evaluation.scala`

### Serving and Extensions

- [Prediction REST API](https://github.com/apache/predictionio/blob/develop/core/src/main/scala/org/apache/predictionio/workflow/CreateServer.scala): `core/src/main/scala/org/apache/predictionio/workflow/CreateServer.scala`
- [Server plugins](https://github.com/apache/predictionio/blob/develop/core/src/main/scala/org/apache/predictionio/workflow/EngineServerPluginContext.scala): `core/src/main/scala/org/apache/predictionio/workflow/EngineServerPluginContext.scala`

### Management and Storage

- [Engine instances](https://github.com/apache/predictionio/blob/develop/data/src/main/scala/org/apache/predictionio/data/storage/EngineInstances.scala): `data/src/main/scala/org/apache/predictionio/data/storage/EngineInstances.scala`
- [App administration](https://github.com/apache/predictionio/blob/develop/tools/src/main/scala/org/apache/predictionio/tools/commands/App.scala): `tools/src/main/scala/org/apache/predictionio/tools/commands/App.scala`
- [Access keys](https://github.com/apache/predictionio/blob/develop/tools/src/main/scala/org/apache/predictionio/tools/commands/AccessKey.scala): `tools/src/main/scala/org/apache/predictionio/tools/commands/AccessKey.scala`
- [Storage configuration](https://github.com/apache/predictionio/blob/develop/data/src/main/scala/org/apache/predictionio/data/storage/Storage.scala): `data/src/main/scala/org/apache/predictionio/data/storage/Storage.scala`
- [Storage backends](https://github.com/apache/predictionio/blob/develop/storage/elasticsearch/src/main/scala/org/apache/predictionio/data/storage/elasticsearch/StorageClient.scala): `storage/elasticsearch/src/main/scala/org/apache/predictionio/data/storage/elasticsearch/StorageClient.scala`
- [Developer API annotation](https://github.com/apache/predictionio/blob/develop/common/src/main/java/org/apache/predictionio/annotation/DeveloperApi.java): `common/src/main/java/org/apache/predictionio/annotation/DeveloperApi.java`
- [Experimental annotation](https://github.com/apache/predictionio/blob/develop/common/src/main/java/org/apache/predictionio/annotation/Experimental.java): `common/src/main/java/org/apache/predictionio/annotation/Experimental.java`

### Other components

- **Developer or user**

## Connections

- Developer or user → Event server: submits events
- Developer or user → Webhook connectors: connects sources
- Developer or user → Engine parameters: configures engine
- Developer or user → Evaluation: evaluates algorithms
- Developer or user → Prediction REST API: queries predictions
- Engine runtime → Training data source: reads training data (evidence: `core/src/main/scala/org/apache/predictionio/controller/Engine.scala`)
- Engine runtime → Data preparator: prepares data (evidence: `core/src/main/scala/org/apache/predictionio/controller/Engine.scala`)
- Engine runtime → Algorithm: trains model (evidence: `core/src/main/scala/org/apache/predictionio/controller/Engine.scala`)
- Engine runtime → Training workflow: configures workflow (evidence: `core/src/main/scala/org/apache/predictionio/controller/Engine.scala`)
- Engine runtime → Engine parameters: uses parameters (evidence: `core/src/main/scala/org/apache/predictionio/controller/Engine.scala`)
- Training workflow → Engine instances: records runs
- Event model → Event storage: persists events (evidence: `data/src/main/scala/org/apache/predictionio/data/storage/LEvents.scala`)
- Event server → Event storage: stores events
- Webhook connectors → Event storage: forwards events (evidence: `data/src/main/scala/org/apache/predictionio/data/api/Webhooks.scala`)
- App administration → Storage configuration: uses storage (evidence: `tools/src/main/scala/org/apache/predictionio/tools/commands/App.scala`)
- Storage configuration → Storage backends: configures clients
- App administration → Access keys: manages keys (evidence: `tools/src/main/scala/org/apache/predictionio/tools/commands/App.scala`)
- Engine runtime → Developer API annotation: uses API (evidence: `core/src/main/scala/org/apache/predictionio/controller/Engine.scala`)
- Server plugins → Prediction REST API: extends server
