> ## Documentation Index
> Fetch the complete documentation index at: https://kawax.biz/llms.txt
> Use this file to discover all available pages before exploring further.

# Directory structure

> Learn what each major directory and file in a Laravel project is for.

## Introduction

Laravel's default application structure provides a solid starting point for both large and small applications.
However, you're free to organize your application any way you like.
Laravel imposes almost no restrictions on where any given class is located—as long as Composer can autoload it, you're good.

## The root directory

When you create a new Laravel project, the following directory structure is generated:

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

### The `app/` directory

This directory holds the core code of your application.
Almost every class in your application—controllers, models, middleware—lives here.

By default, it contains the `Http`, `Models`, and `Providers` subdirectories.
When you generate classes via Artisan commands, other subdirectories are created automatically.

### The `bootstrap/` directory

Contains the `app.php` file that boots the framework.
It also includes a `cache/` directory that stores performance-optimization files such as the route and services caches.

### The `config/` directory

Contains all of your application's configuration files.
It's a great idea to read through these files and familiarize yourself with all of the options available to you.

### The `database/` directory

Contains database migrations, model factories, and seeders.
You can also place your SQLite database file here.

### The `public/` directory

Contains the `index.php` file, which is the entry point for all requests to your application.
It also holds assets such as images, JavaScript, and CSS.

<Warning>
  Set your web server's document root to your Laravel project's `public/` directory.
  Exposing your project root or a subdirectory directly risks leaking sensitive files.
</Warning>

### The `resources/` directory

Contains your [views](/en/views), as well as raw, un-compiled assets such as CSS or JavaScript.

### The `routes/` directory

Contains all of your application's route definitions.
By default, two route files are included: `web.php` and `console.php`.

| File           | Purpose                                                                                                                       |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `web.php`      | Browser-facing routes. The `web` middleware group is applied, which provides session, CSRF protection, and cookie encryption. |
| `console.php`  | A file for defining Artisan commands as closures.                                                                             |
| `api.php`      | Stateless API routes. Added via the `install:api` command.                                                                    |
| `channels.php` | A file for registering event broadcasting channels.                                                                           |

### The `storage/` directory

Contains framework-generated files such as logs, compiled Blade templates, file-based sessions, and file caches.
It is divided into three subdirectories: `app/`, `framework/`, and `logs/`.

### The `tests/` directory

Contains your automated tests.
Sample unit and feature tests using [Pest](https://pestphp.com) or [PHPUnit](https://phpunit.de/) are included out of the box.

### The `vendor/` directory

Contains your [Composer](https://getcomposer.org) dependencies. This directory should not be committed to source control.

## The `app/` directory in detail

Many of the classes in the `app` directory can be generated via Artisan commands.
To review the available commands, run:

```shell theme={null}
php artisan list make
```

<AccordionGroup>
  <Accordion title="Http/ directory">
    Contains controllers, middleware, and form requests.
    Nearly all of the logic for handling requests entering your application lives here.
  </Accordion>

  <Accordion title="Models/ directory">
    Contains all [Eloquent model](/en/eloquent) classes.
    A "model" corresponds to each database table and is used to query and insert data.
  </Accordion>

  <Accordion title="Providers/ directory">
    Contains all of your application's [service providers](/en/service-providers).
    Service providers bind services into the container, register events, and perform the tasks needed to boot your application.
  </Accordion>

  <Accordion title="Console/ directory">
    Contains all of your custom Artisan commands.
    You can generate them with the `make:command` command.
  </Accordion>

  <Accordion title="Exceptions/ directory">
    Contains all of your application's custom exceptions.
    You can generate them with the `make:exception` command.
  </Accordion>
</AccordionGroup>

## Important files

### The `.env` file

Manages configuration values that differ per environment (database credentials, API keys, and so on).
The `env()` helper is used from configuration files in `config/` to reference them.

```ini theme={null}
APP_NAME=Laravel
APP_ENV=local
APP_DEBUG=true
APP_URL=http://localhost

DB_CONNECTION=sqlite
```

### The `artisan` file

The entry point for the Artisan command-line interface.
Run commands with `php artisan <command name>`.

## Next steps

<Card title="Routing" icon="route" href="/en/routing">
  Learn how to define routes and connect URLs to your application logic.
</Card>


## Related topics

- [Skills](/en/packages/laravel-copilot-sdk/skills.md)
- [Getting started with React — the essentials for using it with Inertia × Laravel](/en/blog/react-introduction.md)
- [Getting started with Svelte — the essentials for using it with Inertia × Laravel](/en/blog/svelte-introduction.md)
- [Getting started with Vue.js — the essentials for using it with Inertia × Laravel](/en/blog/vue-introduction.md)
- [Installation](/en/installation.md)
