概要
Laravel 13、Vue 3、AdminLTE 4 をベースにした CRUD スターターテンプレート。
Web・アプリ開発できること
- Modal-based create and edit, paginated lists, delete with confirmation
- Login, register, email verification, forgot and reset password
- Profile: update name and email, change password
- Product catalogue with SKU, stock level and status (active, draft, archived), search, filters and sorting that are kept in the URL, and image upload
計測したスター増加
- 24時間
- 0
- 7日間
- +1
- 15日間
- +2
- 1か月
- 履歴を収集中
期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。
README.md
オリジナルLaravel + Vue CRUD Starter
About
A simple Laravel + Vue 3 + AdminLTE single-page application (SPA) starter with CRUD screens, authentication and an OAuth2 API.
Tech stack
- PHP 8.5, Laravel 13, Laravel Passport 13 (OAuth2 / personal access tokens)
- Vue 3 + Vue Router, built with Vite (SweetAlert2, axios)
- AdminLTE 4 + Bootstrap 5 + Font Awesome
- MySQL 9.7 LTS
- Node 26 LTS (build tooling only)
- PHPUnit tests, including security regression tests
- Pint and Larastan (PHP), ESLint and Prettier (JavaScript and Vue)
- Docker (Apache + mod_php) for development and production, Mailpit for local email
Features
- Modal-based create and edit, paginated lists, delete with confirmation
- Login, register, email verification, forgot and reset password
- Profile: update name and email, change password
- Product catalogue with SKU, stock level and status (active, draft, archived), search, filters and sorting that are kept in the URL, and image upload
- Dashboard with product counts and a low-stock list
- User management (admin only)
- Categories and tags (admin only in the menu)
- Role-based access control (admin and user) on the API and in the UI
- Developer page for OAuth clients and personal access tokens
- Hardened by default, see SECURITY.md
Quick start with Docker (recommended)
Requirements: Docker Engine 24+ with Docker Compose v2.
git clone https://github.com/AnowarCST/laravel-vue-crud-starter.git
cd laravel-vue-crud-starter
cp .env.example .env
Edit .env and set strong, different values for DB_PASSWORD and
DB_ROOT_PASSWORD. You can generate them with openssl rand -base64 32.
Compose refuses to start while they are empty. On Linux, also set
HOST_UID/HOST_GID to the output of id -u/id -g.
docker compose up -d --build # app, MySQL and Mailpit
docker compose exec app composer install # already run on first start; safe to repeat
docker compose exec app php artisan key:generate
docker compose exec app php artisan migrate
docker compose exec app php artisan passport:keys
docker compose exec app php artisan passport:client --personal --no-interaction # for the Developer > Personal Access Tokens page
docker compose exec app php artisan storage:link
docker compose exec app php artisan app:create-admin # prompts for email, name and password
Front-end assets:
docker compose --profile dev up -d node # Vite dev server with hot reload on http://localhost:5173
# or build once without the dev server:
docker compose --profile dev run --rm node sh -c "npm ci && npm run build"
Open http://localhost:8000 (change APP_PORT in .env to use another port).
Optional demo data: an everyday retail catalogue with 6 categories, 8 tags and 14 products, each with an original illustration. It creates no user accounts, and running it again does not add duplicates or change existing rows:
docker compose exec app php artisan db:seed
Notes:
- Every email the app sends (account verification, password reset) is caught
by Mailpit. Read it at http://localhost:8025 (
MAILPIT_PORT). - Self-registered accounts must verify their email address before they can use
the dashboard. Accounts created with
app:create-adminor by an administrator are verified automatically. - To use another port for the Vite dev server, set
VITE_PORTin.envbefore starting thenodeservice. - All ports bind to
127.0.0.1only. MySQL is not published. To reach it from a GUI client, start the stack withdocker compose -f docker-compose.yml -f docker-compose.db-port.yml up -dand connect to127.0.0.1:${DB_FORWARD_PORT:-3307}. - The
nodecontainer keeps its Linuxnode_modulesin a Docker volume. Your host'snode_modulesis never used inside the container. - Health check:
curl http://localhost:8000/up.
Installing without Docker
Requirements:
- PHP 8.5 with
gd(built with JPEG, PNG and WebP support),pdo_mysql,sodium,fileinfo,mbstring,openssl,domandtokenizer(composer check-platform-reqslists anything missing) - Composer 2
- Node 26 LTS and npm
- MySQL 9.7 LTS (8.4 LTS also works)
- A way to receive email: run Mailpit locally, or set
MAIL_MAILER=logto write emails (including verification links) tostorage/logs/laravel.log
cp .env.example .env # set DB_HOST=127.0.0.1, your DB credentials and MAIL_* settings
composer install
php artisan key:generate
php artisan migrate
php artisan passport:keys
php artisan passport:client --personal --no-interaction
php artisan storage:link
php artisan app:create-admin
npm ci
npm run dev # or: npm run build
php artisan serve
Point a production web server at public/ only.
Production image
docker build -f docker/Dockerfile --target prod -t laravel-vue-crud-starter:prod .
The image includes production Composer dependencies and the built Vite
assets. It does not include Composer, Node or git. Apache runs as www-data on
port 8080, and the image has a HEALTHCHECK on /up. Provide configuration as
environment variables (never bake .env into the image). Mount storage/ on a
persistent volume, and run migrations explicitly after taking a backup:
docker exec <container> php artisan migrate --force
See the production checklist in SECURITY.md.
Tests and code quality
docker compose exec app php artisan test
# or a single suite
docker compose exec app php artisan test --testsuite=Feature
Tests always use an in-memory SQLite database and never touch your MySQL data.
| Check | Command |
|---|---|
| PHP code style (Pint) | docker compose exec app composer lint (fix: composer format) |
| PHP static analysis (Larastan, level 9) | docker compose exec app composer analyse |
| JavaScript and Vue lint (ESLint) | docker compose --profile dev run --rm node npm run lint (fix: npm run lint:fix) |
| JavaScript and Vue formatting (Prettier) | docker compose --profile dev run --rm node npm run format:check (fix: npm run format) |
| Dependency audits | docker compose exec app composer audit and docker compose --profile dev run --rm node npm audit |
| End-to-end tests (Playwright) | tests/e2e/setup/start-stack.sh, then tests/e2e/setup/run-tests.sh (see End-to-end tests) |
Without Docker, run the same composer and npm commands directly. CI runs
all of these, plus a production Vite build and a production Docker build (see
.github/workflows/ci.yml). The end-to-end tests run in their own workflow,
.github/workflows/e2e.yml.
End-to-end tests
The Playwright tests in tests/e2e/ use Chromium to sign in, manage users,
products, categories and tags, upload a product photo, search and filter the
product list, check the dashboard counts, register and verify a new account
(using the email caught by Mailpit), manage personal access tokens and open
the API documentation. Every test also fails if a page reports a
Content-Security-Policy violation or an uncaught JavaScript error.
They run against a throwaway stack: the production Docker image, MySQL (data
kept in memory only) and Mailpit. It does not touch your development
database. Each run generates new random secrets and test accounts and stores
them in tests/e2e/.stack/ (ignored by git). The stack loads the demo
catalogue, but the tests create their own records and do not depend on it.
Requirements: Docker with Docker Compose v2, Node 26, and the project's npm
packages (npm ci). The stack publishes the app on 127.0.0.1:8080 and
Mailpit on 127.0.0.1:8125, so those ports must be free. The first run
downloads the Playwright image (mcr.microsoft.com/playwright:v1.65.0-noble)
and builds the production image, which needs several GB of free Docker disk
space.
npm ci
tests/e2e/setup/start-stack.sh # build the prod image, start the stack, migrate, seed, create test accounts
tests/e2e/setup/run-tests.sh # run every test in the Playwright image
tests/e2e/setup/run-tests.sh tests/e2e/auth.spec.js # or only some files (arguments go to `playwright test`)
tests/e2e/setup/stop-stack.sh # remove the containers, volumes and generated secrets
start-stack.sh reads these optional environment variables: E2E_PROJECT
(Compose project name, default lvcs-e2e), E2E_APP_PORT (default 8080),
E2E_MAILPIT_PORT (default 8125), E2E_IMAGE (default lvcs-e2e:local)
and E2E_SKIP_BUILD=1 (use an image you already built). run-tests.sh only
works with E2E_APP_PORT=8080. With another port, run Playwright on your
machine instead: npx playwright install chromium, then npm run test:e2e
(or npm run test:e2e:ui for the interactive mode).
The HTML report is written to tests/e2e/playwright-report/ and failure
traces to tests/e2e/test-results/. Both can contain the test accounts'
passwords for that run, so do not share them outside your team. The stack
sets API_DOCS_ENABLED=true so the /docs tests can run; because it uses
APP_ENV=production, only administrators can open /docs there.
Two limits matter if you add tests. The app allows 10 login attempts per
minute per IP address, so wait a minute before starting a second full run.
The API allows 60 requests per minute per account, so the tests reuse saved
sessions and spread their requests over two administrator accounts and one
regular user. One test is marked with test.fail() on purpose: it shows a
known bug (changing your own password also signs out the current session)
and will start failing, as an unexpected pass, once the bug is fixed.
In CI, .github/workflows/e2e.yml runs the same scripts on every pull request
and on pushes to main, and uploads the report as the playwright-report
artifact.
Security scan (ZAP)
.github/workflows/zap.yml runs an OWASP ZAP
baseline scan against the same throwaway stack. ZAP crawls the signed-out
pages and checks the responses passively; it does not attack the
application. The scan runs every Monday, when started by hand from the
Actions tab (ZAP baseline, then Run workflow), and on pull
requests to main that change code or configuration that shapes HTTP
responses (for example app/, config/, routes/, docker/ or
.zap/).
.zap/rules.tsv sets what each finding does. Rules set to FAIL cover
protections the app has today, such as the clickjacking and
X-Content-Type-Options headers, the Content-Security-Policy, SameSite
cookies and CSRF tokens on forms, so a match means a regression and fails
the job. Rules set to IGNORE are false positives that were checked by hand;
the file explains each one. All other findings are listed in the job log and
in the zap-baseline-report artifact without failing the job.
API documentation
docs/api/openapi.yaml describes every /api
endpoint in OpenAPI 3.1: authentication (bearer token or the dashboard's
session cookie), request bodies, query parameters, responses and errors.
php artisan test includes OpenApiDocumentTest, which fails if an /api
route is missing from the document or the document lists an operation that
has no route.
The application shows the document in Swagger UI at /docs (for example
http://localhost:8000/docs) and serves the file at /docs/openapi.yaml.
The viewer is bundled by Vite and loads nothing from a CDN.

- With
APP_ENV=local, both pages are on and anyone who can reach the app can open them. - In any other environment they are off and return 404. Set
API_DOCS_ENABLED=trueto turn them on; then only signed-in administrators with a verified email address can open them. API_DOCS_ENABLED=falseturns them off everywhere, including local.
"Try it out" in the viewer uses your signed-in session. To use a personal access token instead, create one on the Developer page and enter it under Authorize.
To check the document after changing it, lint it with Redocly CLI:
docker run --rm -e REDOCLY_TELEMETRY=off -v "$PWD/docs/api":/spec:ro -w /spec \
redocly/cli:2.82.0 lint openapi.yaml
Upgrading from the Laravel 8 version
This release has breaking changes. Read all of the steps before upgrading an existing installation.
- Back up the database (for example
mysqldump --single-transaction --routines -u<user> -p <database> > backup.sql) and keep a copy ofstorage/,public/upload/and your current image or commit. - Update
.envagainst the new.env.example.DB_USERNAMEmust not beroot. SetDB_ROOT_PASSWORD.MIX_*andPUSHER_*variables are gone. Laravel 11+ names includeCACHE_STORE(wasCACHE_DRIVER) andBROADCAST_CONNECTION.APP_DEBUGnow defaults tofalse. - Runtime: PHP 8.5, MySQL 9.7 LTS (or 8.4 LTS) and Node 26 are required. The Docker stack
now uses a single Apache + PHP container on internal port 8080 (published as
APP_PORT, default 8000) instead of nginx + php-fpm. Adminer and the public MySQL port were removed. - Laravel Mix has been replaced by Vite.
webpack.mix.js,public/js/app.js,public/css/app.cssandmix-manifest.jsonare no longer used. Runnpm ci && npm run build(assets go topublic/build). - Registration no longer creates admins. Every self-registered account is
a regular user. The seeded
[email protected]/123456account has been removed from the seeders. Create administrators withphp artisan app:create-admin. If an old database still contains that account, delete it or change its password immediately. - Passwords must now be at least 12 characters. Existing passwords keep working until they are changed.
- Uploads moved from
public/uploadto the Laravelpublicdisk (storage/app/public/uploads), served viapublic/storage. Runphp artisan storage:link. Copy any existing images you want to keep intostorage/app/public/uploads/. Only jpg, png and webp images are accepted. - Passport 13: run
php artisan migrateto apply the new OAuth and session tables,php artisan passport:keysif the keys are missing, andphp artisan passport:client --personalfor personal access tokens. Existing tokens may need to be re-issued. Databases created by Passport 10 use integer client IDs: setPASSPORT_CLIENT_UUIDS=false, and runphp artisan passport:hashonce to hash existing client secrets. - Email verification is now required for self-registered accounts, so
configure
MAIL_*with a working mail server. The migration2026_11_23_000002_mark_existing_users_as_verifiedmarks all existing accounts as verified, so nobody is locked out by the upgrade. - Uploaded images are re-encoded on the server. This removes metadata such as EXIF and GPS data and anything hidden inside the file. Images that cannot be decoded are rejected.
- Products have new columns and a numeric price. The migration
2026_11_23_000003_add_inventory_fields_to_products_tableaddssku(unique, empty for existing products),stock(0) andstatus(active), and storespriceasdecimal(10,2). Before converting, it rewrites existing prices: values that are not numbers or are negative become 0.00, and values above 99999999.99 are capped. A SKU is required when creating a product. Rolling back removes the SKU, stock and status values. Runningphp artisan db:seedadds the new demo catalogue but does not remove the old car demo products, categories or tags, and the old car photos are no longer shipped. Delete those rows in the UI if you do not want them. - Migrate with
php artisan migrate --force, thenphp artisan optimize:clear.
Rollback: redeploy the previous image or commit, then restore the database
backup taken in step 1 (mysql ... < backup.sql) and the saved storage/.
Migrations are not guaranteed to be reversible, so restore the backup instead
of relying on migrate:rollback.
Existing Docker data: the old stack (MySQL 8.0.17, root password
123456, mysql_native_password) stored data in the dbdata volume. The new
stack uses a fresh db_data volume with a non-root application user, so the
old data is not picked up automatically. Before switching, dump it from the old
stack (mysqldump as in step 1, run on the old checkout), then start the new
stack and import it:
docker compose exec -T db sh -c 'MYSQL_PWD="$MYSQL_ROOT_PASSWORD" mysql -uroot "$MYSQL_DATABASE"' < backup.sql.
Remove the old volume and its weak root password once you have verified the
upgrade.
Docker stack already on MySQL 8.4: the compose file now uses MySQL 9.7
LTS. MySQL upgrades an 8.4 data directory to 9.7 automatically the first time
the new container starts (an upgrade between two LTS releases is supported).
Take a dump first, as in step 1, because the upgraded data directory cannot be
opened by MySQL 8.4 again. To roll back, start a fresh mysql:8.4 volume and
import the dump.
Contributing
Contributions are welcome. Please read:
- CONTRIBUTING.md: development setup, commit conventions, the checks a pull request must pass, and how to add a CRUD module;
- ARCHITECTURE.md: how the application is put together;
- CODE_OF_CONDUCT.md: the Contributor Covenant 2.1, which everyone taking part agrees to follow;
- SECURITY.md: how to report a vulnerability. Do not open a public issue for security problems.
Security
Please report vulnerabilities privately. See SECURITY.md.
Images
The logo (public/images/logo.svg and the favicons) and the product
illustrations (public/images/products) were made for this project and are
released under the MIT license with the rest of the code. Their sources are in
resources/images; see resources/images/README.md.
License
関連プロジェクトを探す
読み込み中…