Directory Structure
Complete guide to LaraDashboard's directory structure, explaining the purpose of each folder and file for developers.
Directory Structure
LaraDashboard follows Laravel's standard directory structure with additional directories for modules and custom functionality. This guide explains the purpose of each folder.
Root Directory Overview
laradashboard/
├── app/ # Application core code
├── bootstrap/ # Framework bootstrap files
├── config/ # Configuration files
├── database/ # Migrations, seeds, factories
├── modules/ # Installable modules
├── public/ # Public assets & entry point
├── resources/ # Views, CSS, JS, lang files
├── routes/ # Route definitions
├── storage/ # Logs, cache, uploads
├── tests/ # Automated tests
├── vendor/ # Composer dependencies
├── .env # Environment configuration
├── artisan # CLI entry point
├── composer.json # PHP dependencies
├── package.json # Node dependencies
├── vite.config.js # Vite build configuration
└── phpunit.xml # PHPUnit configuration
The App Directory
The app directory contains the core application code:
app/
├── Concerns/ # Shared traits
│ ├── AuthorizationChecker.php
│ ├── HasMedia.php
│ ├── HasUniqueSlug.php
│ └── Hookable.php
│
├── Console/ # Artisan commands
│ ├── Commands/
│ │ ├── ClearExpiredTokens.php
│ │ └── SendScheduledEmails.php
│ └── Kernel.php
│
├── Enums/ # Enumerations
│ ├── PostStatus.php
│ ├── ActionType.php
│ └── Hooks/
│ ├── UserHooks.php
│ └── PostHooks.php
│
├── Exceptions/ # Custom exceptions
│ └── Handler.php
│
├── Http/ # HTTP layer
│ ├── Controllers/
│ │ ├── Backend/ # Admin controllers
│ │ │ ├── UserController.php
│ │ │ ├── PostController.php
│ │ │ └── SettingController.php
│ │ └── Api/ # API controllers
│ │ ├── UserController.php
│ │ └── PostController.php
│ ├── Middleware/
│ │ ├── Authenticate.php
│ │ ├── HandleInertiaRequests.php
│ │ └── CheckPermission.php
│ ├── Requests/ # Form requests
│ │ ├── User/
│ │ ├── Post/
│ │ └── Api/
│ └── Resources/ # API resources
│ ├── UserResource.php
│ └── PostResource.php
│
├── Livewire/ # Livewire components
│ ├── Components/
│ │ └── FileManager.php
│ ├── Dashboard/
│ │ ├── QuickDraft.php
│ │ └── RecentPosts.php
│ └── Datatable/
│ ├── Datatable.php
│ ├── UserDatatable.php
│ └── PostDatatable.php
│
├── Models/ # Eloquent models
│ ├── User.php
│ ├── Post.php
│ ├── PostMeta.php
│ ├── Term.php
│ ├── Role.php
│ ├── Permission.php
│ └── Setting.php
│
├── Notifications/ # Notification classes
│ ├── AdminResetPasswordNotification.php
│ └── RegistrationWelcomeNotification.php
│
├── Observers/ # Model observers
│ ├── UserObserver.php
│ ├── PostObserver.php
│ └── SettingObserver.php
│
├── Policies/ # Authorization policies
│ ├── BasePolicy.php
│ ├── UserPolicy.php
│ ├── PostPolicy.php
│ └── RolePolicy.php
│
├── Providers/ # Service providers
│ ├── AppServiceProvider.php
│ ├── AuthServiceProvider.php
│ ├── RouteServiceProvider.php
│ ├── HookServiceProvider.php
│ └── ModuleServiceProvider.php
│
└── Services/ # Business logic services
├── UserService.php
├── PostService.php
├── SettingService.php
├── CacheService.php
├── Builder/
│ ├── BlockService.php
│ └── BuilderService.php
├── Modules/
│ ├── ModuleService.php
│ └── ModuleUpdateService.php
└── EmailProviders/
├── SmtpProvider.php
└── MailgunProvider.php
Key App Subdirectories
app/Concerns/
Shared traits used across multiple classes:
// app/Concerns/HasUniqueSlug.php
trait HasUniqueSlug
{
public static function bootHasUniqueSlug(): void
{
static::creating(function ($model) {
if (empty($model->slug)) {
$model->slug = Str::slug($model->title);
}
$model->slug = static::makeSlugUnique($model->slug);
});
}
}
app/Enums/
PHP 8.1+ enumerations for type-safe constants:
// app/Enums/PostStatus.php
enum PostStatus: string
{
case Draft = 'draft';
case Published = 'published';
case Scheduled = 'scheduled';
case Archived = 'archived';
public function label(): string
{
return match($this) {
self::Draft => 'Draft',
self::Published => 'Published',
self::Scheduled => 'Scheduled',
self::Archived => 'Archived',
};
}
}
The Config Directory
Application configuration files:
config/
├── app.php # Application config
├── auth.php # Authentication config
├── cache.php # Cache settings
├── database.php # Database connections
├── filesystems.php # File storage config
├── logging.php # Log channels
├── mail.php # Mail settings
├── queue.php # Queue connections
├── session.php # Session settings
├── ai.php # AI provider config
├── laradashboard.php # LaraDashboard config
├── modules.php # Module system config
├── permission.php # Spatie permission config
└── media-library.php # Media library config
The Database Directory
Database-related files:
database/
├── factories/ # Model factories
│ ├── UserFactory.php
│ ├── PostFactory.php
│ └── TermFactory.php
│
├── migrations/ # Database migrations
│ ├── 2014_10_12_000000_create_users_table.php
│ ├── 2023_01_01_000001_create_posts_table.php
│ └── ...
│
└── seeders/ # Database seeders
├── DatabaseSeeder.php
├── UserSeeder.php
├── SettingsSeeder.php
└── ContentSeeder.php
The Modules Directory
Installable modules follow this structure:
modules/
├── CRM/ # CRM Module
│ ├── app/
│ │ ├── Http/
│ │ ├── Models/
│ │ ├── Services/
│ │ └── Providers/
│ ├── config/
│ ├── database/
│ │ ├── migrations/
│ │ └── seeders/
│ ├── resources/
│ │ └── views/
│ ├── routes/
│ ├── module.json
│ └── composer.json
│
├── DocForge/ # Documentation Module
│ └── ...
│
└── CustomForm/ # Form Builder Module
└── ...
See Module Development for detailed module structure.
The Resources Directory
Frontend assets and views:
resources/
├── css/ # Stylesheets
│ ├── app.css # Main stylesheet
│ └── components/ # Component styles
│
├── js/ # JavaScript
│ ├── app.js # Main entry point
│ ├── bootstrap.js # Bootstrap initialization
│ ├── components/ # JS components
│ └── lara-builder/ # Page builder JS
│
├── lang/ # Translation files
│ ├── en/
│ │ ├── auth.php
│ │ ├── pagination.php
│ │ └── validation.php
│ ├── es/
│ ├── fr/
│ └── ... (21+ languages)
│
└── views/ # Blade templates
├── backend/ # Admin panel views
│ ├── layouts/
│ │ ├── app.blade.php
│ │ └── partials/
│ ├── dashboard/
│ ├── users/
│ ├── posts/
│ └── settings/
├── auth/ # Authentication views
├── components/ # Blade components
├── emails/ # Email templates
├── email-templates/ # Email template views
└── errors/ # Error pages
The Routes Directory
Route definitions:
routes/
├── web.php # Web routes
├── api.php # API routes
├── auth.php # Authentication routes
├── admin.php # Admin panel routes
├── install.php # Installation routes
├── channels.php # Broadcast channels
└── console.php # Console commands
The Storage Directory
Application storage:
storage/
├── app/ # Application files
│ ├── public/ # Public uploads
│ │ ├── media/ # Media library files
│ │ └── uploads/ # User uploads
│ └── private/ # Private files
│
├── framework/ # Framework files
│ ├── cache/ # File cache
│ ├── sessions/ # Session files
│ └── views/ # Compiled views
│
└── logs/ # Log files
├── laravel.log # Main log file
└── daily/ # Daily log files
The Tests Directory
Automated tests:
tests/
├── Feature/ # Feature tests
│ ├── Auth/
│ │ ├── LoginTest.php
│ │ └── RegistrationTest.php
│ ├── User/
│ │ ├── UserCreateTest.php
│ │ └── UserDeleteTest.php
│ ├── Post/
│ │ └── PostCrudTest.php
│ └── Api/
│ └── UserApiTest.php
│
├── Unit/ # Unit tests
│ ├── Services/
│ │ └── UserServiceTest.php
│ └── Models/
│ └── PostTest.php
│
├── TestCase.php # Base test case
├── CreatesApplication.php
└── Pest.php # Pest configuration
The Public Directory
Web-accessible files:
public/
├── index.php # Application entry point
├── favicon.ico # Site favicon
├── robots.txt # Search engine rules
├── .htaccess # Apache configuration
│
├── build/ # Vite compiled assets
│ ├── assets/
│ │ ├── app-*.css
│ │ └── app-*.js
│ └── manifest.json
│
├── images/ # Static images
│ ├── logo.png
│ └── default-avatar.png
│
└── uploads/ # Symlink to storage/app/public
Environment Files
.env # Active environment (not in git)
.env.example # Example configuration
.env.testing # Testing environment
Configuration Files
.editorconfig # Editor settings
.gitignore # Git ignore rules
.gitattributes # Git attributes
composer.json # PHP dependencies
composer.lock # Locked PHP versions
package.json # Node dependencies
package-lock.json # Locked Node versions
phpunit.xml # PHPUnit configuration
vite.config.js # Vite build config
tailwind.config.js # Tailwind configuration
postcss.config.js # PostCSS configuration
Customization Guidelines
Adding New Directories
For new feature areas, follow these conventions:
# New service category
app/Services/YourFeature/
├── YourFeatureService.php
└── YourFeatureHelper.php
# New controller group
app/Http/Controllers/Backend/YourFeature/
└── YourFeatureController.php
# New Livewire component group
app/Livewire/YourFeature/
└── YourFeatureComponent.php
File Naming Conventions
| Type | Convention | Example |
|---|---|---|
| Controllers | PascalCase + Controller | UserController.php |
| Models | PascalCase (singular) | User.php |
| Services | PascalCase + Service | UserService.php |
| Traits | PascalCase | HasUniqueSlug.php |
| Interfaces | PascalCase + Interface | UserRepositoryInterface.php |
| Migrations | snake_case with timestamp | 2024_01_01_000000_create_users_table.php |
| Views | kebab-case | user-profile.blade.php |
| Config | kebab-case | media-library.php |
Next Steps
- Module System - Understand module architecture
- Architecture Overview - System design patterns
- Module Development - Build your own modules