By DigitalWitch | Cloud • DevOps • Security
This project is the frontend application for the Netflix-style platform. It connects to the backend API and provides the user interface for interacting with the system.
The frontend should be deployed on a separate Ubuntu server from the backend.
Before running the frontend application, make sure the following are installed on your Ubuntu server:
- Node.js
- npm
Update your package list and install Node.js and npm:
sudo apt update -y
sudo apt install nodejs -y
sudo apt install npm -ynode -v
npm -vgit clone https://github.com/{your-frontend-repository}.git
cd {your-frontend-folder}Run the following command to install all required packages from package.json:
npm installOr simply:
npm iBefore starting the frontend, update the API configuration so it points to your backend server.
src/api/axiosConfig.jsimport axios from 'axios';
export default axios.create({
baseURL: 'http://{your-backend-url}',
headers: {
'Content-Type': 'application/json',
},
});Replace:
http://{your-backend-url}:8080With your actual backend URL, for example:
http://192.168.1.10:8080or
http://your-domain.comAfter installing dependencies and updating the backend URL, start the frontend server:
npm startOnce the application is running, it will usually be available at:
http://localhost:3000If the frontend is hosted on a remote Ubuntu server, access it using the server IP address:
http://<server-ip>:3000- Make sure the backend server is already running and accessible.
- Confirm that the backend URL in
axiosConfig.jsis correct. - Ensure port 3000 is open on the frontend server.
- If your backend uses a custom port such as
8080, make sure that port is also open. - Use HTTPS in production environments for better security.
For better flexibility, you can use an environment variable instead of hardcoding the backend URL.
Example .env file:
REACT_APP_API_URL=https://your-backend-url/apiThen update axiosConfig.js like this:
import axios from 'axios';
export default axios.create({
baseURL: process.env.REACT_APP_API_URL,
headers: {
'Content-Type': 'application/json',
},
});Frontend setup steps:
- Install Node.js and npm on a separate Ubuntu server
- Clone the frontend repository
- Run
npm installornpm i - Edit
src/api/axiosConfig.jsand add your backend URL - Run
npm start
Good luck with your studies and project deployment.
— DigitalWitch
Please Clone the Code for the FullStack app
-
Frontend https://github.com/digitalwitchdemo/netflix_frontend.git
-
Backend https://github.com/digitalwitchdemo/netflix_backend.git
make sure you deploy the database before starting the backend.
Finally. Note: make sure you deploy the database before starting the backend.