|
| 1 | +# Laravel + React Starter Kit - ${LATEST_VERSION} |
| 2 | + |
| 3 | +[Shoaib Khan](https://github.com/iamspydey) from [Devs Buddy](https://devsbuddy.com) presenting you a highly opinionated Laravel Starter Kit with Inertia and React. It helps you get up and running quickly with clean, consistent, and fully type-safe code. |
| 4 | + |
| 5 | +## 🧩 Introduction |
| 6 | + |
| 7 | +This starter kit is a fork of [laravel's official react starter kit](https://github.com/laravel/react-starter-kit). |
| 8 | + |
| 9 | +It has been modified to be fully strict, with 100% type safety, and follows an action-oriented pattern. |
| 10 | + |
| 11 | +A few more helpful default features have been added, and the built-in authentication system has been updated to follow these strict rules. |
| 12 | +This ensures consistent code quality across your entire project. |
| 13 | + |
| 14 | +--- |
| 15 | + |
| 16 | +## 🌟 Inspirations |
| 17 | + |
| 18 | +- [nunomaduro/laravel-starter-kit-inertia-react](https://github.com/nunomaduro/laravel-starter-kit-inertia-react) |
| 19 | +- [nunomaduro/laravel-starter-kit](https://github.com/nunomaduro/laravel-starter-kit) |
| 20 | + |
| 21 | +These projects were the main inspiration for creating this starter kit. I’ve added additional features that are essential for most modern applications. |
| 22 | + |
| 23 | +## 🚀 Highlights |
| 24 | + |
| 25 | +1. **Fully Strict Types**: It follows 100% of type coverage for all the classes, methods and logic. |
| 26 | +2. **Action Oriented Pattern**: It uses dedicated Action classes for handling business logic and mutations. This keeps your controllers clean and makes actions reusable across your project. |
| 27 | +3. **Cruddy by Design**: It embraces the Cruddy by Design pattern to stay aligned with Laravel’s core concepts, making everything easy to understand and extend. |
| 28 | + |
| 29 | +--- |
| 30 | + |
| 31 | +## ⚙️ Default features |
| 32 | + |
| 33 | +1. **Authentication**: Based on Laravel’s built-in authentication, with a few tweaks to fit this project’s structure and standards. |
| 34 | +2. **Global Configs**: Most apps need some kind of global configuration that can be managed from one place and applied across the app. Includes settings like: |
| 35 | + - App Logo |
| 36 | + - App Favicon |
| 37 | + - Basic Mail Config (excluding mail server credentials) |
| 38 | +3. **Mail Templates**: Includes a dynamic mail template system with a flexible Mailable class. |
| 39 | + You can create templates with fields like Subject and Content, then send emails by simply calling helper methods with the template code — it just works. |
| 40 | +4. **Queuable Mail**: The mailing system combines the global config and mail template features. |
| 41 | + If mail queueing is enabled in the config, emails will automatically be pushed to the queue for asynchronous delivery. |
| 42 | +5. **Events**: From the beggining this starter kit includes some events that are being fired on each action that may some other action in future, for this I follow to create Event for each action taken in the app, this way in future you just add a listener to listen these events and act upon them. |
| 43 | + - Why custom events instead of model observers? |
| 44 | + |
| 45 | + I prefer explicit event handling over “magic” behavior. With custom events, you can keep logic clean and encapsulated inside dedicated listener classes. |
| 46 | + |
| 47 | +6. **Custom Helpers**: Instead of a typical `helpers.php` file, this kit organizes helpers as **Traits**, **Services**, **Support** classes, and **Facades**. |
| 48 | + - A small `helpers.php` file is still included for global functions where class imports aren’t possible. |
| 49 | + |
| 50 | +--- |
| 51 | + |
| 52 | +## 🧰 Getting Started |
| 53 | + |
| 54 | +### 1. Requirements |
| 55 | + |
| 56 | +Make sure you have the following installed: |
| 57 | + |
| 58 | +- PHP 8.4+ |
| 59 | +- Composer |
| 60 | +- Node.js & npm (or yarn/pnpm) |
| 61 | + |
| 62 | +### 2. Installation |
| 63 | + |
| 64 | +Clone the repository and install dependencies: |
| 65 | + |
| 66 | +```bash |
| 67 | +git clone https://github.com/devsbuddy/laravel-react-starter-kit.git your-awesome-app |
| 68 | +``` |
| 69 | + |
| 70 | +### Setup |
| 71 | + |
| 72 | +Navigate to newly created prject directory and run setup commands |
| 73 | + |
| 74 | +```bash |
| 75 | +cd your-awesome-app # Navigate to the project directory |
| 76 | + |
| 77 | +composer setup # Install all deps and setup project |
| 78 | +``` |
| 79 | + |
| 80 | +### Configure |
| 81 | + |
| 82 | +By default this starter kit uses sqlite database and if you want to use other database driver you can configure that in your `.env` file: |
| 83 | + |
| 84 | +```bash |
| 85 | +# Example PostgreSQL Config |
| 86 | + |
| 87 | +DB_CONNECTION=pgsql |
| 88 | +DB_HOST=127.0.0.1 |
| 89 | +DB_PORT=5432 |
| 90 | +DB_DATABASE=your_awesome_app |
| 91 | +DB_USERNAME=postgres |
| 92 | +DB_PASSWORD= |
| 93 | +``` |
| 94 | + |
| 95 | +After configuring new database you can run migration and seeders: |
| 96 | + |
| 97 | +```bash |
| 98 | +php artisan migrate --seed |
| 99 | + |
| 100 | +# OR |
| 101 | + |
| 102 | +php artisan migrate:fresh --seed |
| 103 | +``` |
| 104 | + |
| 105 | +### Start development server |
| 106 | + |
| 107 | +Now as the app is all setup correctly you can start working on it: |
| 108 | + |
| 109 | +```bash |
| 110 | +# Start development server |
| 111 | +composer dev |
| 112 | +``` |
| 113 | + |
| 114 | +### Check on browser |
| 115 | + |
| 116 | +After running your development server you can visit to [http://localhost:8000](http://localhost:8000) or [http://127.0.0.1:8000](http://127.0.0.1:8000) on your favorite browser to see the app in action. |
| 117 | + |
| 118 | +### Documentatin |
| 119 | + |
| 120 | +You can find more refined and detailed [Documentation](DOCUMENTATION.md) here. |
| 121 | + |
| 122 | +### 🤝 Contributing |
| 123 | + |
| 124 | +Contributions are welcome! |
| 125 | +If you’d like to improve this starter kit, feel free to: |
| 126 | + |
| 127 | +1. Fork the repository |
| 128 | +2. Create a new feature branch (`git checkout -b feature/your-feature`) |
| 129 | +3. Commit your changes (`git commit -m 'Added some feature'`) |
| 130 | +4. Push to the branch (`git push origin feature/your-feature`) |
| 131 | +5. Open a Pull Request |
| 132 | + |
| 133 | +Please make sure your code follows the existing structure and style conventions also all tests are passing. |
| 134 | + |
| 135 | +### 📄 License |
| 136 | + |
| 137 | +This project is open-source and available under the MIT License. |
0 commit comments