# handel-hub/dmifpas architecture

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

- Interactive diagram: https://gitdiagram.com/handel-hub/dmifpas
- Repository: https://github.com/handel-hub/dmifpas

## Overview

#### Purpose and topology
DMIFPAS is a multi-part job-processing platform: an Express API accepts/authenticates users, files, and jobs; a DFPS engine plans and dispatches execution; a Main Core scores and schedules jobs. The root README provides no operational detail. Primary runnable entry points appear to be `EXPRESS/src/server.mjs` for the API and `DFPS-2.0-ENGINE/src/local-coordinator/runtime/runtimeOchestrator.mjs` for local execution coordination.

#### API and ingress boundary
The Express service exposes auth, file, job, and user routes, with controllers/services separating HTTP concerns from domain operations. Job submission is the handoff toward asynchronous processing through a queue publisher.
- `EXPRESS/src/app.mjs`
- `EXPRESS/src/server.mjs`
- `EXPRESS/src/jobs/queuePublisher.mjs`
- `EXPRESS/src/routes/jobs.routes.mjs`

#### Persistent API domain
API models cover users, files, and jobs; configuration includes a database integration. Authentication and authorization middleware protect request handling. This is the external client/data boundary rather than the execution engine.
- `EXPRESS/src/config/database.mjs`
- `EXPRESS/src/models/jobs.model.mjs`
- `EXPRESS/src/services/jobs.service.mjs`
- `EXPRESS/src/middleware/auth.mjs`

#### Local Coordinator: job normalization and DAG planning
The DFPS Local Coordinator transforms incoming job/context structures into a weighted DAG, validates schemas, and extracts/normalizes planning inputs. Its planner is a Python subprocess-oriented component, indicating a Node.js-to-Python control boundary for elastic dispatch decisions.
- `DFPS-2.0-ENGINE/src/local-coordinator/core/dag-builder/dagBuild.mjs`
- `DFPS-2.0-ENGINE/src/local-coordinator/core/schemas/job.schema.json`
- `DFPS-2.0-ENGINE/src/local-coordinator/utils/contextExtractor.mjs`
- `DFPS-2.0-ENGINE/src/local-coordinator/core/planner/Gateway.py`

#### Local execution and worker-pool control
The coordinator’s runtime orchestrates a managed process pool. Slot allocation, worker registration/actions, and memory control determine when and where DAG work can execute. Workers are batched before downstream communication, separating local process management from remote dispatch.
- `DFPS-2.0-ENGINE/src/local-coordinator/runtime/runtimeOchestrator.mjs`
- `DFPS-2.0-ENGINE/src/local-coordinator/core/pool-manager/processPoolOrchestrator.mjs`
- `DFPS-2.0-ENGINE/src/local-coordinator/core/pool-manager/slotManager.mjs`
- `DFPS-2.0-ENGINE/src/local-coordinator/infrastructure/workerBatcher.mjs`

#### State, profiling, and durability
Per-job state and CPU, I/O, memory, and time profiles feed planning/scheduling decisions. A write-ahead log provides a durability/recovery boundary, while the local queue decouples ingress from coordinator processing.
- `DFPS-2.0-ENGINE/src/local-coordinator/core/state/jobStateRegistry.mjs`
- `DFPS-2.0-ENGINE/src/local-coordinator/core/state/cpuProfile.mjs`
- `DFPS-2.0-ENGINE/src/local-coordinator/core/state/memoryProfileStore.mjs`
- `DFPS-2.0-ENGINE/src/local-coordinator/infrastructure/wal.mjs`

#### Main Core scheduling
Main Core maintains a global job queue, derives metrics and scores, applies affinity, and selects jobs through a scheduler. It is the global policy layer, distinct from the Local Coordinator’s machine/process-level dispatch.
- `DFPS-2.0-ENGINE/src/maincore/globalJobQueue.mjs`
- `DFPS-2.0-ENGINE/src/maincore/metricEngine.mjs`
- `DFPS-2.0-ENGINE/src/maincore/jobScoring.mjs`
- `DFPS-2.0-ENGINE/src/maincore/scheduler.mjs`

#### Infrastructure and protocols
The platform is primarily Node.js ES modules, with Python used for elastic planning. gRPC/protobuf artifacts define an inter-service protocol, and infrastructure includes a database adapter plus gRPC sender/server/client support. Queue and database implementations are not identifiable from the tree alone.
- `DFPS-2.0-ENGINE/files/dfps.proto`
- `DFPS-2.0-ENGINE/src/infrastructure/grpcSender.mjs`
- `DFPS-2.0-ENGINE/files/grpc-server.mjs`
- `DFPS-2.0-ENGINE/src/infrastructure/db.mjs`

Main entry points: [`DFPS-2.0-ENGINE/src/local-coordinator/runtime/runtimeOchestrator.mjs`](https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/local-coordinator/runtime/runtimeOchestrator.mjs) (Runtime Orchestrator), [`EXPRESS/src/services/jobs.service.mjs`](https://github.com/handel-hub/dmifpas/blob/main/EXPRESS/src/services/jobs.service.mjs) (Job Service), [`DFPS-2.0-ENGINE/src/local-coordinator/core/dag-builder/dagBuild.mjs`](https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/local-coordinator/core/dag-builder/dagBuild.mjs) (DAG Builder), [`DFPS-2.0-ENGINE/src/local-coordinator/core/pool-manager/processPoolOrchestrator.mjs`](https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/local-coordinator/core/pool-manager/processPoolOrchestrator.mjs) (Process Pool)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Express API"]
  node_api_server["API Server<br/>Express entry point<br/>[server.mjs]"]
  node_api_app["HTTP Application<br/>Express app<br/>[app.mjs]"]
  node_auth["Auth Middleware<br/>authorization<br/>[auth.mjs]"]
  node_job_routes["Job Routes<br/>HTTP routes<br/>[jobs.routes.mjs]"]
  node_job_service["Job Service<br/>domain service<br/>[jobs.service.mjs]"]
  node_job_model["Job Model<br/>persistent model<br/>[jobs.model.mjs]"]
  node_api_database[("API Database<br/>database integration<br/>[database.mjs]")]
  node_queue_publisher["Queue Publisher<br/>async handoff<br/>[queuePublisher.mjs]"]
end

subgraph group_coordinator["DFPS Local Coordinator"]
  node_runtime["Runtime Orchestrator<br/>local coordinator entry point"]
  node_job_queue["Local Job Queue<br/>ingress queue"]
  node_dag_planner["DAG Builder<br/>job planner<br/>[dagBuild.mjs]"]
  node_job_schema["Job Schema<br/>validation schema<br/>[job.schema.json]"]
  node_context_extractor["Context Extractor<br/>planning input"]
  node_elastic_planner{{"Elastic Planner<br/>Python planner<br/>[Gateway.py]"}}
  node_process_pool["Process Pool<br/>worker-pool control"]
  node_slot_manager["Slot Manager<br/>resource allocator<br/>[slotManager.mjs]"]
  node_worker_batcher["Worker Batcher<br/>dispatch buffer<br/>[workerBatcher.mjs]"]
  node_job_state["Job State Registry<br/>per-job state"]
  node_wal[("Write-Ahead Log<br/>durability log<br/>[wal.mjs]")]
end

subgraph group_maincore["Main Core"]
  node_global_queue["Global Job Queue<br/>global queue<br/>[globalJobQueue.mjs]"]
  node_metrics["Metric Engine<br/>metrics derivation<br/>[metricEngine.mjs]"]
  node_scoring["Job Scoring<br/>scheduling score<br/>[jobScoring.mjs]"]
  node_scheduler["Scheduler<br/>[scheduler.mjs]"]
end

subgraph group_protocol["Inter-service Infrastructure"]
  node_grpc_protocol["DFPS Protocol<br/>protobuf contract<br/>[dfps.proto]"]
  node_grpc_sender["gRPC Sender<br/>remote dispatch<br/>[grpcSender.mjs]"]
  node_grpc_server["gRPC Server<br/>service endpoint<br/>[grpc-server.mjs]"]
  node_engine_database[("Engine Database<br/>database adapter<br/>[db.mjs]")]
end

node_api_server -->|"starts"| node_api_app
node_api_app -->|"protects requests"| node_auth
node_auth -->|"authorizes"| node_job_routes
node_job_routes -->|"submits jobs"| node_job_service
node_job_service -->|"uses"| node_job_model
node_job_model -->|"persists to"| node_api_database
node_job_service -->|"publishes"| node_queue_publisher
node_queue_publisher -.->|"enqueues"| node_job_queue
node_job_queue -->|"delivers jobs"| node_runtime
node_runtime -->|"normalizes input"| node_context_extractor
node_context_extractor -->|"planning input"| node_dag_planner
node_job_schema -->|"validates"| node_dag_planner
node_dag_planner -->|"plans dispatch"| node_elastic_planner
node_runtime -->|"tracks state"| node_job_state
node_runtime -->|"logs for recovery"| node_wal
node_elastic_planner -->|"dispatches plan"| node_process_pool
node_slot_manager -->|"allocates slots"| node_process_pool
node_process_pool -->|"batches worker work"| node_worker_batcher
node_worker_batcher -->|"sends batches"| node_grpc_sender
node_grpc_sender -->|"gRPC"| node_grpc_server
node_grpc_protocol -.->|"defines messages"| node_grpc_sender
node_grpc_protocol -.->|"defines service"| node_grpc_server
node_grpc_server -->|"receives jobs"| node_global_queue
node_global_queue -->|"job data"| node_metrics
node_metrics -->|"metrics"| node_scoring
node_scoring -->|"scores and affinity"| node_scheduler
node_scheduler -->|"uses"| node_engine_database

click node_api_server "https://github.com/handel-hub/dmifpas/blob/main/EXPRESS/src/server.mjs"
click node_api_app "https://github.com/handel-hub/dmifpas/blob/main/EXPRESS/src/app.mjs"
click node_auth "https://github.com/handel-hub/dmifpas/blob/main/EXPRESS/src/middleware/auth.mjs"
click node_job_routes "https://github.com/handel-hub/dmifpas/blob/main/EXPRESS/src/routes/jobs.routes.mjs"
click node_job_service "https://github.com/handel-hub/dmifpas/blob/main/EXPRESS/src/services/jobs.service.mjs"
click node_job_model "https://github.com/handel-hub/dmifpas/blob/main/EXPRESS/src/models/jobs.model.mjs"
click node_api_database "https://github.com/handel-hub/dmifpas/blob/main/EXPRESS/src/config/database.mjs"
click node_queue_publisher "https://github.com/handel-hub/dmifpas/blob/main/EXPRESS/src/jobs/queuePublisher.mjs"
click node_runtime "https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/local-coordinator/runtime/runtimeOchestrator.mjs"
click node_dag_planner "https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/local-coordinator/core/dag-builder/dagBuild.mjs"
click node_job_schema "https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/local-coordinator/core/schemas/job.schema.json"
click node_context_extractor "https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/local-coordinator/utils/contextExtractor.mjs"
click node_elastic_planner "https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/local-coordinator/core/planner/Gateway.py"
click node_process_pool "https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/local-coordinator/core/pool-manager/processPoolOrchestrator.mjs"
click node_slot_manager "https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/local-coordinator/core/pool-manager/slotManager.mjs"
click node_worker_batcher "https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/local-coordinator/infrastructure/workerBatcher.mjs"
click node_job_state "https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/local-coordinator/core/state/jobStateRegistry.mjs"
click node_wal "https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/local-coordinator/infrastructure/wal.mjs"
click node_global_queue "https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/maincore/globalJobQueue.mjs"
click node_metrics "https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/maincore/metricEngine.mjs"
click node_scoring "https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/maincore/jobScoring.mjs"
click node_scheduler "https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/maincore/scheduler.mjs"
click node_grpc_protocol "https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/files/dfps.proto"
click node_grpc_sender "https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/infrastructure/grpcSender.mjs"
click node_grpc_server "https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/files/grpc-server.mjs"
click node_engine_database "https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/infrastructure/db.mjs"

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_api_server,node_api_app,node_auth,node_job_routes,node_job_service,node_job_model,node_api_database,node_queue_publisher toneBlue
class node_runtime,node_job_queue,node_dag_planner,node_job_schema,node_context_extractor,node_elastic_planner,node_process_pool,node_slot_manager,node_worker_batcher,node_job_state,node_wal toneAmber
class node_global_queue,node_metrics,node_scoring,node_scheduler toneMint
class node_grpc_protocol,node_grpc_sender,node_grpc_server,node_engine_database toneRose
```

## Components

### Express API

External request and persistence boundary.

- [API Server](https://github.com/handel-hub/dmifpas/blob/main/EXPRESS/src/server.mjs): Express entry point · `EXPRESS/src/server.mjs`
- [HTTP Application](https://github.com/handel-hub/dmifpas/blob/main/EXPRESS/src/app.mjs): Express app · Hosts auth, file, job, and user routes. · `EXPRESS/src/app.mjs`
- [Auth Middleware](https://github.com/handel-hub/dmifpas/blob/main/EXPRESS/src/middleware/auth.mjs): authorization · `EXPRESS/src/middleware/auth.mjs`
- [Job Routes](https://github.com/handel-hub/dmifpas/blob/main/EXPRESS/src/routes/jobs.routes.mjs): HTTP routes · `EXPRESS/src/routes/jobs.routes.mjs`
- [Job Service](https://github.com/handel-hub/dmifpas/blob/main/EXPRESS/src/services/jobs.service.mjs): domain service · `EXPRESS/src/services/jobs.service.mjs`
- [Job Model](https://github.com/handel-hub/dmifpas/blob/main/EXPRESS/src/models/jobs.model.mjs): persistent model · `EXPRESS/src/models/jobs.model.mjs`
- [API Database](https://github.com/handel-hub/dmifpas/blob/main/EXPRESS/src/config/database.mjs): database integration · Persists API users, files, and jobs. · `EXPRESS/src/config/database.mjs`
- [Queue Publisher](https://github.com/handel-hub/dmifpas/blob/main/EXPRESS/src/jobs/queuePublisher.mjs): async handoff · Publishes submitted jobs for processing. · `EXPRESS/src/jobs/queuePublisher.mjs`

### DFPS Local Coordinator

Normalizes jobs and controls local execution.

- [Runtime Orchestrator](https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/local-coordinator/runtime/runtimeOchestrator.mjs): local coordinator entry point · Coordinates local job execution. · `DFPS-2.0-ENGINE/src/local-coordinator/runtime/runtimeOchestrator.mjs`
- **Local Job Queue**: ingress queue · Decouples coordinator intake from processing.
- [DAG Builder](https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/local-coordinator/core/dag-builder/dagBuild.mjs): job planner · Validates and converts jobs into weighted DAGs. · `DFPS-2.0-ENGINE/src/local-coordinator/core/dag-builder/dagBuild.mjs`
- [Job Schema](https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/local-coordinator/core/schemas/job.schema.json): validation schema · `DFPS-2.0-ENGINE/src/local-coordinator/core/schemas/job.schema.json`
- [Context Extractor](https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/local-coordinator/utils/contextExtractor.mjs): planning input · Normalizes job and context inputs. · `DFPS-2.0-ENGINE/src/local-coordinator/utils/contextExtractor.mjs`
- [Elastic Planner](https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/local-coordinator/core/planner/Gateway.py): Python planner · Subprocess boundary for elastic dispatch decisions. · `DFPS-2.0-ENGINE/src/local-coordinator/core/planner/Gateway.py`
- [Process Pool](https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/local-coordinator/core/pool-manager/processPoolOrchestrator.mjs): worker-pool control · Manages worker processes and actions. · `DFPS-2.0-ENGINE/src/local-coordinator/core/pool-manager/processPoolOrchestrator.mjs`
- [Slot Manager](https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/local-coordinator/core/pool-manager/slotManager.mjs): resource allocator · Allocates execution slots and controls memory. · `DFPS-2.0-ENGINE/src/local-coordinator/core/pool-manager/slotManager.mjs`
- [Worker Batcher](https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/local-coordinator/infrastructure/workerBatcher.mjs): dispatch buffer · Batches worker output before remote communication. · `DFPS-2.0-ENGINE/src/local-coordinator/infrastructure/workerBatcher.mjs`
- [Job State Registry](https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/local-coordinator/core/state/jobStateRegistry.mjs): per-job state · Tracks job state and execution profiles. · `DFPS-2.0-ENGINE/src/local-coordinator/core/state/jobStateRegistry.mjs`
- [Write-Ahead Log](https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/local-coordinator/infrastructure/wal.mjs): durability log · Supports recovery of coordinator state. · `DFPS-2.0-ENGINE/src/local-coordinator/infrastructure/wal.mjs`

### Main Core

Global scheduling policy layer.

- [Global Job Queue](https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/maincore/globalJobQueue.mjs): global queue · `DFPS-2.0-ENGINE/src/maincore/globalJobQueue.mjs`
- [Metric Engine](https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/maincore/metricEngine.mjs): metrics derivation · `DFPS-2.0-ENGINE/src/maincore/metricEngine.mjs`
- [Job Scoring](https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/maincore/jobScoring.mjs): scheduling score · Applies scores and affinity. · `DFPS-2.0-ENGINE/src/maincore/jobScoring.mjs`
- [Scheduler](https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/maincore/scheduler.mjs): global scheduler · Selects jobs under global policy. · `DFPS-2.0-ENGINE/src/maincore/scheduler.mjs`

### Inter-service Infrastructure

Remote dispatch and service protocol.

- [DFPS Protocol](https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/files/dfps.proto): protobuf contract · Defines the gRPC inter-service protocol. · `DFPS-2.0-ENGINE/files/dfps.proto`
- [gRPC Sender](https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/infrastructure/grpcSender.mjs): remote dispatch · `DFPS-2.0-ENGINE/src/infrastructure/grpcSender.mjs`
- [gRPC Server](https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/files/grpc-server.mjs): service endpoint · `DFPS-2.0-ENGINE/files/grpc-server.mjs`
- [Engine Database](https://github.com/handel-hub/dmifpas/blob/main/DFPS-2.0-ENGINE/src/infrastructure/db.mjs): database adapter · `DFPS-2.0-ENGINE/src/infrastructure/db.mjs`

## Connections

- API Server → HTTP Application: starts
- HTTP Application → Auth Middleware: protects requests
- Auth Middleware → Job Routes: authorizes
- Job Routes → Job Service: submits jobs
- Job Service → Job Model: uses
- Job Model → API Database: persists to
- Job Service → Queue Publisher: publishes
- Queue Publisher → Local Job Queue: enqueues
- Local Job Queue → Runtime Orchestrator: delivers jobs
- Runtime Orchestrator → Context Extractor: normalizes input
- Context Extractor → DAG Builder: planning input
- Job Schema → DAG Builder: validates
- DAG Builder → Elastic Planner: plans dispatch
- Runtime Orchestrator → Job State Registry: tracks state
- Runtime Orchestrator → Write-Ahead Log: logs for recovery
- Elastic Planner → Process Pool: dispatches plan
- Slot Manager → Process Pool: allocates slots
- Process Pool → Worker Batcher: batches worker work
- Worker Batcher → gRPC Sender: sends batches
- gRPC Sender → gRPC Server: gRPC
- DFPS Protocol → gRPC Sender: defines messages
- DFPS Protocol → gRPC Server: defines service
- gRPC Server → Global Job Queue: receives jobs
- Global Job Queue → Metric Engine: job data
- Metric Engine → Job Scoring: metrics
- Job Scoring → Scheduler: scores and affinity
- Scheduler → Engine Database: uses
