Laravel Directory Structure for Beginners
β Laravel Folder Structure

π app/
This folder contains the main code of your application.
Http/ β Your controllers and middleware live here (handles user requests).
Models/ β These are used to talk to the database (like User.php).
Providers/ β These files help start services like routes, events, etc.
π bootstrap/
Used to boot (start) your Laravel app.
- It also contains a cache folder to store compiled files for faster loading.
π config/
All the settings of your app are here.
Examples:
app name
timezone
mail configuration
database info, etc.
π database/
Contains everything related to your database.
migrations/ β Code for creating or changing tables.
seeders/ β Used to add sample data.
factories/ β Generate fake data for testing.
π public/
This is the only folder visible to the user in the browser.
index.php is the file that starts Laravel.
You can also store images, CSS, and JavaScript here.
π resources/
This folder has your HTML views and frontend files.
views/ β Contains Blade templates (Laravelβs HTML files).
css/ and js/ β For custom styles and scripts.
π routes/
This is where you define URLs for your app.
web.php β For browser routes (like homepage, about page).
console.php β For Artisan CLI commands.
Example:
Route::get('/', function () {
return view('welcome');
});
π storage/
Used to store files, like:
logs
uploaded files
cache files
Laravel uses this folder for internal data.
π tests/
Write tests here to check if your app works properly.
π vendor/
Contains all the Laravel files and libraries installed via Composer.
π Don't touch this folder manually.
π§ Important Files
.env β Important settings like database, mail, app key, etc.
artisan β Command line tool to run Laravel commands.
composer.json β Keeps track of all PHP libraries.
vite.config.js β Settings for CSS/JS build tools.
package.json β Used for JavaScript packages (NPM).
β Summary Table
| Folder/File | What it Does |
app/ | Main app logic (controllers, models) |
bootstrap/ | Starts Laravel app |
config/ | App settings |
database/ | Migrations and sample data |
public/ | Browser-visible files |
resources/ | Views and frontend code |
routes/ | Defines URLs |
storage/ | Stores logs, files, cache |
tests/ | App testing code |
vendor/ | Laravel framework and packages |
.env | Environment settings |
artisan | Laravel command line tool |
Explanation in Hinglish
β Main Laravel Project Structure
your-project/
β
βββ app/
βββ bootstrap/
βββ config/
βββ database/
βββ public/
βββ resources/
βββ routes/
βββ storage/
βββ tests/
βββ vendor/
β
βββ .env
βββ artisan
βββ composer.json
βββ vite.config.js
βββ ...
π app/ β Your core application code
Yeh folder Laravel ka core hota hai, jisme controller, models, and logic rehta hai.
Http/ β Controllers, Middleware, and requests yahan hote hain.
Models/ β Aapke database models (e.g., User.php) yahan bante hain.
Providers/ β Laravel ki services register karne ke liye.
π bootstrap/
Laravel ko boot (start) karne ke liye yeh folder use hota hai.
app.php β Framework start karne ka file.
cache/ β Laravel ka optimization aur caching data.
π config/
Saare configuration files yahan hote hain (like mail, database, app name, etc.)
Example: app.php, database.php, mail.php, etc.
π database/
Database se related saari cheezein:
migrations/ β Table create/edit ka code.
seeders/ β Sample data insert karne ke liye.
factories/ β Fake data generate karne ke liye (testing).
π public/
Yeh folder web-accessible hota hai. Jab user aapka site kholta hai, yeh folder serve hota hai.
index.php β Laravel ka entry point.
css/, js/ β Static assets like images, JS, CSS.
π resources/
Views aur frontend assets ke liye.
views/ β Blade templates (like HTML) yahan likhte hain.
css/ & js/ β Frontend code likhne ke liye.
π routes/
Saare URL routes yahan define hote hain.
web.php β Browser ke routes (GET, POST).
console.php β Artisan CLI ke liye.
api.php (not shown here but usually present) β API ke routes ke liye.
π§ Example route in web.php:
Route::get('/', function () {
return view('welcome');
});
π storage/
Logs, user uploads, and framework data ke liye.
logs/ β Errors and logs.
app/ β Uploaded files.
framework/ β Cache, sessions, views storage.
π tests/
Application ke test cases likhne ke liye (PHPUnit ya Pest use karke).
π vendor/
All packages and Laravel framework files jo Composer install karta hai.
β Never touch this manually.
π§ Important Root Files:
.envβ Project ke environment/config (DB, mail, etc.)artisanβ Laravel CLI tool. Use it to run commands:php artisan serve php artisan migratecomposer.jsonβ Installed PHP packages ka record.vite.config.jsβ Frontend build configuration (Vite for assets).package.jsonβ NPM packages list (for JS & CSS).
π Summary in Hinglish
| Folder/File | Kaam (Use) |
app/ | Controllers, Models, Logic |
bootstrap/ | Laravel ko start karne ka system |
config/ | App ke settings/configs |
database/ | Tables banane ka code + test data |
public/ | Browser se visible files (index.php) |
resources/ | Views (HTML) + frontend code |
routes/ | URLs define karne ke liye |
storage/ | Logs, uploads, cache |
tests/ | App testing |
vendor/ | All Laravel + 3rd party libraries |
β¦..
β Main Folders You Should Work On First
1. π routes/web.php
πΉ Why?
This is where you define your website's URLs and actions.
πΈ Example:
phpCopyEditRoute::get('/', function () {
return view('welcome');
});
β‘οΈ Start here to create routes like /about, /contact, etc.
2. π resources/views/
πΉ Why?
This folder contains your Blade templates β basically the HTML pages of your app.
πΈ Example:
Create a file like about.blade.php to design your "About Us" page.
3. π app/Http/Controllers/
πΉ Why?
This is where you write your logic for routes using Controllers.
πΈ Example:
If you want to handle form submissions, database access, etc.
β‘οΈ Use php artisan make:controller PageController to create a controller.
4. π app/Models/
πΉ Why?
If you're using a database, Models help you interact with tables.
πΈ Example:
phpCopyEdit$user = User::all(); // Gets all users
β‘οΈ Use php artisan make:model Post to create a model.
5. π resources/css/ and resources/js/ (optional at first)
πΉ If youβre adding custom styles or JS, you can update these.




