百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
R

react-laravel-boilerplate

> 前端框架
开源

基于 React/Redux 的 Laravel REST API 后端,开发阶段支持热模块重载以及路由级别的代码拆分

173 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

基于 React/Redux 的 Laravel REST API 后端,开发阶段支持热模块重载以及路由级别的代码拆分

!!! This repository is very out of date and not maintained or recommended! !!!

When I made this repository years ago, other tools were in their infancy and I applied the practices I deemed to make the most sense back then to this boilerplate.

Since then, many new tools have come out and have changed the way I think about creating new projects.

If I were to create a project consisting of an API based back-end and a front-end today, I would do so this way:

  • One repository for front-end using NextJS

  • No Redux if at all possible, rely on react-query or SWR to handle state coming from the server, and use context if something is needed on a global level.

  • Another Laravel repository for the back-end

  • Use Sanctum for authorization with your SPA front-end, possibly use Laravel Fortify for your logic set-up or roll your own.

React Laravel Boilerplate

This is the boilerplate that I personally use for getting projects off the ground quickly using my favourite stack of technologies. It uses Laravel as a backend API service, and has a React single page application in the front end.

Features

  • Laravel Passport API authentication
  • Route level code splitting using React Lazy/Suspense
  • Login/signup functionality implemented and tested
  • Webpack configuration for development and production
  • React/Redux single page application using React Router
  • Some basic components already built in resources/assets/js/components
  • Simple form building using Formik
  • Component library and interactive component building via Storybook
  • Hot module reloading for your React components using Webpack Dev Server and React Hot Module Reloader
  • Tailwind CSS for utility class styling (see https://tailwindcss.com)
  • Support for scoped styling using React CSS modules using Gajus React CSS Modules
  • Continous build integration via Travis CI
  • Automatic code style fixing with Prettier

Installation

I personally use Vagrant and Homestead, so these installation instructions assume that you use Homestead as well, but the project's dependencies are very similar to the base Laravel installation, so if you use something else to develop locally, the instructions shouldn't change too much.

  • Clone the repository using git clone https://github.com/huwcarwyn/react-laravel-boilerplate
  • Fill out a .env file in the project root using the .env.example file as a template
  • Install composer dependencies using composer install
  • Run php artisan key:generate php artisan migrate php artisan passport:install and php artisan storage:link
  • Install NPM dependencies using npm install
  • Make sure to create two databases, one main and one for running the tests, then run php artisan migrate
  • If you want to use the webpack dev server, make sure that the proxy entry in the weback.dev.js points to the server that's running your Laravel installation.

Important note about development

Since this application takes advantage of webpack hashes to bust caches in production, the asset() and mix() helpers are used when loading front end assets. This means that it is important to set a correct value for ASSET_URL in your .env file. Otherwise Laravel will load assets from the wrong place.

If you are developing using npm run hot - make sure to set ASSET_URL to http://localhost:9000, otherwise for development set it to the root URL of your app.

In production you will need to set this value to the public root, that will usually be the same as your domain name.

Issues· 23 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

PHPboilerplatecode-splittingformikhot-module-replacement

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类前端框架
定价开源

> 相关工具

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架