Quick guide to Laravel directory structure

rafiqul
Rafiqul Hasan
Published on Sep, 16 2025 2 min read 0 comments
Text Image

 

 

# 📂 Quick Guide to Laravel Directory Structure

When you first open a fresh Laravel project, the number of folders might feel overwhelming. Here’s a quick guide to help you understand the **Laravel directory structure** and what each folder is for.  

---

## 🔑 Important Folders in Laravel

### 1. **app/**
Contains the core of your application’s logic.  
- `Http/` → Controllers, Middleware, Requests  
- `Models/` → Eloquent models (database tables)  
- `Console/` → Custom Artisan commands  

👉 This is where most of your coding happens.  

---

### 2. **bootstrap/**
Holds files for bootstrapping the framework, including `app.php` which starts Laravel. It also caches configuration for better performance.  

---

### 3. **config/**
Contains configuration files (database, mail, cache, services, etc). These often pull values from `.env`.  

---

### 4. **database/**
Includes migrations, seeders, and factories.  
- `migrations/` → Create or modify tables  
- `seeders/` → Populate tables with test data  
- `factories/` → Generate fake data  

---

### 5. **public/**
The entry point of your application. It has `index.php`, which loads everything. Also stores public assets like CSS, JS, and images.  

---

### 6. **resources/**
Contains views, raw assets, and language files.  
- `views/` → Blade templates  
- `lang/` → Localization files  
- `css/js/` → Frontend assets (compiled by Laravel Mix/Vite)  

---

### 7. **routes/**
Defines all application routes.  
- `web.php` → Routes for web UI  
- `api.php` → Routes for APIs  
- `console.php` → Artisan commands  
- `channels.php` → Event broadcasting  

---

### 8. **storage/**
Used for app-generated files.  
- `logs/` → Error logs  
- `framework/` → Sessions, cache, views  
- `app/` → User-uploaded files  

---

### 9. **tests/**
Contains test cases for unit and feature testing. Run tests with:  

```bash
php artisan test

 

### 10. **vendor/**
Contains all Composer dependencies (Laravel itself lives here). You usually don’t touch this folder.

 

🎯 Conclusion

Laravel’s structure may look big at first, but once you know where things belong, it becomes very organized. Most of your time will be spent in app/, routes/, resources/, and database/.

0 Comments