NAME

Mojolicious::Plugin::Fondation::Setup - Setup wizard with session-based state (clean rebuild)

VERSION

version 0.11

SYNOPSIS

# myapp.pl
use Mojolicious::Lite;
plugin 'Fondation' => {
    dependencies => ['Fondation::Setup'],
};
app->start;

# Then visit http://localhost:3000/setup

DESCRIPTION

This plugin provides a step-by-step web wizard at /setup for configuring a Fondation application. It discovers available plugins from MetaCPAN, lets the user pick which ones to enable, and walks through their configuration parameters.

How it works

State management

All wizard state (selected plugins, current step, form values) is stored in Mojolicious sessions — no database or file persister needed. Clicking "Reset" or visiting /setup/reset clears the session.

QUICK START

# 1. Create a new application directory
mkdir Myapp && cd Myapp

# 2. Create myapp.pl
echo 'use Mojolicious::Lite;
use lib 'lib';
plugin "Config";
plugin "Fondation";
app->start;' > myapp.pl

# 2. Create myapp.conf
{
  Fondation => {
    dependencies => [
      'Fondation::Setup',
    ]
  },
}


# 3. Initialize (creates assets, etc.)
perl myapp.pl fondation init

# 4. Start the development server
perl myapp.pl daemon

# 5. Open http://localhost:3000/setup in your browser

ROUTES

GET  /setup           Wizard main page
GET  /setup/plugins   Plugin selection with checkboxes
GET  /setup/discover  JSON API: plugin list from MetaCPAN
POST /setup/start     Build session state from selected plugins
POST /setup/execute   Process next/back/save actions
GET  /setup/reset     Clear session, restart

CONFIGURATION

No configuration parameters. The plugin reads dev_plugins_dir for locally-developed plugins.

PLUGIN CONTRACT

Other Fondation plugins declare their configurable parameters via the setup key in fondation_meta:

sub fondation_meta {
    return {
        setup => {
            label       => 'Database',
            description => 'Main database connection',
            parameters  => [
                {
                    key      => 'dsn',
                    label    => 'DSN',
                    type     => 'string',
                    default  => 'dbi:SQLite:dbname=data/app.db',
                    required => 1,
                },
            ],
        },
    };
}

DEPENDENCIES

OUTPUT

The wizard generates $moniker.conf (e.g. myapp.conf) in the application home directory. Example:

{
    Fondation => {
        dependencies => ['Fondation::Model::DBIx::Async', 'Fondation::User'],
    },
    'Fondation::Model::DBIx::Async' => {
        backends => [main => { dsn => 'dbi:SQLite:dbname=data/app.db' }],
    },
}

SEE ALSO

Mojolicious::Plugin::Fondation,

AUTHOR

Daniel Brosseau dab@cpan.org

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Daniel Brosseau.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.