Yii2 React Starter Kit
A modern Yii 2 application template with a React frontend powered by
Inertia.js and shadcn/ui.
Authentication, roles and user management are done. Start on the features that matter.
Getting started · Documentation · Build your first feature
Features ¶
- Authentication: sign in with "keep me signed in", registration, password resets by email, password changes
- Roles:
userandadmin, enforced on the server, manageable from the UI or the command line - User management: searchable, sortable, paginated table with filters, column picker and row actions
- Admin dashboard: statistics, a sign-ups chart and recent users; members see their own account overview
- Security:
- CSRF protection on every request
- Login throttling, and responses that don't reveal which emails are registered
- Hashed, single-use reset tokens
- A password change signs out other sessions
- Protection against mass assignment
- shadcn/ui admin layout: collapsible sidebar, breadcrumbs, user menu, light, dark and system themes
- No API layer: controllers return React pages with Inertia.js; server-side validation errors appear in forms
- Tested: Codeception unit and functional tests that run on SQLite with no setup
Tech stack ¶
| Backend | Frontend | Tooling |
|---|---|---|
| Yii 2.0 on PHP 8.2+ | React 19 | Vite 6 |
| crenspire/yii2-inertia 2.0 | Inertia.js v3 | Codeception 5 |
| MySQL / MariaDB | shadcn/ui, Radix UI, Tailwind CSS 4 | ESLint |
| Symfony Mailer | lucide icons, Recharts, Geist font | Docker Compose |
Quick start ¶
git clone git@github.com:crenspire/yii2-react-starter.git my-app
cd my-app
composer install && npm install
cp .env.example .env # set COOKIE_VALIDATION_KEY and the database credentials
php yii migrate
php yii seed/admin admin@example.com
npm run serve # http://localhost:8080
Requirements: PHP 8.2+, Composer, Node.js 22+ and MySQL or MariaDB. See Getting started for details.
Screenshots ¶
Sign in |
User management |
Edit user |
Settings |
Screenshots follow your GitHub theme: switch between light and dark mode to see both.
Documentation ¶
| Getting started | Installation, first admin user, development servers |
| Configuration | Environment variables, email, frontend assets |
| Architecture | How requests become React pages, shared props, redirects, errors |
| Authentication and roles | Sign-in security, password resets, roles, access control |
| Frontend | Pages, layouts, components, forms, theming |
| Building a feature | Step-by-step walkthrough from migration to tests |
| Testing | Unit and functional tests and their helpers |
| Deployment | Production checklist, Nginx, Apache, Docker |
| Troubleshooting | Common problems and fixes |
The Inertia adapter has its own documentation at crenspire.github.io/yii2-inertia.
License ¶
Released under the BSD-3-Clause license. See LICENSE.md.
User Contributed Notes
Leave a comment
If you have any questions, please ask in the forum instead.
Join the conversation to share a note.