cardinal

Elixir umbrella

The four umbrella apps in platform/ and what each owns.

platform/ is one Mix umbrella. mix release cardinal builds the release every node runs. The core and gate apps join the umbrella through symlinks in platform/apps/.

AppOwnsDepends on
cardinal_coreThe kernel: NIF bridge, Repo, tenants, transactions, metadata, records, permissions, auth, secrets, files, templates, PDFsRustler, Ecto, Postgrex, Argon2
cardinal_webHTTP and realtime: the router, the record and RPC API, the desk and website, the WebSocketcardinal_core, cardinal_jobs, Phoenix, Bandit
cardinal_jobsBackground jobs on Oban, mail, the scheduler, webhooks, automations' enginecardinal_core, Oban
cardinal_cliThe dev cardinal commands as mix cardinalAll of the above
coreSymlink to apps/core, the core app
gateSymlink to apps/gate, only in dev, test and CARDINAL_DEV_BUILD=1 builds

cardinal_core

ModuleRole
CardinalCore.NativeThe Elixir side of the cardinal_nif library
CardinalCore.RepoThe Ecto Postgres repo
CardinalCore.ReleaseCommands for bin/cardinal eval in a release
Cardinal.*The public app contract: Cardinal.App, Cardinal.DB, Cardinal.Rpc, Cardinal.ApiRoute, Cardinal.Realtime, Cardinal.Test and others
services/One module per operation: TxnService, TenantService, MetaService, RecordService, PermService, AuthService, SecretService, FileService, TemplateService, PdfService, RpcService and more
workers/MetaCacheWorker (the ETS table of compiled metadata), SandboxSlotsWorker (template sandbox slots), HeartbeatWorker (the node's row in platform.nodes)
priv/migrations/platform/The shared platform schema: tenants, sealed data keys, meta_version_seq, claimed_at, nodes
priv/migrations/tenant/Base tables every site schema gets

cardinal_web

ModuleRole
CardinalWeb.EndpointPhoenix on Bandit. The realtime socket, then the router
CardinalWeb.RouterPlugs, auth, setup, boot and static files
CardinalWeb.ApiRecords, meta, RPC, files, print and desk endpoints
CardinalWeb.WebsiteEvery other path, through WebsiteService
CardinalWeb.AppFrontendAn app's own frontend at /<mount>/
CardinalWeb.Plugs.Identity, Plugs.ErrorsThe Ctx for each request, and the 500 handler that writes an Error Log
CardinalWeb.RealtimeSocket, RealtimeChannelSocket connect and topic joins
RealtimeListenerWorkerThe node's LISTEN cardinal_realtime

Bandit listens only when the node serves HTTP: CARDINAL_ROLE is web or all, or under cardinal start.

cardinal_jobs

Jobs are inserted in the caller's transaction, stamped with the site, user and request id. They run in their site's transaction as that user. See Background jobs.

Apps reach it through the part of the contract in cardinal_jobs/lib/cardinal/:

ModuleDoes
Cardinal.Jobs.enqueue/4Insert a job in the caller's transaction
Cardinal.Mail.send/2Queue a mail
Cardinal.Push.send/3Queue a Web Push to each of a user's browsers
Cardinal.SMS.send/3Queue an SMS through SMS Settings
Cardinal.TelegramSend to a User's linked Telegram chat
Cardinal.AutomationThe step catalog, save checks, and resuming a waiting step

cardinal_cli

Mix.Tasks.Cardinal dispatches every command in the CLI reference. Its services do the work:

ServiceCommands
WorkspaceServiceinit, finding the workspace, starting its services, the environment it passes
ScaffoldServiceapp new
AppGetServiceapp get, app remove, the pull step of update
AppFrontendServiceDesk plugins and app frontends for build and app build
BuildServicebuild/build.json
ReleaseServicebuild --target release
I18nServicei18n extract, new, update
PerchServiceperch get, perch

priv/templates/ holds what app new --with-frontend writes and the workspace Dockerfile template.

On this page