Laravel 13 Folder Structure Explained: Complete Files & Directories Breakdown
Laravel 13 is one of the most powerful PHP frameworks for building modern web applications. Whether you are creating a blog, CRM, CMS, SaaS platform, REST API, or an enterprise application, understanding the Laravel folder structure is one of the first things every developer should learn.
Many beginners install Laravel successfully but become confused after opening the project. They see dozens of folders like app, bootstrap, config, database, public, resources, routes, storage, and vendor, but don't know what each directory actually does.
In this complete guide, we will explain every important Laravel 13 folder and file using simple English with real-world examples. By the end of this article, you'll understand exactly where your code belongs and why Laravel is organized this way.
Laravel 13 Project Structure Overview
When you install Laravel 13 using Composer, the framework automatically creates a clean project structure. Each folder has a specific responsibility, making applications easier to organize and maintain.
laravel-project/
│
├── app/
├── bootstrap/
├── config/
├── database/
├── public/
├── resources/
├── routes/
├── storage/
├── tests/
├── vendor/
│
├── artisan
├── composer.json
├── package.json
├── .env
└── vite.config.js
Instead of putting everything into one directory, Laravel separates every part of the application. This makes development much cleaner, especially for large projects.
A well-organized project is easier to maintain, easier to debug, and much easier for teams to work on.
The app Folder
The app folder is the heart of every Laravel application. Almost all of your business logic lives here.
Whenever you create controllers, models, middleware, service classes, jobs, events, or policies, Laravel stores them inside the app directory.
| Folder | Purpose |
|---|---|
| Http | Controllers, Middleware and Form Requests |
| Models | Database Models |
| Providers | Application Service Providers |
| Console | Custom Artisan Commands |
If you are building a blog system, your PostController, CategoryController, and UserController will all live inside this folder.
app/Http
The Http directory handles everything related to incoming web requests.
- Controllers
- Middleware
- Form Requests
When a user opens your website, Laravel eventually reaches this folder before returning a response.
app/
└── Http/
├── Controllers/
├── Middleware/
└── Requests/
Controllers
Controllers contain the logic that runs after a route is matched.
Example:
Route::get('/posts', [PostController::class, 'index']);
Laravel calls the index() method inside PostController.
public function index()
{
return view('posts.index');
}
Instead of placing all your code inside routes, Laravel encourages developers to organize everything inside controllers.
Middleware
Middleware acts like a security checkpoint before a request reaches your controller.
Common middleware includes:
- Authentication
- CSRF Protection
- Rate Limiting
- Email Verification
- Admin Access
Think of middleware as a security guard checking whether a visitor is allowed to enter.
Every request can pass through one or more middleware before reaching your application.
Models
Models represent your database tables.
If your database contains a posts table, Laravel usually uses a model called Post.php.
app/
└── Models/
└── Post.php
Example:
$posts = Post::latest()->get();
Instead of writing raw SQL everywhere, Laravel allows developers to interact with the database using Eloquent ORM.
The bootstrap Folder
The bootstrap directory is responsible for starting your Laravel application.
When someone visits your website, Laravel loads configuration and prepares the framework before handling any request.
The most important file is:
bootstrap/app.php
This file initializes the application and prepares Laravel's service container.
The bootstrap/cache folder stores optimized configuration and route cache files, improving application performance.
The config Folder
The config folder contains all configuration files used by Laravel.
| Configuration File | Purpose |
|---|---|
| app.php | Application settings |
| database.php | Database connections |
| mail.php | Email configuration |
| queue.php | Queue settings |
| cache.php | Cache drivers |
| session.php | Session configuration |
Instead of changing framework code, developers modify these configuration files whenever they need to customize Laravel.
The Database Folder
The database folder contains everything related to your application's database structure. Whenever you create tables, insert sample data, or generate fake records for testing, Laravel stores those files here.
database/
├── factories/
├── migrations/
├── seeders/
└── database.sqlite
Migrations
Migrations work like version control for your database. Instead of creating tables manually in phpMyAdmin, you write migration files that Laravel can execute automatically.
php artisan make:migration create_posts_table
After creating a migration, simply run:
php artisan migrate
Laravel will automatically create all required tables.
Seeders
Seeders insert default or sample data into the database. This is useful during development and testing.
php artisan db:seed
Factories
Factories generate thousands of fake records using Faker. This helps developers test applications without entering data manually.
Think of migrations as your database blueprint and seeders as the workers filling the building with furniture.
The Public Folder
The public folder is the only directory that should be accessible from the internet.
public/
├── index.php
├── build/
├── storage/
├── favicon.ico
└── robots.txt
When someone visits your website, the web server first loads:
public/index.php
This file starts Laravel and handles every incoming request.
CSS, JavaScript, images, fonts, compiled Vite assets, and other public files are also served from this directory.
Never place sensitive files inside the public folder.
The Resources Folder
The resources folder contains everything related to your application's frontend.
resources/
├── css/
├── js/
├── views/
└── lang/
Views
Blade templates are stored inside the views directory.
resources/views/home.blade.php
Whenever a controller returns a Blade view, Laravel loads it from this folder.
return view('home');
CSS & JavaScript
Modern Laravel projects use Vite to compile CSS and JavaScript files.
resources/css/app.css
resources/js/app.js
After running Vite, the compiled files are automatically placed inside the public/build directory.
The Routes Folder
The routes directory defines every URL available inside your application.
routes/
├── web.php
├── api.php
├── console.php
└── channels.php
web.php
Contains routes for normal websites.
Route::get('/', function () {
return view('welcome');
});
api.php
Contains REST API endpoints.
Route::get('/posts', [PostController::class, 'index']);
Most Laravel API development happens inside this file.
The Storage Folder
The storage directory stores files generated by Laravel while the application is running.
storage/
├── app/
├── framework/
└── logs/
Logs
Whenever an error occurs, Laravel writes it inside:
storage/logs/laravel.log
This is usually the first place developers check while debugging.
Framework Cache
Laravel stores compiled Blade views, sessions, and cache files inside the framework directory.
If users upload profile pictures or documents, they are normally stored inside storage/app.
Use php artisan storage:link to make uploaded files publicly accessible.
The Vendor Folder
The vendor directory contains every Composer package used by Laravel.
vendor/
├── laravel/
├── symfony/
├── guzzlehttp/
├── monolog/
└── ...
This folder is automatically created after running:
composer install
Never edit files inside the vendor directory because Composer will overwrite them during updates.
Your application code belongs inside the app folder, not vendor.
Important Root Files
| File | Purpose |
|---|---|
| .env | Environment configuration |
| artisan | Laravel command-line tool |
| composer.json | PHP dependencies |
| package.json | Node.js packages |
| vite.config.js | Frontend build configuration |
| phpunit.xml | Testing configuration |
.env
The .env file stores sensitive configuration such as database credentials, mail settings, API keys, cache drivers, queue connections, and application environment variables.
APP_NAME=Laravel
APP_ENV=local
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=
Never upload your .env file to GitHub.
How Laravel Handles a Request
Every request follows a specific lifecycle inside Laravel.
Browser
↓
public/index.php
↓
bootstrap/app.php
↓
Service Providers
↓
Middleware
↓
Routes
↓
Controller
↓
Model
↓
Database
↓
Response
↓
Browser
This clean request lifecycle is one of the biggest reasons Laravel applications remain easy to understand, even when they become very large.
Complete Laravel 13 Folder Structure Tree
If you are new to Laravel, this complete folder tree gives you a quick overview of the framework. Every folder has its own responsibility, making Laravel one of the cleanest PHP frameworks available today.
laravel-project/
│
├── app/
├── bootstrap/
├── config/
├── database/
├── public/
├── resources/
├── routes/
├── storage/
├── tests/
├── vendor/
│
├── artisan
├── composer.json
├── composer.lock
├── package.json
├── vite.config.js
├── phpunit.xml
└── .env
Laravel Folder Responsibilities at a Glance
| Folder | Purpose |
|---|---|
| app | Main application logic |
| bootstrap | Framework startup |
| config | Application settings |
| database | Migrations, Seeders & Factories |
| public | Website public files |
| resources | Blade, CSS and JavaScript |
| routes | All application URLs |
| storage | Logs, cache and uploads |
| tests | Application testing |
| vendor | Composer packages |
Best Practices Every Laravel Developer Should Follow
- Keep controllers small and clean.
- Move business logic into Services or Actions.
- Use Form Requests for validation.
- Always use Eloquent relationships.
- Never write SQL everywhere.
- Keep environment secrets inside the .env file.
- Use migrations instead of editing databases manually.
- Create reusable Blade components.
- Cache configuration on production.
- Always keep Composer packages updated.
Common Mistakes Beginners Make
- Editing files inside the Vendor folder.
- Uploading the .env file to GitHub.
- Putting business logic inside Blade templates.
- Writing huge controllers.
- Ignoring Laravel Logs while debugging.
- Not using Route Names.
- Creating duplicate validation code.
- Keeping uploaded files inside the Public folder.
- Not understanding Middleware.
- Skipping migrations and creating tables manually.
Who Should Learn Laravel Folder Structure?
Understanding the Laravel folder structure is one of the first and most important steps for every PHP developer. Whether you want to build blogs, CMS platforms, REST APIs, SaaS applications, CRM systems, eCommerce websites, admin dashboards, or enterprise software, knowing where Laravel stores every file will save countless hours during development.
Once you become comfortable with the project structure, reading large Laravel applications becomes much easier. Instead of searching randomly for files, you immediately know where controllers, models, routes, views, middleware, configurations, migrations, and assets are located.
A developer who understands the Laravel folder structure spends less time searching for files and more time building features.
Final Thoughts
Laravel 13 continues the framework's tradition of keeping projects clean, organized, and developer-friendly. Every folder inside a Laravel project has a specific purpose, and once you understand how they connect together, building modern PHP applications becomes much easier.
Instead of memorizing every directory, focus on understanding the role each folder plays. Over time, navigating Laravel projects will become second nature, whether you are working on a personal portfolio, a CMS, a startup SaaS platform, or a large enterprise application.
If you are serious about becoming a professional Laravel developer in 2026, learning the folder structure is one of the best investments you can make before diving deeper into routing, middleware, authentication, queues, APIs, caching, broadcasting, and advanced architecture.
We hope this complete Laravel 13 folder structure guide helped you understand how every directory works inside a Laravel project. Bookmark this page for future reference, and keep exploring Laravel's powerful ecosystem to build faster, cleaner, and more scalable web applications.