Laravel React Typescript Boilerplate
An opinionated boilerplate based on Laravel 8.*, React 16 and Typescript empowering you to get off the ground quickly without spending time on configuration.
Included:
- Laravel 8.*
- React 16
- Hot Module Reloading (npm run dev)
- Admin Middleware (See Below)
- Typescript
- Webpack 4
- React Router 4
- Axios
- Lodash (lodash-es)
- PostCSS
- PurgeCSS
- TailwindCSS
- Tailwind Forms Plugin
- Ant Design
- FontAwesome 5
- Emotion CSS-in-JS Library
- Debugbar
- Webpack Bundle Analyzer
- Log Viewer - /log-viewer (Protected by admin middleware)
- Laravel Telescope
Documentation
Frontend Files
Frontend JS & CSS files are placed in /frontend
.
Hot Module Reloading and Development:
First, allow insecure certs from localhost (for development). In Chrome, go to this url and Enable Insecure Certs from Localhost:
chrome://flags/#allow-insecure-localhost
Run HMR:
npm run dev
Production Development:
npm run production
To use production built files, set Laravel APP_ENV to production.
Admin Middleware
In config/auth.php add the emails of 'Admins' to the admins array. This allows you to easily restrict access to certain routes whereby the user's email is not in the admins array using the admin middleware.
Route::get('admin/profile', function () {
//
})->middleware('admin');
The admin middleware file is located at:
App\Http\Middleware\Admin
Contact
License
MIT License:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.