Skip to content

Wallet Transaction API created using NextJs & NestJs, GraphQL & MongoDb

Notifications You must be signed in to change notification settings

TechGeekD/wallet_monorepo

Repository files navigation

Project Hosted At Link

User Docker Compose To Run Project

This Docker Compose file contains the configuration for running a multi-container application consisting of a frontend, a backend, and a database.

Prerequisites

Before running the application, make sure that you have installed Docker and Docker Compose on your machine.

Usage

To start the application, navigate to the directory containing the docker-compose.yml file and run the following command:

docker compose -p wallet up frontend --build -d

This will build the necessary Docker images and start the containers. The application will be accessible at http://localhost:80.

Configuration

The docker-compose.yml file defines the following services:

frontend

This service runs the frontend of the application. It is built from a Dockerfile located in the current directory (.) and named Dockerfile.frontend. The built image is named wallet_frontend.

The service exposes port 80 to the host machine and maps it to the ${FRONTEND_PORT} environment variable. It also exposes port 9229 for debugging purposes.

The service depends on the backend service.

backend

This service runs the backend of the application. It is built from a Dockerfile located in the current directory (.) and named Dockerfile.backend. The built image is named wallet_backend.

The service exposes port ${BACKEND_PORT} to the host machine and maps it to the ${BACKEND_PORT} environment variable. It also exposes port 9228 for debugging purposes.

The service runs the yarn start:prod command.

The service depends on the database service.

database

This service runs the database for the application. It is built from the same Dockerfile as the backend service, but it is targeted at the database stage.

The service exposes port 27018 to the host machine and maps it to the ${DATABASE_PORT} environment variable.

Environment variables

The application uses environment variables to configure various settings. These variables are read from the .env file in the current directory.

The following variables are used:

  • NODE_ENV: Runtime environment for NodeJs.
  • NEXT_PUBLIC_API_URL: Backend API url location.
  • NEXT_PUBLIC_FRONTEND_URL: NextJs API url location.
  • MONGODB_URI: MongoDB connection string.
  • FRONTEND_HOSTNAME: Url that frontend is hosted at.
  • BACKEND_HOSTNAME: Url that backend is hosted at.
  • FRONTEND_PORT: The port that the frontend service should listen on.
  • BACKEND_PORT: The port that the backend service should listen on.
  • DATABASE_PORT: The port that the database service should listen on.

Networks

The application uses a single network named webnet. This network is created automatically by Docker Compose and is used to connect the services together.