Skip to content

Core API (server-core)

The Core API is the main REST service of PrivateAIM Hub. It manages analyses, projects, nodes, registries, and master images, and coordinates workflows through AMQP messaging.

Running

bash
# Development (from repo root)
npm run server-api

# CLI
npm run cli --workspace=apps/server-core -- start

# Docker
docker run -e ... privateaim/hub core cli start

Dependencies

  • Database — MySQL, PostgreSQL, or SQLite
  • Authup — OAuth2 identity provider
  • Redis — pub/sub and caching
  • RabbitMQ — AMQP message bus (for worker communication)
  • Harbor (optional) — Docker registry for analysis images

Environment Variables

Service-Specific

VariableDefaultDescription
HARBOR_URLHarbor registry URL
TELEMETRY_URLTelemetry service URL
VAULT_CONNECTION_STRINGstart123@http://127.0.0.1:8090/v1/Vault connection for secrets
MASTER_IMAGES_OWNERPrivateAimGitHub owner for master images
MASTER_IMAGES_REPOSITORYmaster-imagesGitHub repository name
MASTER_IMAGES_BRANCHmasterGitHub branch
SKIP_PROJECT_APPROVALfalseSkip project approval workflow
SKIP_ANALYSIS_APPROVALfalseSkip analysis approval workflow

Inherited

See Shared Configuration and Database Configuration.

Key Endpoints

MethodEndpointDescription
GET/POST/PUT/DELETE/analysesAnalysis CRUD
GET/POST/PUT/DELETE/projectsProject CRUD
GET/POST/PUT/DELETE/nodesNode CRUD
GET/POST/PUT/DELETE/registriesRegistry CRUD
GET/POST/PUT/DELETE/master-imagesMaster image CRUD
GET/docsSwagger/OpenAPI documentation

Architecture

The Core API follows the hexagonal architecture with:

  • Domain services for each entity (validation, permission checks, business logic)
  • AMQP aggregators consuming events from other services (builder, distributor, storage, authup)
  • AMQP task consumers for registry and analysis metadata processing
  • TypeORM subscribers publishing domain events on entity changes

Approval Workflows

By default, projects and analyses require administrator approval before execution. This can be disabled for development:

bash
SKIP_PROJECT_APPROVAL=true
SKIP_ANALYSIS_APPROVAL=true

See Approval Workflows for details on the approval process.

Released under the Apache-2.0 License.