Wave SaaS Framework

repository·main·Indexed 27 days ago

https://github.com/thedevdojo/wave

A Laravel-based SaaS framework providing pre-built essential features including authentication, billing, subscription management, roles and permissions, and admin dashboards. It includes a suite of CLI tools for managing users, roles, subscriptions, activity logs, and application statistics (MRR/ARR), as well as a plugin scaffolding system.

Tokens
1.8K
Snippets
3
Records
13
Agent score
91%

What's inside Wave

  1. Overview of Wave SaaS Framework

    main

    Wave is a SaaS framework built with Laravel designed to accelerate the development of SaaS applications. It provides a comprehensive set of essential features out-of-the-box, including:

    • Authentication and User Profiles
    • User Impersonations
    • Billing and Subscription Plans
    • Roles & Permissions
    • User Notifications
    • Changelog, Blog, and Pages management
    • API support
    • Admin dashboard
    • Themes and Plugins support
  2. Install Wave

    main

    Wave can be installed using two methods:

    1. Automated Installer: A streamlined process for quick setup.
    2. Manual Installation: For more control over the environment.

    For detailed, step-by-step instructions, refer to the official installation guide.

  3. Configure application aliases

    main

    The config/app.php file allows you to define custom class aliases for the application. This is useful for providing short, readable names for long-form class paths, which can then be used as Facades throughout the application. In Wave, additional aliases for JWTAuth and JWTFactory are merged into the default Laravel aliases.

    'aliases' => Facade::defaultAliases()->merge([
        'JWTAuth' => Tymon\JWTAuth\Facades\JWTAuth::class,
        'JWTFactory' => Tymon\JWTAuth\Facades\JWTFactory::class,
    ])->toArray(),
  4. Reference: wave:stats CLI flags

    main

    The wave:stats command supports the following options:

    OptionDescription
    --period=NNumber of days to analyze for growth metrics (default: 30)
    --jsonOutput the statistics in JSON format instead of the formatted terminal view
    php artisan wave:stats
                                {--period=30 : Number of days to analyze for growth metrics}
                                {--json : Output in JSON format}
  5. JSON output schema for wave:stats

    main

    When using the --json flag, the command returns a JSON object containing the following structure:

    • users:
      • total: Total number of users.
      • new: Number of users created within the specified period.
      • verified: Number of verified users.
      • growth_rate: Percentage growth of new users compared to the previous period.
    • subscriptions:
      • active: Total active subscriptions.
      • trial: Active subscriptions currently in a trial period.
      • cancelled: Active subscriptions that have an end date set.
      • new: Number of new subscriptions created within the specified period.
      • growth_rate: Percentage growth of new subscriptions compared to the previous period.
      • churn_rate: Percentage of subscriptions that ended during the period relative to active subscriptions at the start.
    • revenue:
      • mrr: Monthly Recurring Revenue.
      • arr: Annual Recurring Revenue.
      • currency: The application's configured currency (from config('app.currency')).
    • plans: An array of objects containing name and active_subscriptions count per plan.
    • period_days: The number of days analyzed.
  6. Clean up old activity logs with activity:clean

    main

    Use the activity:clean command to remove old activity logs from your database based on a specified retention period.

    By default, the command uses the value from the activity.retention_days configuration setting (which defaults to 90 days if not specified). If the command is run without the --days flag, it will attempt to use this config value. If the config value is null, logs will be kept indefinitely.

    Note: This command will prompt for confirmation before deleting logs unless the --no-interaction flag is used.

  7. Process scheduled account deletions

    main
    Run the accounts:process-deletions command to permanently delete user accounts that have passed their scheduled deletion grace period. The command identifies users where the deletion_scheduled_at timestamp is in the past and executes a forceDelete() on those records. This is typically used in a scheduled task (cron job) to automate the cleanup of accounts marked for deletion.
  8. Create a new role via CLI

    main

    Use the app:create-role command to interactively create a new user role in the system. The command will prompt you for:

    1. Role Name: A required string (max 255 characters) that must be unique in the roles table.
    2. Description: An optional description for the role.
    3. Permission Assignment: A confirmation prompt asking if you want to assign existing permissions to this role. If confirmed, you can select one or multiple permissions from a list of all available permissions in the database.

    If no permissions exist in the database, the command will warn you and skip the assignment step.

  9. Scaffold a new plugin with plugin:create

    main

    Use the plugin:create command to generate a new plugin skeleton. This command creates a directory structure within resources/plugins/, sets up a base plugin class, routes, views, and a Livewire component.

    If you do not provide a name as an argument, the CLI will interactively prompt you for the plugin name and a short description.

    Generated Structure:

    • resources/plugins/{slug}/ (Main directory)
    • resources/plugins/{slug}/src/Components/ (Livewire components)
    • resources/plugins/{slug}/resources/views/ (Blade templates)
    • resources/plugins/{slug}/resources/views/livewire/ (Livewire views)
    • resources/plugins/{slug}/routes/ (Route definitions)
    • resources/plugins/{slug}/version.json (Version metadata)
    • resources/plugins/{slug}/plugin.jpg (Placeholder image)
  10. View Wave application statistics with wave:stats

    main

    Use the wave:stats CLI command to display application metrics including MRR (Monthly Recurring Revenue), ARR (Annual Recurring Revenue), user growth, subscription status, and plan breakdowns.

    By default, the command analyzes the last 30 days of data. You can customize the analysis period or request the output in JSON format for programmatic use.

  11. Create a new user via CLI

    main

    Use the app:create-user command to interactively create a new user in the system. The command will prompt you for the following information:

    • Name: The user's full name.
    • Email: A unique email address.
    • Username: A unique username.
    • Password: A secure password (input is hidden).
    • Role: A selection from the list of available roles in the system.

    Upon successful completion, the user is created with verified status set to 1 and the selected role assigned via Spatie Permissions.