> ## 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

> A guide to the key directories and files in a fresh Laravel project.

## Overview

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

## Root directory

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

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

### `app/` directory

Contains the core code of your application. Almost all of your application's classes live here, including controllers, models, and middleware.

By default it includes `Http/`, `Models/`, and `Providers/` subdirectories. Additional subdirectories are created automatically when you generate classes with Artisan commands.

### `bootstrap/` directory

Contains the `app.php` file that bootstraps the framework, along with a `cache/` directory that holds framework-generated files for performance optimisation (route and service caches).

### `config/` directory

Contains all of your application's configuration files. It's worth reading through these files to familiarise yourself with the available options.

### `database/` directory

Contains database migrations, model factories, and seeders. SQLite database files can also be stored here.

### `public/` directory

Contains the `index.php` file, which is the entry point for all requests entering your application. It also houses your assets — images, JavaScript, and CSS.

<Warning>
  Set your web server's document root to Laravel's `public/` directory. Pointing it at the project root or a subdirectory risks exposing sensitive files.
</Warning>

### `resources/` directory

Contains your [views](/en/views) and raw, uncompiled assets such as CSS and JavaScript.

### `routes/` directory

Contains all route definitions for your application. Two route files are included by default: `web.php` and `console.php`.

| File           | Purpose                                                                                                                       |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `web.php`      | Routes for browser-facing pages. The `web` middleware group applies session handling, CSRF protection, and cookie encryption. |
| `console.php`  | Define closure-based Artisan commands.                                                                                        |
| `api.php`      | Stateless API routes. Add with `php artisan install:api`.                                                                     |
| `channels.php` | Register event broadcast channels.                                                                                            |

### `storage/` directory

Contains logs, compiled Blade templates, file-based sessions, file caches, and other files generated by the framework. It is split into `app/`, `framework/`, and `logs/` subdirectories.

### `tests/` directory

Contains your automated tests. Starter examples for both [Pest](https://pestphp.com) and [PHPUnit](https://phpunit.de/) are included out of the box.

### `vendor/` directory

Contains your [Composer](https://getcomposer.org) dependencies. Do not commit this directory to source control.

## Inside `app/`

Most classes in the `app` directory can be generated with Artisan commands. To see what's available, 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. Each database table has a corresponding model used to query and insert data.
  </Accordion>

  <Accordion title="Providers/ directory">
    Contains all [service providers](/en/service-container) for your application. Service providers bootstrap the application by binding services into the container, registering events, and more.
  </Accordion>

  <Accordion title="Console/ directory">
    Contains all custom Artisan commands. Generate new ones with `php artisan make:command`.
  </Accordion>

  <Accordion title="Exceptions/ directory">
    Contains your application's custom exception classes. Generate them with `php artisan make:exception`.
  </Accordion>
</AccordionGroup>

## Key files

### `.env` file

Manages environment-specific configuration values such as database credentials and API keys. Values here are referenced from `config/` files via the `env()` helper.

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

DB_CONNECTION=sqlite
```

### `artisan` file

The entry point for the Artisan command-line interface. Run commands with:

```shell theme={null}
php artisan <command>
```

## 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)
- [Vue.js Introduction — Essentials for Inertia × Laravel](/en/blog/vue-introduction.md)
- [React Introduction — Essentials for Inertia × Laravel](/en/blog/react-introduction.md)
- [Svelte Introduction — Essentials for Inertia × Laravel](/en/blog/svelte-introduction.md)
- [Tutorial - Laravel Console Starter](/en/packages/laravel-console-starter/tutorial.md)
