Skip to content

Multiple applications ​

Show more than one API in Nimbus, for example a public API and an admin API.

Prerequisites ​

  • Nimbus is installed and config/nimbus.php is published.
  • Each API has its own route prefix.

Steps ​

  1. Open config/nimbus.php and add an entry under applications.

    php
    'default_application' => 'main',
    
    'applications' => [
        'main' => [
            'name' => 'Public API',
            'routes' => [
                'prefix' => 'api/v1',
            ],
        ],
        'admin' => [
            'name' => 'Admin API',
            'routes' => [
                'prefix' => 'api/admin',
                'versioned' => true,
            ],
            'auth' => [
                'guard' => 'admin',
            ],
            'headers' => [
                'X-Request-ID' => '$uuid',
            ],
        ],
    ],
  2. Set default_application to the id of the one that should load first.

  3. Reload Nimbus.

Expected result ​

An application switcher appears at the bottom of the routes explorer. Pick an application and Nimbus lists its routes.

Applications switcher

What each application has ​

Every application has its own route prefix, route strategy, version setting, authentication guard, and global headers. Environments, base_url, nested_folders, snapshot, and workspace are shared by all applications.