Skip to content

This is a sample of using React.js SSR(Server side rendering) with Laravel. It also demonstrates the use of routing and forms.

License

Notifications You must be signed in to change notification settings

praneybehl/laravel-react-ssr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel React SSR Proof of Concept

This is a sample project that uses React.js SSR(Server side rendering) with Laravel. It also demonstrates the use of routing and forms.

There are 2 folders:

  • frontend : contains the React project
  • backend : contains php Laravel project

Frontend project

To get started, do the following:

Swtich to the frontend folder: cd frontend

  1. Install npm packages:
yarn install
  1. Run development server:
yarn dev
  1. Build production bundle:
yarn build

This step bundles all static resources and and adds them to: ./backend/public/ folder.

Backend project

This project uses the spatie/laravel-server-side-rendering package.

Swtich to the backend folder: cd backend

To get started:

  1. Install composer packages
composer install
  1. Set up the NODE_PATH environment variable in your .env:
ENV=production
NODE_PATH=/path/to/my/node

for nvm users:

NODE_PATH='/Users/<USERNAME>/.nvm/versions/node/v<NODE_VERSION>/bin/node'
  1. Run:
php artisan serve

About

This is a sample of using React.js SSR(Server side rendering) with Laravel. It also demonstrates the use of routing and forms.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published