SaaS plugin

Getting started

Installation

The SaaS plugin is distributed from the NoCoffee private gem server. After you have access, add the private source and gems to your Gemfile (exact version constraints are given with your subscription).

Your application database must exist before running installers: bundle exec rails db:create

Add lines similar to the following (replace the source URL and credentials with those you received):

Gemfile

source "https://<your-credentials>@packages.nocoffee.fr/private" do gem "maglevcms-saas-plugin", "~> 0.1.0" end gem "maglevcms", "~> 3.0.0", require: false

Then install:

bundle install

Reference implementation: the site-builder-demo app pins maglevcms and maglevcms-saas-plugin from GitHub for development; your production setup will normally use released gems from the private server. Compare its Gemfile, initializers, and routes with your app when integrating.

If you need access or credentials, contact contact@maglev.dev.

Prepare your app

Run the Maglev installer once from your Rails app and follow the prompts.

The SaaS plugin needs to know which Rails model owns a Maglev site (for example Account or User). That choice is specific to your product; the installer and concern stubs reflect it.

bundle exec rails g maglev:install

Create a theme and a first section

Create a first theme:

bundle exec rails g maglev:theme Simple

and a sample section:

bundle exec rails g maglev:section Dummy --theme=Simple --category=content

Start the app:

bundle exec rails s

Open the Maglev admin/editor URLs your app exposes after install (paths can differ from single-site Maglev; align with your routes and the reference repo).

[Optional] Embed a default theme (HyperUI kit)

The maglevcms-hyperui-kit gem ships marketing-oriented sections based on HyperUI (Tailwind CSS). Versions align with Maglev v3; check your Gemfile against Quickstart for current constraints.

Add the kit to your Gemfile, install, then run the HyperUI installer (see Quickstart for exact commands and --theme naming).

Create your first site programmatically

Assume each Account (or the model you configured at install) should get a Maglev site. Create a site from a theme id (use default if you installed HyperUI as default, otherwise your theme name, e.g. simple):

bundle exec rails c
my_account = Account.first
site = my_account.generate_maglev_site(theme: "simple")

generate_maglev_site is provided by the concern the installer adds (for example app/models/concerns/maglev_site_concern.rb). Adjust it to match how your app provisions tenants.

Call generate_maglev_site from real application code (controller, service, callback, or job)—not only from the console—when a new tenant should receive a site.

To build an editor URL for a site, use the helpers your app defines after install. The PRO-era pattern looked like:

app.maglev.editor_root_url(site_handle: site.handle, host: "localhost:3000", locale: "en")

In your views, linking might resemble:

<% if account.maglev_site %>
  <%= link_to "Edit site", maglev.editor_root_url(site_handle: account.maglev_site.handle, locale: "en") %>
<% end %>

Confirm the helper names and path structure against your generated routes and the site-builder-demo source.

Going further

You now have Maglev core plus the SaaS plugin wired into your app. Next steps: design themes and sections, then use the Concepts and Guides sections of this documentation—the same building blocks apply to multi-site setups.