Buy Me a Coffee GitHub Sponsors

Mishka CMS Core

The engine of Mishka CMS: a multi-tenant runtime, accounts and an admin dashboard for Elixir and Phoenix LiveView.

Website ยท Documentation ยท Extensions ยท Hire us

๐Ÿ“– What is Mishka CMS Core?

mishka_cms_core is an Elixir library built on Ash and Phoenix LiveView. It holds the resources and the runtime that turn database rows into running websites: sites, pages, layouts, components, error pages, stylesheets, JavaScript hooks, media, translations, redirects and settings. It also holds user accounts, permissions, notifications, the admin dashboard screens and the document layer every authored template goes through. The visual page builder is a separate package, mishka_cms_builder, which a host adds when it wants the editor.

The package has no endpoint, router or repo of its own. The host application supplies them through the config shown under Getting started.

๐Ÿงฉ Part of Mishka CMS

mishka_cms_core is the core of Mishka CMS, an open source real-time CMS. The mishka_cms application runs it, and the visual page builder (mishka_cms_builder), the blog extension (mishka_blog) and the documentation extension (mishka_document) are built on it.

โœจ Features

๐Ÿ” Permissions

An admin permission is a plain string, admin:<surface>:<area>. The surface is dashboard for the admin screens and the data they use, or api for the JSON:API. Examples are admin:dashboard:runtime:page and admin:api:blog:post. A * as the whole last segment covers everything below it (admin:dashboard:*, admin:*), and * alone covers everything. A master is a user that belongs to no site.

๐Ÿ”Œ Extending it

Every create, update and destroy action on a resource that lists MishkaCmsCore.Runtime.Resources.Notifiers.PluginHook fires a Mishka Installer event named <app>:<resource>:after_<action>, such as blog:comment:after_create, and a create or update also fires <app>:<resource>:after_save. A plugin listens like this:

use MishkaInstaller.Event.Hook,
  event: MishkaCmsCore.Runtime.Resources.Notifiers.PluginHook.event_name(MishkaBlog.BlogPost, :publish)

An extension adds routes with the MishkaCmsCore.ExtensionRouter behaviour, adds sidebar entries on the sidebar:menus event, and appears in the install wizard by subscribing to installer:extension:install.

An editor is an extension too. mishka_cms_builder adds its pages that way, answers runtime:document:editor_url with the address of its editor (the admin shows an editor button only when one answers), writes the snippets of an extension's setup on runtime:provision:snippets, adds its history to the activity log on activity:sources and registers its settings on settings:register. A plugin for the editor listens on the builder:* events of MishkaCmsCore.Builder.Events, which stay in the core so an extension can ship one without depending on the editor.

๐Ÿš€ Getting started

Add it from Hex:

{:mishka_cms_core, "~> 0.0.3"}

Mishka CMS loads it from __extensions/mishka_cms_core instead when that folder exists.

Mishka CMS also tells the package which repo, endpoint and web module to use, and which extensions are installed:

config :mishka_cms_core,
  repo: MishkaCms.Repo,
  endpoint: MishkaCmsWeb.Endpoint,
  host_app: :mishka_cms,
  web_module: MishkaCmsWeb,
  core_components: MishkaCmsWeb.CoreComponents

config :mishka_cms_core,
  extensions: [MishkaCmsCoreWeb, MishkaBlogWeb, MishkaDocumentWeb, MishkaCmsBuilderWeb]

config :mishka_cms,
  ash_domains: [
    MishkaCmsBuilder,
    MishkaDocument,
    MishkaBlog,
    MishkaCmsCore.Runtime,
    MishkaCmsCore.Accounts,
    MishkaCmsCore.Notify,
    MishkaCmsCore.Mail
  ]

MishkaCmsBuilderWeb and MishkaCmsBuilder are the visual page builder's; leave them out to run without it.

To run it, follow Getting started in mishka_cms. To work on the engine, check out the packages side by side under __extensions/ in a mishka_cms clone, and Mishka CMS uses those folders:

git clone https://github.com/mishka-group/mishka_cms.git
cd mishka_cms
git clone https://github.com/mishka-group/mishka_gervaz.git __extensions/mishka_gervaz
git clone https://github.com/mishka-group/mishka_cms_core.git __extensions/mishka_cms_core
git clone https://github.com/mishka-group/mishka_cms_builder.git __extensions/mishka_cms_builder
git clone https://github.com/mishka-group/mishka_blog.git __extensions/mishka_blog
git clone https://github.com/mishka-group/mishka_document.git __extensions/mishka_document

๐Ÿ“š Documentation

๐Ÿ’ฌ Community and support

๐Ÿ’– Support the project

Mishka CMS is free and open source. You can support its development through GitHub Sponsors or Buy Me a Coffee.

๐Ÿ“œ License

Apache License 2.0. See LICENSE.