laravel-react-starterkit maintained by baledev
Laravel Starterkit
An open source starter kit for internal applications: Laravel 13, Inertia v3, React 19 (TypeScript), Tailwind v4, PostgreSQL and Pest.
"Internal" means software used by a known group of people, such as the staff of an organization, not a public application with open sign-up. Anyone is welcome to use it for their own internal applications.
Included: invite-only accounts with activation links, roles and permissions, an audit log and sign-in history, two-factor authentication, passkeys, account settings, and a server-side data table.
Requirements
- PHP 8.5 with
pdo_pgsql - Composer 2
- Node.js 22 and pnpm
- PostgreSQL
Create a new project
With the Laravel installer
laravel new my-app --using=baledev/laravel-react-starterkit --database=pgsql
cd my-app
Pass --database=pgsql: without it the Laravel installer switches the project to SQLite. The installer runs the Composer hooks, so the project is named after its directory. If it offers to install and build the frontend with npm, decline; this project uses pnpm.
With Composer
composer create-project baledev/laravel-react-starterkit my-app
cd my-app
The project is named after its directory.
From a clone or a GitHub template
git clone https://github.com/baledev/laravel-react-starterkit.git my-app
cd my-app
composer install
php artisan app:init "My App"
Then, for every method
Check the database settings in .env, then:
composer setup
php artisan user:create-admin admin@example.com
composer setup creates the database if it does not exist, runs the migrations, seeds the roles, installs and builds the frontend with pnpm, and generates the coding agent skills in .claude with Laravel Boost. The last command prints the activation link of the first administrator.
What app:init changes
| File | Change |
|---|---|
.env, .env.example |
APP_NAME, DB_DATABASE |
phpunit.xml, .github/workflows/tests.yml |
Test database name |
composer.json, composer.lock |
Package name, description and license |
README.md |
Replaced by a short project README |
CHANGELOG.md, CONTRIBUTING.md, CODE_OF_CONDUCT.md, SECURITY.md, .github/ISSUE_TEMPLATE, .github/PULL_REQUEST_TEMPLATE.md |
Removed |
The license in composer.json becomes proprietary; pass --license=MIT (or another SPDX identifier) to choose another. LICENSE stays, as the MIT License requires its notice to remain with the code that comes from this starter kit. The files are only removed and the README only replaced the first time a project is initialized, never by --force.
The page title, sidebar, web app manifest, mail sender, cache prefix and session cookie follow APP_NAME.
Options: --package=vendor/name sets the Composer package name, and --force renames a project that was already initialized. Rebuild the frontend afterwards.
After initializing
- Replace
logo.svg, the favicons and theweb-app-manifest-*.pngicons inpublic/. - Extend the generated README, and add your own
SECURITY.mdor issue templates if the project needs them. - Keep the notice in
LICENSE; you may add your own copyright line.
Development
composer dev # server, queue worker, logs and Vite
composer ci:check # everything CI runs
Tests use a real PostgreSQL database named in phpunit.xml (<database>_testing). Create it once:
createdb -U postgres laravel_starterkit_testing
Seeding in the local environment (php artisan db:seed) creates the administrator test@example.com with the password password.
Conventions are described in CLAUDE.md.
Generate a resource
php artisan make:crud PurchaseOrder --fields="number,total:decimal?,is_urgent:boolean" --form=sheet
php artisan migrate
php artisan db:seed --class=RolePermissionSeeder
This creates the model, migration, factory, data table index page, create and edit forms (in a sheet, or on their own pages with --form=page), delete dialog, permission, sidebar link and Pest tests, following the conventions in CLAUDE.md. Field types are string, text, integer, decimal, boolean and date; add ? to make a field optional. The stubs are in stubs/crud.
Deployment
- Set
APP_ENV=production,APP_DEBUG=falseandAPP_URL. - Behind a reverse proxy, set
TRUSTED_PROXIES. - Administrators create roles and choose their permissions on the Roles page. Deploying does not undo those changes.
- Administrators can deactivate or permanently delete other accounts. Deactivate people who leave, so their records are kept.
- Users cannot delete their own account. Set
ACCOUNT_SELF_DELETION=trueto allow it. - The Audit log and Sign-ins pages show changes to accounts and roles, and who signed in, to roles with the "View audit log" permission. Changes are kept for 365 days (
AUDIT_LOG_RETENTION_DAYS) and sign-ins for 90 (SIGN_IN_RETENTION_DAYS);0keeps them forever. They include names, email addresses and IP addresses, also of deleted accounts. - On every deploy, run
php artisan migrate --forceandphp artisan db:seed --class=RolePermissionSeeder --force.migratecreates the database first when it does not exist yet.
With Docker Compose
cp .env.example .env # set APP_KEY, APP_URL (the address you open the app at, such as http://localhost:8080), DB_PASSWORD, APP_ENV=production and APP_DEBUG=false
docker compose up -d --build
docker compose run --rm app php artisan user:create-admin admin@example.com
compose.yaml runs the web server (port APP_PORT, default 8080; APP_URL must use the same port, since it is the base of the activation link printed by user:create-admin), a queue worker, the scheduler and PostgreSQL. A one-off migrate service migrates and seeds the roles on every up, before the other services start. Put a reverse proxy with TLS in front, and set TRUSTED_PROXIES. To update, pull the code and run docker compose up -d --build.
Podman works too: use podman compose with a recent podman-compose (1.1 or later) or with Docker Compose pointed at the Podman socket. Older podman-compose versions ignore the migrate service's service_completed_successfully condition, so the other services may start before the migrations finish. Prefer named volumes over bind mounts with rootless Podman, which can leave files with the wrong owner. For local development, running only PostgreSQL in a container and using composer dev on the host is simpler: podman run -d --name pg -e POSTGRES_PASSWORD=postgres -p 5432:5432 docker.io/library/postgres:18.
Without containers
deploy.sh pulls the code, installs dependencies, builds the frontend, migrates, seeds the roles, caches the configuration and signals the queue worker to restart, with the application in maintenance mode meanwhile. Two examples in deploy/ keep the processes running:
queue-worker.service: a systemd unit forphp artisan queue:work.scheduler.cron: the cron entry forphp artisan schedule:run. The scheduler deletes expired records and makes the daily backup.
Backups
The scheduler runs php artisan db:backup daily at BACKUP_TIME (02:00). It writes a pg_dump file in custom format to the disk named by BACKUP_DISK, in database/, and deletes files older than BACKUP_RETENTION_DAYS (14; 0 keeps them forever). pg_dump must be installed (the Docker image includes it).
The default backups disk is storage/app/backups on the same server, which does not survive losing the server. Configure an off-server disk such as s3 in config/filesystems.php, set BACKUP_DISK to it, and test a restore now and then.
To restore, stop the application and the workers, then restore into an empty database:
docker compose stop app queue scheduler # or: php artisan down
createdb -U postgres -h HOST restored_db
pg_restore -U postgres -h HOST --no-owner --dbname=restored_db database-2026-01-01-020000.dump
# Verify, then point DB_DATABASE at restored_db, or drop the old database and restore under its name.
docker compose up -d # or: php artisan up
With Compose, run these with docker compose exec postgres and copy the file in with docker compose cp. Backups contain every credential hash and the audit log: store them as carefully as the database.
Error monitoring
Exceptions go to the LOG_STACK channels, single by default (storage/logs/laravel.log). Options, none required:
- Add a hosted service such as Sentry or Laravel Nightwatch, following its installation guide. Both hook into Laravel's exception handling.
- Send errors to a chat channel with
LOG_STACK=single,slackandLOG_SLACK_WEBHOOK_URL, which reportscriticalerrors and worse unlessLOG_LEVELsays otherwise. - Watch
/up, the health endpoint, with an uptime monitor, and failed jobs withphp artisan queue:failed.
Versioning and updates
Releases are tagged vMAJOR.MINOR.PATCH and listed in the changelog. While the version is below 1.0, a minor release may contain breaking changes; each one is marked Upgrade in the changelog.
A project made from the starter kit is an independent copy, and app:init renames files, so its history is unrelated to this repository. app:init also removes CHANGELOG.md, so read the changelog on GitHub. To apply upstream changes, bring the difference between two releases into your project:
git remote add starterkit https://github.com/baledev/laravel-react-starterkit.git
git fetch starterkit --tags
git diff v0.1.0 v0.2.0 -- . ':!README.md' ':!CHANGELOG.md' ':!composer.lock' ':!pnpm-lock.yaml' > ../starterkit.patch
git switch -c update-starterkit-v0.2.0
git apply --3way ../starterkit.patch
- Start from the release your project was made from (
git logof your first commit says which). Afterwards, note the release you updated to, such as in a commit message, so the next update knows where to begin. --3wayleaves conflict markers where you changed the same lines. Resolve them, or add--rejectto write the failed hunks to.rejfiles. Files your project renamed or removed show up as conflicts or are skipped.- The patch does not contain the project name, which
app:initwrote in your own files:README.md,composer.jsonand the lock files are excluded, and.env.example,phpunit.xmland the CI workflow may conflict on the lines holding the name. - Update the lock files with
composer updateandpnpm updateinstead of copying them, and checkcomposer.jsonandpackage.jsonby hand. - Run
composer ci:checkand your own tests, then runphp artisan migrateandphp artisan db:seed --class=RolePermissionSeederas for any deploy. New migrations are in the patch. - Take only what you need:
git diff v0.1.0 v0.2.0 -- path/to/fileshows one file, andgit log v0.1.0..v0.2.0 -- pathlists the commits that touched it.
The more a project changes the starter kit's own files, the more conflicts an update has. Put your code in new files where you can.
Contributing
Bug reports, ideas and pull requests are welcome.
- Contributing guide
- Code of Conduct
- Security policy: report vulnerabilities privately
Credits
Built on the Laravel React starter kit.
License
Released under the MIT License. Copyright (c) 2026 Hermansyah, Aplikantara.