This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Wave is a Laravel-based SaaS framework that provides essential features for building subscription-based applications. The application uses a modular architecture with themes, plugins, and a custom admin panel built with Filament.
npm run dev- Start Vite development servernpm run build- Build assets for production
php artisan serve- Start Laravel development servercomposer run dev- Start full development environment (server, queue, logs, and Vite)
php artisan migrate- Run database migrationsphp artisan db:seed- Seed the databasephp artisan migrate:fresh --seed- Fresh migration with seeding
php artisan test- Run PHPUnit testsvendor/bin/pest- Run Pest tests
php artisan queue:work- Process queued jobsphp artisan queue:listen --tries=1- Listen for jobs with retry limit
php artisan wave:cancel-expired-subscriptions- Cancel expired subscriptionsphp artisan wave:create-plugin- Create a new plugin
app/- Standard Laravel application fileswave/- Wave framework core files and componentsresources/themes/- Theme files (Blade templates, assets)resources/plugins/- Plugin system filesconfig/wave.php- Main Wave configuration
- Registers middleware, Livewire components, and Blade directives
- Handles plugin registration and theme management
- Configures Filament colors and authentication
- User model extends Wave User with subscription capabilities
- Subscription management with Stripe/Paddle integration
- Role-based permissions using Spatie Laravel Permission
- Multiple themes available in
resources/themes/ - Theme switching in demo mode via cookies
- Folio integration for page routing
- Filament-based admin interface
- Resource management for users, posts, plans, etc.
- Located in
app/Filament/
- Supports both Stripe and Paddle
- Configured via
config/wave.phpand environment variables - Webhook handling for subscription events
- Plugins located in
resources/plugins/ - Auto-loading via
PluginServiceProvider - Plugin creation command available
WAVE_DOCS- Show/hide documentationWAVE_DEMO- Enable demo modeWAVE_BAR- Show development barBILLING_PROVIDER- Set to 'stripe' or 'paddle'
config/wave.php- Main Wave configurationconfig/themes.php- Theme configurationconfig/settings.php- Application settings
The application uses Pest for testing with PHPUnit as the underlying framework. Test files are located in tests/ with separate directories for Feature and Unit tests.
- The application uses Laravel Folio for page routing
- Livewire components handle dynamic UI interactions
- Filament provides the admin interface
- Theme development follows Blade templating conventions
- Plugin development follows Laravel package conventions
- User subscription/admin status cached for 5-10 minutes
- Active plans cached for 30 minutes
- Categories cached for 1 hour
- Helper files cached permanently until cleared
- Theme colors cached for 1 hour
- Plugin lists cached for 1 hour
- User caches cleared via
$user->clearUserCache()method - Plan caches cleared via
Plan::clearCache()method - Category caches cleared via
Category::clearCache()method
- Eager loading relationships to prevent N+1 queries
- Cached query results for frequently accessed data
- Optimized middleware to use cached user roles
- Use
Plan::getActivePlans()instead ofPlan::where('active', 1)->get() - Use
Plan::getByName($name)instead ofPlan::where('name', $name)->first() - Use
Category::getAllCached()instead ofCategory::all() - Always clear relevant caches when updating user roles, plans, or categories
- All caching methods include fallbacks for when cache service is unavailable
- Service provider guards against cache binding issues during package discovery
- Compatible with automated testing environments and CI/CD pipelines
A simple, performant activity logging system for tracking user actions.
Edit config/activity.php:
return [
// Enable/disable activity logging
'enabled' => env('ACTIVITY_LOG_ENABLED', true),
// Queue logs for better performance (recommended for busy apps)
'queue' => env('ACTIVITY_LOG_QUEUE', false),
// Queue connection to use
'queue_connection' => env('ACTIVITY_LOG_QUEUE_CONNECTION', 'database'),
// How many days to keep logs before auto-deletion
'retention_days' => env('ACTIVITY_LOG_RETENTION_DAYS', 90),
];# Disable activity logging
ACTIVITY_LOG_ENABLED=false
# Enable queued logging (recommended for production)
ACTIVITY_LOG_QUEUE=true
ACTIVITY_LOG_QUEUE_CONNECTION=redis
# Keep logs for 30 days instead of default 90
ACTIVITY_LOG_RETENTION_DAYS=30use Wave\ActivityLog;
// Simple log
ActivityLog::log('action_name', 'Description of what happened');
// With metadata
ActivityLog::log('profile_updated', 'User updated their email', [
'old_email' => 'old@example.com',
'new_email' => 'new@example.com'
]);Activity logs are automatically cleaned up daily to prevent database bloat:
# Manually clean logs older than configured retention period
php artisan activity:clean
# Clean logs older than specific number of days
php artisan activity:clean --days=30
# Force cleanup without confirmation
php artisan activity:clean --no-interactionThe cleanup command runs automatically every day via Laravel's scheduler.
ACTIVITY_LOG_QUEUE=true
ACTIVITY_LOG_QUEUE_CONNECTION=redisTo completely disable activity logging:
ACTIVITY_LOG_ENABLED=falseA scheduled account deletion system that gives users a grace period before permanent deletion.
The system automatically processes scheduled deletions daily:
# Manually process scheduled deletions
php artisan accounts:process-deletionsThis command:
- Finds all users with
deletion_scheduled_at<= current time - Permanently deletes those accounts (force delete)
- Logs results (success/failure for each account)
- Returns count of deleted accounts
The deletion processor runs automatically every day via Laravel's scheduler (configured in routes/console.php):
Schedule::command('accounts:process-deletions')->daily();