Before starting the installation, make sure your system has the following software installed:
- Node.js and npm: Ensure Node.js (recommended LTS version) and npm are installed. You can check the installed versions with the following commands:
node -v
npm -v-
MongoDB: Install MongoDB database. Refer to the MongoDB Installation Guide for installation instructions.
-
RabbitMQ: Install RabbitMQ message queue. Refer to the RabbitMQ Installation Guide for installation instructions.
Clone the project from the GitHub repository to your local machine:
git clone https://github.com/yx-fan/app_backend.git
cd app_backendRun the following command in the project root directory to install the project dependencies:
npm installCreate a .env file in the root directory and add the following variables for starting locally:
PORT=3000
MONGO_URI=mongodb://localhost:27017/travel-expense-tracker
JWT_SECRET=change_to_the_jwt_secret
LOG_LEVEL=debug
NODE_ENV=development
RABBITMQ_URL=amqp://127.0.0.1:5672
SENDER_EMAIL=change_to_sender_email
SENDER_EMAIL_PASSWORD=change_to_sender_email_password
PROD_BASE_URL=change_to_production_base_url
LOCAL_BASE_URL=http://localhostCreate a .env.docker file in the root directory and add the following variables for starting by docker-compose:
PORT=3001
MONGO_URI=mongodb://mongodb:27017/travel-expense-tracker
JWT_SECRET=change_to_the_jwt_secret
LOG_LEVEL=debug
NODE_ENV=production
RABBITMQ_URL=amqp://rabbitmq:5672
SENDER_EMAIL=change_to_sender_email
SENDER_EMAIL_PASSWORD=change_to_sender_email_password
PROD_BASE_URL=change_to_production_base_url
LOCAL_BASE_URL=http://localhostYou can run the project using Docker. Ensure Docker and Docker Compose are installed on your system.
docker-compose up --buildThis will start the server along with MongoDB and RabbitMQ as defined in the docker-compose.yml file.
This will start the server on the port specified in the .env.docker file (default is 3001).
Before start the server, Make sure MongoDB and RabbitMQ are running locally.
To start the service, run the following command in the project root directory:
npm startFor development purposes using Nodemon, run the following command:
npm run devThis will start the server on the port specified in the .env file (default is 3000).
Once the service is running, you can access it in your browser at:
http://localhost:3000For detailed API information, refer to the API Documentation.
For more information about the project, refer to the README.md file.
This INSTALL.md file provides a comprehensive guide for setting up and running your Travel Expense Tracker application, ensuring that users can easily follow the steps to get the application up and running.