Mainstay GitHub
All docs

Installation

Add Mainstay to a Laravel application, publish its assets, and make the first account.

Mainstay is a Composer package that runs inside the Laravel application you already have. It brings its own tables, its own admin at /admin and a content API at /api/mainstay, and answers every path your own routes do not.

Requirements

PHP 8.3 or newer, with GD
Laravel 13
Database SQLite, PostgreSQL, MySQL or SQL Server

GD is what images are resized with. Every copy is written as AVIF and WebP where your GD writes them, and in the original's own format, JPEG or PNG, where it writes no WebP: a host without them serves larger files, never broken ones. gd_info() lists what yours supports, and mainstay:media:reprocess writes a format your GD gains later.

Install the package

composer require mainstay/cms
php artisan vendor:publish --tag=mainstay-assets
php artisan migrate

The assets are the admin's built scripts, styles and fonts, copied to public/vendor/mainstay. Nothing in Mainstay asks you to run a JavaScript build. The migrations are the package's own: sites, accounts, roles, the media library, drafts, revisions, the lookup of paths, API tokens and AI connectors.

Configure it

The defaults work as they are. To change them, publish the config:

php artisan vendor:publish --tag=mainstay-config

config/mainstay.php sets where the admin is (MAINSTAY_PATH, and MAINSTAY_DOMAIN for a host of its own), the API's prefix, the middleware that runs after the admin's own (middleware), whether the public catch-all runs and with which middleware, the API's middleware (api.middleware), the content locales, the disks images are kept on, how many revisions an entry keeps (50) and which plugins load.

Turn on schema sync in development

Content types get real tables, and in development mainstay:sync keeps them in step with your classes. It is off until you turn it on, and it refuses to run in production whatever the flag says:

MAINSTAY_SCHEMA_SYNC=true

Production gets its schema from migrations you write. Run php artisan mainstay:schema:check in CI, against a database built by those migrations: it lists what differs from your classes and fails until a migration covers it. It is not read-only: it creates a scratch table for each type to compare against, and drops it again.

Make the first account

There is no public sign-up, so a new server has no page the first visitor could claim. Make the first one on the server; it asks for a name and a password:

php artisan mainstay:user [email protected] --role=administrator

Then sign in at /admin and invite everyone else from Users.

Upgrading

After upgrading the package, publish the assets again with --force. An upgrade can add a column Mainstay keeps for itself, so run mainstay:schema:check in CI against a database built by your migrations before you deploy, and write a migration for anything it reports.