Focus Loop Server is the backend service for the Focus Loop application, a new generation task-tracking dApp. This service is responsible for handling API requests, managing the database, and providing the necessary backend logic for the application.
- Node.js
- Express
- TypeScript
- MongoDB
- Docker
- Docker Compose
Make sure you have the following installed on your machine:
- Node.js (v22 or higher)
- Docker
- Docker Compose
-
Clone the repository:
git clone https://github.com/kostandy/focus-loop-server-service.git cd focus-loop-server -
Install dependencies:
npm install
Create a .env file in the root directory and add the following environment variables:
NODE_ENV=development
SERVER_PORT=3000
MONGODB_INITDB_ROOT_USERNAME=your_mongo_username
MONGODB_INITDB_ROOT_PASSWORD=your_mongo_password
MONGO_URI=mongodb://${MONGODB_INITDB_ROOT_USERNAME}:${MONGODB_INITDB_ROOT_PASSWORD}@mongo/To start the development server:
npm run dev
The server will start on http://localhost:3000.
To build and start the server in production mode:
npm run build
npm startTo run the server using Docker:
-
Build and start the Docker containers:
docker compose up -d --build
-
To stop the containers:
docker compose down
You can change the server port by modifying the SERVER_PORT variable in the .env file.
Update the MONGO_URI variable in the .env file with the connection string of your MongoDB instance.
To rebuild the Docker containers without using the cache:
docker compose build --no-cacheTo view the logs of all services in real-time:
docker compose logs -fTo stop the Docker containers without removing them:
docker compose stopTo run the tests, use the following command:
npm testTo update the dependencies, run:
npm updateTo check for outdated dependencies, run:
npm outdatedTo format the code, run:
npm run formatTo lint the code, run:
npm run lintContributions are welcome! Please open an issue or submit a pull request for any changes.