Introduction
When you install Laravel, you’re greeted with a clean and well-organized directory structure.
This layout is designed to work seamlessly for both small hobby projects and large enterprise applications.
While Laravel gives you the freedom to customize your project’s structure as needed, understanding the default layout is essential for writing clean, maintainable code.
In this guide, we’ll break down each Laravel directory, explain its purpose, and share practical tips for working with it effectively.

Laravel Root directory structure
1. Root Directory
The root folder is what you see when you open your Laravel project for the first time. It contains the core directories and files that define your application.
Here’s a quick overview:
- app/ – Main application logic
- bootstrap/ – Loads the Laravel framework
- config/ – Application configuration
- database/ – Migrations, seeds, and factories
- public/ – Publicly accessible files (entry point)
- resources/ – Views and raw assets
- routes/ – Application routes
- storage/ – Logs, caches, and compiled files
- tests/ – Automated tests
- vendor/ – Composer dependencies
Let’s explore them in detail.
2. app/ – The Heart of Your Application
This is where most of your Laravel magic happens. The app directory contains the main code of your application, such as:
- Http/ – Controllers, middleware, and request handling
- Models/ – Eloquent ORM models for database interaction
- Providers/ – Service providers that boot and configure services
- Console/ – Artisan commands
- Events/ – Custom application events
- Jobs/ – Background jobs and queued tasks
- Mail/ – Email classes
- Notifications/ – Application notifications
- Policies/ – Authorization logic
- Rules/ – Custom validation rules
- Broadcasting/ – Real-time broadcast channels
💡 Tip: Most new classes in app/ can be generated using Artisan commands, e.g.:
php artisan make:controller UserController
3. bootstrap/
This directory contains:
- app.php – Loads Laravel and bootstraps the application.
- cache/ – Stores precompiled routes, services, and configurations for faster performance.
You rarely modify files here manually, but clearing cache when debugging is common:
php artisan config:clear
php artisan route:clear
4. config/ – Configuration Central
Houses all configuration files for services like:
app.php– Application settingsdatabase.php– Database connectionsmail.php– Email settingsqueue.php– Queue drivers
💡 Best Practice: Always review and adjust these settings before deploying to production.
5. database/ – Data Handling Hub
Contains:
- migrations/ – Database schema changes
- factories/ – Dummy data generators for testing
- seeders/ – Insert sample or default data
- Can store an SQLite database directly here.
Run migrations easily:
php artisan migrate
6. public/ – The Gateway to Your App
Contains:
index.php– The entry point for all HTTP requests- CSS, JavaScript, and image files accessible by browsers
💡 Security Tip: Never store sensitive files here; they’ll be publicly accessible.
7. resources/ – The Creative Workspace
This is where you keep:
- views/ – Blade templates for HTML output
- lang/ – Localization files for multiple languages
- Raw frontend assets (CSS, JS, images) before compilation
You can compile assets using Laravel Mix or Vite:
npm run dev
8. routes/ – Application Pathways
Laravel separates routes into files:
web.php– Web routes (session, CSRF protection)api.php– API routes (stateless, token-authenticated)console.php– Console commandschannels.php– Broadcast channel routes
Example:
Route::get('/users', [UserController::class, 'index']);
9. storage/ – Laravel’s Filing Cabinet
Contains:
- app/ – User-uploaded files
- framework/ – Cache and session files
- logs/ – Application logs
To make user uploads public:
php artisan storage:link
10. tests/ – Quality Assurance
Organize tests into:
- Feature/ – Tests covering multiple layers of the application
- Unit/ – Tests for individual classes or methods
Run tests:
php artisan test
11. vendor/ – External Packages
This is where Composer installs third-party packages and Laravel framework files.
💡 Tip: Never manually edit files here—your changes will be overwritten during updates.
Conclusion
Laravel’s directory structure is designed for clarity and scalability.
By understanding each folder’s purpose, you can:
- Keep your project organized
- Maintain clean and efficient code
- Scale your application with confidence
Whether you’re just starting with Laravel or working on a large-scale application, mastering the directory structure will make you a more productive developer.