Laravel - Structure Overview

Laravel - Structure Overview

Here’s a clear Basic Laravel Project Structure Overview so you’ll know what every folder is for when you open your project.

 

Basic Laravel Project Structure Overview

When you open your Laravel project folder, here’s what you’ll see:

myapp/
├── app/
├── bootstrap/
├── config/
├── database/
├── public/
├── resources/
├── routes/
├── storage/
├── tests/
├── vendor/
├── .env
├── artisan
└── composer.json

Let’s quickly break each part down 👇

 

📂 app/

This is the core of your application — it contains:

  • Models (Eloquent models)
  • Controllers
  • Middleware
  • Services
  • Policies (authorization)

– You’ll spend a lot of time here.

Example:

app/
├── Console/
├── Exceptions/
├── Http/
│   ├── Controllers/
│   ├── Middleware/
├── Models/
└── Providers/

 

📂 bootstrap/

Contains files for starting the Laravel framework (bootstrapping).
The app.php file initializes your app.

You usually won’t edit this folder.

 

📂 config/

Contains all configuration files (like app.php, database.php, mail.php, etc.)

Whenever you want to configure Laravel settings — this is where you go.

Example:

config/app.php
config/database.php
config/mail.php

 

📂 database/

Handles everything related to the database.

  • migrations/ — version-controlled DB schema changes
  • factories/ — fake data generation for testing
  • seeders/ — populate your DB with initial/test data

 

📂 public/

This is the web server’s document root (the only folder accessible to browsers).
It contains:

  • index.php — entry point to your app
  • CSS / JS / assets

— When you deploy Laravel, you point your server to public/ (not the project root).

 

📂 resources/

Contains frontend resources:

  • views/ — Blade templates (your HTML views)
  • lang/ — localization files
  • js/ and sass/ — frontend assets (for Laravel Mix)

Example:

resources/
├── views/
│   └── welcome.blade.php
├── lang/
│   └── en/
└── js/

 

📂 routes/

Defines application routes.

  • web.php → Routes for the web (browser-based app)
  • api.php → Routes for APIs (stateless)
  • console.php → Artisan CLI routes
  • channels.php → Broadcast channels

Example quick route (in web.php):

Route::get('/', function () {
    return view('welcome');
});

 

📂 storage/

Handles app-generated files:

  • logs/ → application logs
  • app/ → file uploads
  • framework/ → cache, sessions, compiled views

— You’ll often need to set write permissions on this folder.

 

📂 tests/

Contains automated tests (PHPUnit).
Laravel encourages TDD (Test Driven Development).

Example:

tests/
├── Feature/
└── Unit/

 

📂 vendor/

Contains all Composer dependencies.
(Laravel framework code and other packages live here.)

You don’t edit this folder manually.

 

Other Important Files

  • .env — your environment variables file (DB settings, app key, etc.)
  • artisan — Laravel’s CLI tool
    Run commands like php artisan migrate
  • composer.json — Composer dependencies + scripts

 

Quick Summary Table

Folder / FileWhat it’s for
app/Business logic (models, controllers)
bootstrap/App bootstrapping (startup)
config/All configuration
database/Migrations, seeders, factories
public/Public web root (index.php, assets)
resources/Views, languages, frontend assets
routes/App routes
storage/Logs, uploads, cache
tests/Automated tests
vendor/Composer dependencies
.envEnvironment variables
artisanCLI tool

 

Now You Know Your Way Around! 🗺️

— You’re ready to start coding confidently inside your Laravel project.