Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
Request–Response Flow and Project Folders  ›  Capstone Project

database, storage, tests and vendor

Database 15 mindatabase/ holds migrations, factories and seeders, storage/ holds files the app writes, tests/ holds feature and unit tests, and vendor/ holds Composer packages that you never edit or commit.

database, storage, tests and vendor

Four folders remain, and each answers a different question. Where is the shape of my data? Where does the app write files? Where do I prove it works? Where is everyone else's code? Mix them up and you end up committing gigabytes of packages or losing a member's uploaded photo.

The rule

database/ shapes data, storage/ collects output, tests/ proves it, vendor/ borrows.

database/

  • migrations/: PHP files that create and change tables, run with php artisan migrate.
  • factories/: recipes for fake rows, used in tests and seeding.
  • seeders/: code that fills tables with starting data, run with php artisan db:seed.
  • database.sqlite: the database file itself, when you use SQLite.

storage/: what the running app writes.

  • storage/app/: files your code saves. storage/app/public is for files the public should see, such as avatars.
  • storage/framework/: compiled views, cache files and sessions.
  • storage/logs/laravel.log: the log, and the first place to look when a page errors.

Uploaded files in storage/app/public are not reachable until you run:

php artisan storage:link

That creates a public/storage link, so storage/app/public/avatars/ana.jpg is served at /storage/avatars/ana.jpg.

tests/

  • tests/Feature/: tests that send requests through the app, such as "GET /books returns 200".
  • tests/Unit/: tests of one small class on its own.

Run them with php artisan test.

vendor/: every Composer package, including Laravel itself in vendor/laravel/framework. It is listed in .gitignore, and composer install rebuilds it from composer.lock.

The shortcut

Ask "who writes this file?" You write it by hand → it is committed (database/, tests/). The running app writes it → storage/, not committed. Composer writes it → vendor/, not committed.

Sorting four Lendly filesStep 1 of 4
  1. create_loans_table migration

    Written by you, so it lives in database/migrations and is committed.

The trap is fixing a bug by editing a file in vendor/. The next composer install wipes your change silently.

Drills

Answer fast — trust the rule.

quick drill

Where do you look first when a page shows a server error?

quick drill

Which folder defines the structure of the books table?

quick drill

Avatars saved in storage/app/public show a 404 in the browser. What is missing?

quick drill

A teammate clones Lendly and has no vendor/ folder. What should they run?

quick drill

A test sends GET /books and checks for status 200. Where does it belong?

Remember

  • database/ shapes data, storage/ collects output, tests/ proves it, vendor/ borrows.
  • Who writes it? You → commit it. The app or Composer → don't.
  • Trap: never edit vendor/. composer install overwrites it.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainTour the rest of Lendly

A new teammate asks where four things live in Lendly: the definition of the loans table, members' uploaded profile photos, the log file with yesterday's error, and the Laravel framework's own code. Answer each and explain which of them should be committed to git.