API Reference phoenix_kit v#2.63.0

Copy Markdown View Source

Modules

PhoenixKit

The rights of a person behind an admin page, read again from the database.

Who is calling the API: a key (with its owner and effective scopes) or an anonymous public caller.

The approval queue of dangerous API operations (the approval path of the dangerous-operation flow): the calls of a key marked "requires approval" that would be dangerous wait here for a person.

The "approval waiting" notice: when an approval is queued, those who may decide it get an in-app notification, at most one per API key per ten minutes, and an unread one is refreshed instead of repeated.

Plug that admits a request to the shop API: steps 1 to 3 of the request flow (API switch, refusal of a credential in the URL, authentication; PhoenixKit.API.Executor runs the rest). The order below is the order of the code.

Endpoint plug that bounds and parses the body of API requests and normalises the percent-encoded prefix of an API path (see "Encoded segments of the path" below).

The canonical form of a tool's arguments, and the hash that binds a confirmation code, an approval and an idempotency key to a request.

Settings accessors for the shop API.

Confirmation codes of dangerous API operations, and the helpers the approval queue shares.

The confirmation code string of a dangerous API operation: ct_<row uuid>_<mac>.

The fields the executor adds to the input of every write tool: modules never declare them.

The tools core itself provides, in the system namespace.

The request flow of the shop API: what happens between "this key is authentic" and "here is the response".

Steps 7 and 8 of the request flow, written as small functions over the executor's request state so PhoenixKit.API.Executor.execute/4 stays a plain chain

Settings of the dangerous-operation flow of the shop API: when an operation needs a confirmation, how long a code, an approval and a stored idempotent answer live.

Idempotent writes for the shop API: a client that retries a request with the same Idempotency-Key gets the first answer back, and never a second write.

API keys: creating, verifying, revoking and rotating the bearer tokens of the admin API.

The IP allow-list of an API key: a list of CIDR blocks stored as text.

A 60 second cache of API key rows, keyed by token prefix.

A one-time token held by the Settings LiveView. Inspection redacts its value so LiveView termination reports cannot print it; HTML rendering still shows it once.

The API key token format: pk_<prefix>_<secret>.

What the API may write to the server log about a term that came from a request or from code that handled one.

The MCP transport of the shop API: Model Context Protocol over Streamable HTTP, tools only, stateless, JSON answers only. A plug that the router forwards to, once per audience

Tool names on MCP.

The Origin check of the MCP transport, against DNS rebinding.

The JSON-RPC 2.0 envelope of the MCP transport: classifying a decoded request body and building and sending answers.

How tools, results and errors look on MCP.

The MCP protocol revisions this server knows, and which of them it speaks.

The OpenAPI 3.1 document of the shop API, generated from the tool registry.

The output schema a client is told a tool answers with: MCP's outputSchema and the 200 response of the OpenAPI document.

RFC 9457 application/problem+json errors for the shop API.

The REST transport of the shop API: a plug that the router forwards to, once per audience.

Rate limits of the shop API.

The tools the API can serve right now.

What the API knows about the request besides who sent it: the language and currency to answer in, the hosts this install serves, and the base URL for absolute links.

Service users: accounts that exist only to own API keys.

One operation a module offers through the API (REST today, MCP later).

Static checks for API tools, for the test suite of every module that declares PhoenixKit.Module.api_tools/0.

A small JSON Schema validator for the input of API tools.

Activity feed for tracking business-level actions across the platform.

Context for phoenix_kit_annotations — drawn-on-image shapes created via the Etcher overlay layer in the MediaBrowser modal.

Context for managing audit logs in PhoenixKit.

Generic caching system for PhoenixKit with ETS-backed storage.

Lightweight Registry wrapper for PhoenixKit.Cache instances.

Configuration management system for PhoenixKit.

User Dashboard Tab Management System.

Defines badge types for dashboard tab indicators.

Configuration and helpers for the dashboard context selector.

Struct representing a dashboard tab group.

Registry for managing dashboard tabs across the application.

Defines the Tab struct and related types for the user dashboard navigation system.

Centralized management of external service integrations.

Job runs: long background work an admin can watch and control.

Live catalog of known external PhoenixKit packages fetched from Hex.pm.

Configuration manager for PhoenixKit layout integration.

Mailer module for PhoenixKit emails.

Builds the gen_smtp/Swoosh connection options for an SMTP integration.

Cross-module @ pings and # record links.

Migrations create and modify the database tables PhoenixKit needs to function.

Behaviour for PhoenixKit feature modules (internal and external).

Zero-config auto-discovery of external PhoenixKit modules.

Runtime registry of all PhoenixKit modules (internal and external).

Per-user notifications driven by PhoenixKit.Activity.

The Oban cron jobs installed modules declare, so a host does not have to copy them into its config by hand.

The Oban queues PhoenixKit and its modules need, declared where the work is defined rather than hand-copied into a host's config.

Keeps a host's Oban schema in step with the Oban library it runs.

PubSub Manager for PhoenixKit admin live updates.

Helper for dynamically resolving the PubSub server to use.

Helper for dynamically resolving the repository to use.

Resolves (resource_type, resource_uuid) pairs into navigable deep-links to the underlying resource — the record an action happened on or a comment is attached to.

Context module for managing scheduled jobs.

Applies the configured schema prefix to a PhoenixKit Ecto schema.

The Settings context for system configuration management.

System dependency checker for PhoenixKit.

Test fixtures and session helpers for host applications.

Theme configuration utilities for PhoenixKit's DaisyUI integration.

Host hook for core's own uploads (user avatars, branding logos, media selector uploads with a scope)

The role a session is currently acting as.

The Auth context for user authentication and management.

Scope module for encapsulating PhoenixKit authentication state.

User schema for PhoenixKit authentication system.

Context for managing custom user field definitions.

Context for organization invitation lifecycle management.

Magic Link authentication system for PhoenixKit.

Context for module-level permissions in PhoenixKit.

Rate limiting for authentication endpoints to prevent brute-force attacks.

API for managing user roles in PhoenixKit.

Context for managing user sessions in PhoenixKit.

Allowlist validation for operator-supplied values that are embedded in CSS.

Date and time formatting utilities for PhoenixKit.

Workspace-shared formatting helpers for numeric / size values.

IP Geolocation utilities for PhoenixKit.

Curated list of Heroicons for use in the application. Icons are grouped by category for easy browsing.

HTML sanitization for user-supplied rich text.

Utilities for extracting and formatting IP addresses.

Thin helper around Elixir's built-in JSON module (1.18+) for the one thing it doesn't provide: pretty-printing.

Multi-language data transformation helpers for entity data JSONB.

Number formatting and parsing utilities for PhoenixKit.

Page-number arithmetic for paginated lists.

Utilities for detecting and working with Phoenix framework versions.

Whether an IP address is a globally routable unicast address — the only kind a server-side fetch of a user-supplied URL may connect to.

Resolves which locale a message should be rendered in for a given recipient.

Two-phase index rewrite for drag-to-reorder list views.

Utility functions for working with PhoenixKit routes and URLs.

Session fingerprinting utilities for preventing session hijacking.

Helpers for generating consistent, URL-friendly slugs across PhoenixKit.

Timezone identity for users and for the site: the picker list, the label for a stored value, and the one place a DateTime is moved into someone's zone.

Nested trees for pickers (PhoenixKitWeb.Components.TreePicker): built from a flat, parent-linked list, and the pure operations a picker needs over them — so no module shows nested records as an indented flat list.

Recursive queries over a self-referencing table — a schema whose rows point at a parent row of the same schema (parent_uuid by default). Each call is one recursive CTE: subtrees for cascades and moves, ancestors for breadcrumbs and cycle checks.

Utilities for working with UUIDs.

Deliberately small, allocation-light User-Agent sniffing.

Small value-handling helpers used across the workspace.

Website access: one settings page, a list of independently switchable features.

The web interface for PhoenixKit.

Who is acting, read from a LiveView socket, a Plug.Conn or an assigns map — the one place modules ask, instead of each reading its own assign.

Public API for an "Edit" link from a public page into its matching admin page.

Accepts a picture with its annotations already drawn into it, and stores that rendering as display variants.

Controller for serving PhoenixKit static assets.

The pieces every module's file form shares, so each upload behaves the same wherever it happens: the upload config, storing a finished upload into a record's folder, the messages people see, and the files grid's featured-image and order rules.

Legacy authentication router for PhoenixKit.

Forwards Leaf rich-text editor process messages to the optional phoenix_kit_comments package.

Admin navigation components for the PhoenixKit admin panel. Provides consistent navigation elements for both desktop sidebar and mobile drawer.

Focused composer LiveComponent for attaching the first comment to a newly-drawn Etcher annotation in the MediaBrowser modal sidebar.

Wrapper component for all auth pages (login, registration, etc.).

One entity's "main image" control: a thumbnail, an always-visible actions menu (Change / Remove, plus View when a preview is wired up) and the whole media-picker protocol behind it.

Reusable folder explorer sidebar — folder tree, navigation buttons, inline rename, and (optional) Trash / All Files / New Folder controls.

Edits a stored image after upload — crop, rotate, flip, straighten, redact, brightness and contrast — through PhoenixKit.Modules.Storage.ImageEditing.

Stacked alert banners for pending organization invitations.

Shared language switcher component for PhoenixKit.

Dynamic layout wrapper component for Phoenix v1.7- and v1.8+ compatibility.

MediaBrowser LiveComponent — embeddable media management UI.

The media browser's template and the helpers it draws with.

Per-file viewer LiveComponent: <Fresco.canvas> + <Etcher.layer> for images, video / PDF / icon fallback for other types, plus a sidebar with filename + Download + metadata + comments thread. Owns the annotation lifecycle (composer popover, persistence sync via EtcherAdapter, the patch-shape / delete-shape JS bridges).

A general-purpose LiveComponent for selecting, ordering, previewing and removing a set of images.

Standalone media lightbox ("slide box") LiveComponent.

Shared multilang form components and helpers for PhoenixKit modules.

OAuth authentication buttons component for Google, GitHub, and Facebook Sign-In.

The tabs of the signed-in user's own settings, /profile/settings/<tab>.

The pre-paint theme setup — palettes plus the stamp script — renders in <head>, before (or with) the stylesheets.

The one theme-controller script — the behavior behind every element the PhoenixKitWeb.Components.Core.ThemeController picker renders.

A searchable, collapsible tree for picking one record — or several — out of a nested set (a parent category, a folder, a page), instead of an indented flat <select>. Build the tree with PhoenixKit.Utils.Tree.

User dashboard navigation components for the PhoenixKit user dashboard. Provides navigation elements specifically for user dashboard pages.

Controller for handling dashboard context switching.

Cookie consent widget configuration, for the JS bundle's manual window.PhoenixKitConsent.init() entry point.

LiveView on_mount hook for loading dashboard contexts.

LiveView on_mount hook for initializing dashboard tabs with context-aware badge values.

This module is invoked by your endpoint in case of errors on HTML requests.

This module is invoked by your endpoint in case of errors on JSON requests.

File serving controller with signed URL support.

A module providing Internationalization with a gettext-based API.

Helper functions for integrating the media selector component.

LiveView on_mount hook for organization invitation banners.

Integration helpers for adding PhoenixKit to Phoenix applications.

Helper functions for working with PhoenixKit layouts efficiently.

This module holds different layouts used by your application.

Serves phoenix_kit_catalogue's vendored PDF.js viewer assets through the router.

PhoenixKit library router.

Which columns a table shows, and in what order, for each user — stored as the "columns" field of the user's PhoenixKit.Users.ViewPrefs for the table's key, edited through core's live column_settings_modal/1.

File upload controller for handling multipart uploads.

The password gate's pages — deliberately plain: a visitor who does not know the password sees a blank page with one field and nothing else, no site name, no login, no layout.

Mix Tasks

Mix compiler that auto-generates CSS @source directives for PhoenixKit modules.

Mix compiler that vendors PhoenixKit's JS hooks into the host app.

Rebuilds assets for PhoenixKit using standard Phoenix asset pipeline.

Finds orphaned media files in PhoenixKit Storage and optionally moves them to the trash.

Collapses a consumer app's accumulated PhoenixKit wrapper migrations into ONE migration file.

Diagnoses PhoenixKit installation, migration, and runtime issues.

Igniter task that generates admin page with automatic route registration.

Generate a PhoenixKit versioned migration for the parent application.

Igniter task that generates a user dashboard page with tab configuration.

Igniter installer for PhoenixKit.

Rotates the encryption key protecting stored integration credentials AND restricted PhoenixKit.Settings values (oauth_*_client_secret, aws_* — see PhoenixKit.Settings.restricted_setting_keys/0). Both are encrypted under the same resolved key, so both must rotate together.

Moves every module's legacy media folders to where the host's attachments_parent_folder / attachments_folder_name hooks now put new ones.

Modernizes PhoenixKit layout integration for Phoenix v1.8+ compatibility.

Runs the PhoenixKit install steps that must happen AFTER the installer's file changes have landed on disk.

Asserts release-metadata consistency before publishing to Hex.

Verifies and additively repairs a PhoenixKit installation against the generated PhoenixKit.Migrations.ExpectedSchema manifest (spec §6).

Repairs phoenix_kit_* tables whose uuid column is the wrong type, nullable, or not the primary key.

Shows comprehensive status of PhoenixKit installation.

Dates the images and videos stored before capture dates existed (V200).

Igniter-based updater for PhoenixKit.