This is a basic web server to handle API requests for the Argos App including a web and mobile app frontend.
- Authentication using JWT tokens.
- RESTful API to track user activity.
- Added 'Hello World' GitHub action
- Frontend: React
- Backend: Node.js, Express
- Database: MongoDB
- Authentication: JWT
This project requires a MongoDB database and Node.js to run.
Create a .env
file in the root directory of the project. Update the file with your values.
NODE_ENV=development
PORT=5000
MONGO_URI=YOUR MONGO URI
JWT_SECRET=abc123
To install the necessary dependencies, you need to run npm install
in three places: the root directory, frontend directory, and backend directory. Navigate to each directory in the terminal and run the command:
npm install
Once the dependencies are installed, you can start the development server. This project uses the concurrently
library to run the frontend and backend servers simultaneously. Run the following command in the root directory:
npm run dev
Now, both the frontend and backend servers should be running. The backend server runs on http://localhost:5000 and the frontend server runs on http://localhost:3000 (or another port, if 3000 is occupied).
To deploy the application, we use PM2 and NGINX. We have created a script that automates the deployment process.
You need to ensure that PM2 and NGINX are installed on your server and then follow these steps:
If you want to deploy from your local machine, you can set up a git repository on your server and link it to your local machine via SSH. This allows you to push changes from your local machine to the server directly.
-
Setup a git repository on your server and link it to your local machine using SSH.
-
Ensure you have the correct remote set on your local machine to push changes.
-
Navigate to the root directory of your project in the local terminal.
-
Update the
start.config.cjs
file with your server's details. -
Create a
.env
file in the root directory of the project with your environment variables (similar to the one described above for local development). -
Push changes to your server:
git push server master
-
Run the deployment script from your local machine:
pm2 deploy start.config.cjs production setup
-
For subsequent deployments, use the update command from your local machine:
pm2 deploy start.config.cjs production update
Alternatively, you can clone your project directly to the server and run the deployment script from there.
-
Clone your project to the server.
-
Navigate to the root directory of your project in the server terminal.
-
Update the
start.config.cjs
file with your server's details. -
Create a
.env
file in the root directory of the project with your environment variables (similar to the one described above for local development). -
Run the deployment script:
pm2 deploy start.config.cjs production setup
-
For subsequent deployments, use the update command:
pm2 deploy start.config.cjs production update
In both cases, remember to check your server's sites-available/default
file to ensure the server block for your application is correctly configured for NGINX.
This project is MIT licensed.
Please replace "Project Name", the project description, and the list of features with details relevant to your specific project. You can also add sections like Usage
, Contributing
, or Contact
as needed.