Skip to content

kostandy/focus-loop-server-service

Repository files navigation

Focus Loop Server

Project Overview

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.

Technology Stack

  • Node.js
  • Express
  • TypeScript
  • MongoDB
  • Docker
  • Docker Compose

Setup

Prerequisites

Make sure you have the following installed on your machine:

Installation

  1. Clone the repository:

    git clone https://github.com/kostandy/focus-loop-server-service.git
    cd focus-loop-server
  2. Install dependencies:

    npm install

Environment Variables

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/

Running the Project

Development

To start the development server:

npm run dev

The server will start on http://localhost:3000.

Production

To build and start the server in production mode:

npm run build
npm start

Docker

To run the server using Docker:

  1. Build and start the Docker containers:

    docker compose up -d --build
  2. To stop the containers:

    docker compose down

FAQ

How do I change the server port?

You can change the server port by modifying the SERVER_PORT variable in the .env file.

How do I connect to a different MongoDB instance?

Update the MONGO_URI variable in the .env file with the connection string of your MongoDB instance.

How do I rebuild the Docker containers?

To rebuild the Docker containers without using the cache:

docker compose build --no-cache

How do I view the logs?

To view the logs of all services in real-time:

docker compose logs -f

How do I stop the Docker containers without removing them?

To stop the Docker containers without removing them:

docker compose stop

How do I run tests?

To run the tests, use the following command:

npm test

How do I update dependencies?

To update the dependencies, run:

npm update

How do I check for outdated dependencies?

To check for outdated dependencies, run:

npm outdated

How do I format the code?

To format the code, run:

npm run format

How do I lint the code?

To lint the code, run:

npm run lint

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any changes.

About

TBD

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published