Module Architecture

Module Architecture

iSPA CMS organises features as Laravel modules in the cms/ folder. The public release contains three modules: Core, Content and Widget. Other modules are installed from iSPA Hub or written by you.

Folder layout

PathWhat it holds
app/, config/, routes/The Laravel application
cms/<Module>/Modules: code, routes, admin screens (admin/), translations and migrations
projects/<Name>/Site themes; projects/Default/ ships with the release
admin/Sources of the iPanel admin (Vue 3)
public/iPanel/The built admin

Principles

  • Modules own their code. Keep a change inside the module it belongs to and do not move logic across modules.
  • Layers. Controllers stay thin; business logic goes in services, data access in repositories.
  • Admin API. Records that have a uuid column are identified by it in the V2 admin API, never by the numeric id.
  • Public pages. A module's public pages are declared in the module and render with the active project's layout; templates use Blade and Tailwind utility classes.
  • Translations. To change a wording, change the text of the existing key instead of adding a replacement key.
  • Every module has a module.json with its name, description, CalVer version and the core version it requires (requires).

Create a new module

php artisan cms:make-module <Name> --mode=lite|normal|full --entity=<Entity>

The command writes cms/<Name> with a working sample entity: admin API, permissions and tests (lite); plus the admin page and translations (normal); plus public pages, a scheduled command, a queued mail and events (full).

See which modules you have

php artisan cms:module-status           # list modules and their state
php artisan cms:module-status set <Name> on|off

In the admin, see Modules and iSPA Hub.

Licence

The core and the modules in the source repository are licensed under AGPL-3.0-only. Premium modules offered through iSPA Hub are not part of the public repository.