Deploy React JS bundle with Yii code base - reactjs

I am looking for a solution to deploy me ReactJS application bundle with Yii(PHP) code base, I am already having an Yii application which is having frontend and backend both, but some of the page I have migrated into ReactJS application, I want to run both application on same environment,
I need help to configure the application and manage the routing also in the same fashion like old application will reload the page and ReactJS based code will run as client side.
Server: AWS
Technology: ReactJS + Yii (PHP)
Any suggestion !!!

Related

How can we achieve Ruby on Rails MVC application with React Applicaiton on Same server (I will use API's from MVC Application only)?

I have Ruby on Rails MVC Application deployed into AWS server.
Using Ngnix and Passenger
But now I want to deploy react application deploy in same server with same domain using MVC application API's
How to configure Ngnix for react application to run both MVC and React Application with same backend
Here react is in different project folder

React + Laravel, should I do it in 1 or 2 seperate repositories?

After learning Laravel basics and React.js basics I want to build an app that use Laravel for backend and React.js for frontend. Would it be better to include the React.js in Laravel app with artisan ui react or do it in 2 seperate repositories, 1 for Laravel to build APIs and include it in an addon domain e.g www.api.mywebsite.com which would act as a backend website and redirect to the React.js app if accessed by public and 1 for React.js app that would be used for public, on the main domain e.g www.mywebsite.com which would just fetch data over www.api.mywebsite.com. So which way is better as I'm developing both frontend and backend, and I also plan on learning and developing React Native mobile apps that would use the same Laravel backend?
Both alternatives work just fine, but it's easier to set up an api.mywebsite.com subdomain. Since you are going to also develop mobile apps that will connect to the API, that strengthens the argument of separating the API from the front-end app.

In a React App, should the country-state-city package go into the backend or frontend?

The country-state-city package is heavy in size. Can someone list the precise size of the package?
Design 1:
Load the package in the frontend APP
Design 2:
Load the package in the backend APP and then have the frontend ping the backend to send the appropriate State/City list upon detecting a change to the Country/State?
Which is the correct design in such scenario?
The full APP will be for mobile as well as web browsers.

Microservices architecture tutorial for springboot and react in production

My project contains two apps. Backend – springboot and a frontend - React.
I am using the spring-boot app only as a rest API to fetch data from the database. The React app frontend will call the API. Up until now, we were using only one environment (Windows) so production build was one jar that actually contains both apps and a tomcat. That was quite simple so by adding a proxy in the package.json file to point to the backend and some maven(frontend-maven-plugin) plugin the building process is simple.
Now we need to change the system architecture so each app will be hosts on a different windows machine.
I was trying to use express to host the react app but I am struggling with the proxy setup for the backend (spring) app from the express server. All the tutorials that I found actually using the express server as the backend API but I need the express server only for hosting the production build.
Is there a good tutorial that shows how to set up this type of architecture in production env.
Thank you

React & Laravel: split API and Frontend?

As I have learned a lot for now about React and Laravel, I can of course create a laravel app using
laravel new MyApp
and set the preset to react with
php artisan preset react
Now I can build a nice app with frontend and API.
But is this best practice? I'm wondering if it wouldn't be better to install a react app i.e. with create-react-app and seperate it from laravel as I don't need the whole view stuff in laravel.
Building with React CLI create-react-app
You can host your website with static hosting server which is far more cheaper for more traffic scenario.
Although separate php server his required to host api part with laravel but, these api can be used in mobile apps. You may host on single server with a subdomain.
SEO will be a headache. You will need a separate nodejs function to inject the seo tags or any other way.
As you frontend and backend is isolated, your system will be a bit safer from backend/admin panel vulnerabilities. You just need to secure all your apis.
Building within laravel php artisan preset react
Easy SEO part with server side rendering possible using laravel.
Single server, single domain easy to maintain.

Resources