Skip to content

Building Your App

Introduction

After installing the StarterKit and running nubos:init, the generated code belongs to you. The models, actions, middleware, and views are published into your project's standard Laravel directories. You do not need to worry about keeping your code "compatible" with future StarterKit releases. It is a starting point, not a package you update.

Application Dashboard

After authenticating, users are redirected to their organization's dashboard. The route is defined in the generated route file (e.g., routes/team.php for Team organizations):

php
Route::middleware(['web', 'auth', SetCurrentTeam::class])
    ->prefix('teams/{team}')
    ->group(function (): void {
        Route::get('/dashboard', function () {
            return inertia('Dashboard');
        })->name('dashboard');
    });

The dashboard is rendered by the resources/js/Pages/Dashboard.vue component. You are free to edit this component and add your own content.

Adding Pages

To add pages to your application, create new Vue components in resources/js/Pages/ and register routes in the generated route file. All routes within the organization group automatically have the organization context resolved by middleware.

php
Route::middleware(['web', 'auth', SetCurrentTeam::class])
    ->prefix('teams/{team}')
    ->group(function (): void {
        Route::get('/dashboard', function () {
            return inertia('Dashboard');
        })->name('dashboard');

        Route::get('/settings', function () {
            return inertia('Settings');
        })->name('settings');
    });

The current organization is available on the request via $request->attributes->get('current_team').

Accessing the Current Organization

The middleware stores the resolved organization on the request attributes. In controllers and route closures:

php
$team = $request->attributes->get('current_team');

The User model also tracks the last-used organization via a current_team_id column (or current_workspace_id for workspaces). This is updated automatically by the SetCurrentTeam middleware and used by RedirectToCurrentTeam to redirect users to their last-used context.

For tenant organizations, the current tenant is bound to the container:

php
$tenant = app('current_tenant');

Customizing Actions

The generated action classes in app/Actions/ are yours to modify. For example, to send a welcome email when a member is added to a team, edit the AddTeamMemberAction:

php
class AddTeamMemberAction
{
    public function execute(Team $team, User $user, ?string $role = null): void
    {
        $team->users()->attach($user->id, ['role' => $role]);

        event(new TeamMemberAdded($team, $user));

        // Your custom logic:
        $user->notify(new AddedToTeamNotification($team));
    }
}

Listening to Events

The generated actions dispatch domain events. Register listeners in your EventServiceProvider or use Laravel's event discovery:

php
Event::listen(TeamCreated::class, function (TeamCreated $event) {
    // $event->team is the newly created team
});

Code Ownership

The base kit generates code into your project -- you own it. Paid modules live in vendor/ as Composer packages. You can override any module view by placing a file at the same path in resources/js/ -- the Nubos Vite Plugin gives your version priority.