Skip to content
Projects

Labs64/laravel-boilerplate

View on GitHub

About

Laravel starter for your application and its portal: accounts, admin area, roles, CRUD screens and guided tours, with optional NetLicensing licensing

Web & App Development

How these counts are measured

Measured star growth

in 24h
0
in 7 days
+1
in 15 days
0
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README.md

Original

Laravel Boilerplate

CI Laravel 13 PHP 8.4+ Latest Stable Version Total Downloads License

A Laravel 13 starter with the parts every application needs already built, tested and secured: sign-in, accounts, an admin area, roles and permissions, and an API. You start with the features that make your app yours.

Laravel's official starter kits scaffold a front end. This is the back office and portal around it: who may sign in, what each role may do, what administrators see, and how the API is exposed — server-rendered Blade, with no SPA to maintain. Membership plans and guided tours are there when you want them, and stay out of the way when you don't.

Laravel Boilerplate: a stack of ready layers (Docker environment, Laravel 13, accounts, admin area, licensing and tours) with your idea going on top.

make setup, sign in, build. No accounts or API keys needed.

Why this boilerplate

  • It runs at once. One command starts the application in Docker with sample accounts, a mail catcher and a database browser. Licensing is off until you want it, and then works offline until you connect it.
  • It is secure, and stays secure. Permissions on every admin screen, the same sign-in rules on every way in, and delegated administrators who can't give themselves more. Tests enforce these rules, so a change that breaks one fails make check.
  • It grows with you. One command generates an admin screen with its table, form, permission, menu entry and tests.
  • AI coding agents know their way around. AGENTS.md explains the conventions and rules, project skills cover the jobs that repeat, and Laravel Boost adds Laravel's own guidance.

What you get

Home and areas Every user lands on a home page with the areas their role opens, their plan, how well their account is protected and the latest announcements. Administrators decide which roles see which areas
Accounts Registration with email confirmation, password reset, social login, two-factor authentication (authenticator app and recovery codes) and passkeys, an account page (name, password, linked providers, devices, deletion), invisible reCAPTCHA
Admin area Dashboard of what needs attention, announcements, users with invitations and restore, roles and what each may do, sign in as a user, activity log, log viewer, command palette (Cmd+K / Ctrl+K)
Admin screens Generated from a model, with server-side tables, search and CSV export
API JSON under /api/v1 with tokens that users create on their account page, limited to the permissions they tick
Guided tours Built into the interface, a tour per page, finished tours remembered per user, using GuideChimp
Extras Terms and privacy pages, translations, meta tags, Gravatar, Google Analytics, error reports by email
Developer tools Docker environment, tests, browser smoke test with accessibility checks, code style, static analysis, GitHub Actions, an installation doctor
Licensing (optional) Membership plans bought in the NetLicensing Shop and validated by Labs64 NetLicensing, off in a new installation, offline until you connect it
The sign-in page with a link to register and to reset a password
Sign-in, registration and password reset
The admin dashboard with users, users needing attention, active plans, two-factor adoption, the newest users and the latest activity
Admin dashboard
The list of users with search, roles, status and an Add user button
Users, with invitations and restore
The account page with profile and password forms
The user's own account
A role's page with its permissions in groups, level pickers, a search and the people who have the role
Roles: permissions in groups, people by email
Who can open the members area: the roles that grant it, the people it reaches and how many have a valid plan
Who can do what, with NetLicensing plans

Built on Laravel 13, PHP 8.4+, Gentelella 4 and Vite. Works with MariaDB, MySQL, PostgreSQL and SQLite.

Quick start

You need Docker with Compose v2, and make.

To start your own project, press Use this template on GitHub and clone your copy. Without Docker, composer create-project labs64/laravel-boilerplate also works once the package is published; CI tests that install on every change. Or clone this repository to try it:

git clone https://github.com/Labs64/laravel-boilerplate.git
cd laravel-boilerplate
make setup

This builds the containers, installs everything, creates the database with sample data and runs the tests. Then open http://localhost and sign in:

Account Email Password
Administrator [email protected] admin
Manager (users, announcements, dashboard, activity; not roles or logs) [email protected] manager
Member (the areas only) [email protected] demo
Service Address
Application http://localhost
Mailpit (catches outgoing email) http://localhost:8025
phpMyAdmin http://localhost:8080
MariaDB localhost:3306, user root, password secret

Something not right? docker compose exec laravel-env php artisan app:doctor checks the installation and says how to fix what is missing.

Without make
cp .env.example .env
export HOST_UID=$(id -u) HOST_GID=$(id -g)
docker compose up -d --build --wait
docker compose exec laravel-env composer setup

On Linux, if your user ID isn't 1000, keep the export line so that new files belong to you.

Without Docker

You need PHP 8.4+ (with intl, mbstring, xml, zip, curl, bcmath and your database driver), Composer 2, Node.js 22.12+ and a database.

  1. Copy .env.example to .env.
  2. Set your database connection. For SQLite, set DB_CONNECTION=sqlite, remove the other DB_* lines and create an empty database/database.sqlite.
  3. Set APP_URL=http://localhost:8080. Without a local mail server, also set MAIL_MAILER=log.
  4. Install and start:
composer setup
composer dev

Then open http://localhost:8080.

Build your first screen

Say your application sells products. Generate the admin screen for them:

make shell
php artisan app:make-feature Product
php artisan migrate

Open http://localhost/admin/products as the administrator: Products is in the sidebar, with a searchable list, CSV export and forms to add, change and delete. The command wrote:

Model, migration, factory app/Models/Product.php, database/migrations/…_create_products_table.php, database/factories/ProductFactory.php
The screen app/Http/Controllers/Admin/ProductController.php, its route in routes/web.php, breadcrumbs in routes/breadcrumbs.php
Who may open it the products.manage permission in config/permissions.php, the menu entry in config/menu.php
Texts lang/en.json
Tests tests/Feature/ProductScreenTest.php: permissions, listing, search, create, change, delete, validation

Then make it yours:

  1. Add your columns to the migration, $fillable in the model, the factory, and columns() and fields() in the controller. The Gentelella for Laravel docs list every column and field type, and AnnouncementController is a complete example.
  2. Let others in. Administrators see the screen at once. For another role, tick products.manage under Permissions.
  3. Check it with make check: code style, static analysis and all tests, yours included.

One limit of the table package: CSV exports don't neutralize spreadsheet formulas, so take care opening exports of text that users typed.

Everyday commands

Docker Inside the container, or without Docker What it does
make up / make down Start (installing the app if needed) or stop the containers. The database is kept
make clean Delete the containers, the database and installed files
make shell Open a shell in the PHP container
make dev npm run dev Reload the browser as you edit
make test composer test Run the tests
make check composer check Code style, static analysis and tests
make ci sh scripts/ci-local.sh Before pushing: the CI jobs make check skips, on a clean copy
composer lint Fix code style
npm run build Build assets for production

npm run smoke clicks through a running development installation and fails on JavaScript errors and serious accessibility findings (axe-core). Run it on your own machine, since it needs Google Chrome. npm run screenshots retakes the pictures above in the same way.

Where things are

To change Edit
Pages routes/web.php, resources/views
Sidebar and command palette config/menu.php
Who may do what config/permissions.php, then Permissions in the admin area
The API routes/api.php, app/Http/Controllers/Api/V1, app/Http/Resources/V1
Styles and scripts resources/css, resources/js
Interface texts and languages lang/, then list extra languages in APP_ADDITIONAL_LOCALES
Middleware and error handling bootstrap/app.php
Settings .env; .env.example explains each one

AGENTS.md has the complete map, and the rules to keep when you change things.

Built in

Areas. Each item under Workspace in the sidebar is an area. A user sees an area, in the sidebar and on Home, when their role has its permission; tick it under Permissions, where the areas come first. Announcements is the example: administrators write them, the default role reads them. To add an area, give its route a permission (can:reports.view), list that permission under areas in config/permissions.php and add the item to the workspace in config/menu.php.

Roles and permissions. Administrators may do everything; tick what other roles may do under Permissions. Hand out part of the admin area safely: nobody grants a permission they lack or touches a stronger account, not even a role manager. More in the wiki.

Sign in as a user. Administrators open a user's session from the users list to see what they see: read-only, never into another administrator, and recorded in the activity log. More.

Activity log. Changes to users, roles, permissions and API tokens are recorded with who made them, under Activity. Record your own with App\Support\Audit::log(). More.

API. Off by default. With API_ENABLED=true, users create tokens on their account page and call /api/v1. A token does only what both its abilities and its user's permissions allow, checked on every request. More.

Guided tours. Put <x-tour> with its steps in a page, and a button in the top bar walks users through it. More.

Terms and privacy. Off by default. LEGAL_PAGES=true publishes /terms and /privacy from the Markdown in resources/markdown/legal and links them in the footers; replace the sample texts first. LEGAL_ACCEPT_AT_REGISTRATION=true adds a box to the registration form that must be ticked, and stores the time in users.terms_accepted_at.

Licensing. Put a route behind a licence with the protection middleware, or part of a page:

@protection('YOUR-MODULE-NUMBER')
    Members only.
@endprotection

Users see their plan on Home, on their account page and under Membership, with a button to buy or extend it in the NetLicensing Shop; NetLicensing validates it. A new installation has licensing off (NETLICENSING_ENABLED=false): no plans are shown, the membership pages do not exist, and an area that needs a plan stays closed. Set NETLICENSING_ENABLED=true to try the member area with the offline driver (NETLICENSING_DRIVER=fake), which lets everybody in. To sell plans, connect Labs64 NetLicensing with NETLICENSING_DRIVER=netlicensing and your product; php artisan app:doctor --licensing checks the connection. /member/example is a working example to copy. Set up membership plans.

Security

These rules hold out of the box, and tests fail when a change breaks one:

  • Every admin screen is in the admin middleware group and asks for its own permission.
  • Every way of signing in (password, passkey, social login, confirmation and reset links, API tokens) asks the same sign-in rules, and a link or a provider never replaces a second factor.
  • Nobody gives a role, an account or a token more than they have themselves, and only administrators touch administrators.
  • Password reset and the confirmation mail answer the same whether or not an account exists, and no mail goes to the made-up address of a social account.
  • Changing a password ends the other sessions, and a deactivated user is signed out everywhere.
  • Every form that changes data has CSRF protection, Blade escapes its output, and scripts write text, not HTML.

Sign-in, registration, password reset, two-factor codes, passkeys, social login and the API have rate limits. Found a vulnerability? See SECURITY.md.

Going to production

All settings live in .env, and .env.example explains them. In production:

  • Set APP_ENV=production and APP_DEBUG=false.
  • Set NETLICENSING_DRIVER=netlicensing: the offline driver refuses to run in production.
  • Use HTTPS with the right APP_URL: passkeys belong to its host. To make everyone who enters the admin area use a second factor, set REQUIRE_TWO_FACTOR_FOR_ADMINISTRATORS=true.
  • Behind a reverse proxy or load balancer, such as one that ends HTTPS, set TRUSTED_PROXIES to its addresses (or * when the application can only be reached through it). Otherwise links use http and every visitor shares the proxy's rate limits.
  • Run php artisan app:doctor. It fails on settings that are unsafe in production.

php artisan app:setup creates no sample accounts there. Don't run db:seed: it empties the users and roles tables. Instead, register your account, then make it an administrator:

php artisan app:make-admin [email protected]

Troubleshooting

Problem Fix
You are not sure the installation is complete docker compose exec laravel-env php artisan app:doctor names what is missing and how to fix it
"No application encryption key has been specified" Run make up, or php artisan key:generate without Docker
A port is already in use Set APP_PORT, FORWARD_DB_PORT, VITE_PORT, FORWARD_MAIL_PORT, FORWARD_MAILPIT_PORT or FORWARD_PMA_PORT in .env. With APP_PORT, add the port to APP_URL too
Database connection refused The host is mysql inside Docker (set for you) and 127.0.0.1 outside
"Vite manifest not found" Run npm run build, or keep npm run dev running
Files owned by the wrong user (Linux) Rebuild with make up
You want a clean database docker compose down -v, then make setup
You need step debugging XDEBUG_MODE=debug make up, with your IDE listening on port 9003
A NetLicensing error php artisan app:doctor --licensing, then the wiki

Upgrading

Pull the new version, then run composer install, php artisan migrate and npm ci && npm run build. Existing installations upgrade in place: migrations are added, never changed. What changed, and what to check in your own code, is in Upgrading, including the move from the Laravel 8 version.

Documentation

  • Wiki: guides for roles, the API, tours, membership plans, Docker and upgrading
  • AGENTS.md: the map of the code and the rules to keep, for people and AI coding agents
  • CONTRIBUTE.md and SECURITY.md

Contributing

Pull requests are welcome. Read CONTRIBUTE.md and run make check before sending one. Report bugs and ask questions in GitHub Issues.

License

MIT, by Labs64.

Star history


Labs64.IO
Made by the Labs64 team and community.
Supported by Labs64.IO Ecosystem · NetLicensing · GuideChimp

Explore related projects

Loading…