Before you begin setting up the project, ensure you have the following software installed on your machine:
-
Node.js: This is essential for running JavaScript outside the browser. You can download and install the latest version from the official Node.js website.
-
npm (Node Package Manager): npm is installed automatically with Node.js. It allows you to manage and install packages necessary for your project.
-
Git: Git is used for version control. If you don't have it installed, you can download it from the official Git website.
-
MongoDB: MongoDB must be installed according to your operating system. Follow the installation instructions from the official MongoDB website.
-
Postman (optional but recommended): Postman is useful for testing APIs and backend endpoints. You can download it from the official Postman website.
Setting up the .env
files is crucial for the project. These files store all the necessary environment variables required for the application to run, such as API keys and configuration settings. Follow these steps:
-
Separate .env Files for Frontend and Backend: The project uses two separate
.env
files, one for the frontend and another for the backend. Make sure to set up both configuration files properly before proceeding with the installation. -
Copy the Sample Environment Files: The repository includes sample environment files named
.env.sample.frontend
(in the frontend directory) and.env.sample.backend
(in the root directory). Copy these files to create your own.env
files.cd frontend/ && cp .env.sample.frontend .env cd backend/ && cp .env.sample.backend .env
-
Edit the
.env
Files: Open each.env
file in a text editor and replace the placeholder values with your actual API keys and configuration settings. You may need to add multiple API keys depending on the services your project integrates with.# Example .env file for backend DB_CONNECTION_STRING=your_database_connection_string_here
Replace
your_database_connection_string_here
with your actual credentials and configuration value. -
Run the Installation Scripts: After setting up the
.env
files in both the frontend and backend directories, run the following bash scripts in separate terminal sessions to install the necessary dependencies:./install-frontend.sh ./install-backend.sh
-
All in one Installation Script: After setting up the
.env
files in both the frontend and backend directories, run the following bash script to install the necessary dependencies and start both the frontend and backend:./install-all.sh
Follow these steps to set up the project on your local machine:
-
Clone the repository:
git clone https://github.com/viralxpost/viralxpost-web.git
-
Navigate to the project directory:
cd viralxpost
-
Make the installation script executable:
sudo chmod +x install.sh
-
Run the installation script:
./install.sh
In the project directory, you can run:
npm start
: Starts the backend server usingnodemon
withbackend/server.ts
.npm run dev
: Starts the frontend development server from thefrontend
directory.