Skip to content

Investment Consulting Platform for Investors and Expert Consultants Matching (Doji), Software Engineering II product.

Notifications You must be signed in to change notification settings

2110336-SoftwareEngineering2-2021-2/sec2_ChocoTech

Repository files navigation

Choco Tech

This project was generated using Nx.

This project base on Doji requirement that we have learned in SE II.

🔎 Smart, Fast and Extensible Build System

Table of Contents

Preparing for development

  1. First, you need to clone the project using git. Following the command.

    git clone https://github.com/2110336-SoftwareEngineering2-2021-2/sec2_ChocoTech.git
  2. Then, you have to install all dependencies.

    yarn install
    # or  (same result)
    yarn

    If you don't have yarn. Please install here

  3. Setup environment variables

    cp .env .env.local

    Don't forget to fill OMISE_PUBLIC_KEY, OMISE_SECRET_KEY , MAILGUN_API_KEY and MAILGUN_DOMAIN in .env.local

  4. This project requires Node.js version 16. To check your node version. Try

    node -v
  5. Try to start your dev server! In this Nx workspace we have 2 main apps; Next.js for Frontend and Nest.js for Backend. In addition, we have Storybook for UI docs

    But first of all, you have to run Postgres and Redis before development. Following the commands.

     # create external network, called private
     docker create network private
    # run Postgres and Redis
    docker-compose up -d
    # or (same result)
    docker compose up -d

    Follow the command to start dev server for all apps. The Frontend app will run on http://localhost:3000 and the Backend app will run on http://localhost:3333

    yarn dev

    Follow the command to start dev server for only Frontend apps. The Frontend app will run on http://localhost:3000

    yarn dev:frontend

    Follow the command to start dev server for only Backend apps. The Backend app will run on http://localhost:3333

    yarn dev:backend

    Follow the command to start Storybook. The Backend app will run on http://localhost:4400

    yarn mui:storybook

Testing before deploy

The project will deploy using Dockerfile.

If you try to test developed production app in your local machine. Try to build Docker image by follwing the command

docker build -t choco-app .

This command means Docker will search for Dockerfile and use it as building step. Then, Docker will create an image named choco-app. It'll take 5-10 mins on your first build.

Then, try to start Docker container using the image by follwing the command.

docker run -p 8080:80 -it --env-file .env.compose  --network private --name choco-app choco-app

This command means Docker will run choco-app image and named the container as choco-app. It'll take .env.compose as environment variables for Backend and it'll run on port 8080 (e.g. http://localhost:8080). The network argument private is required for accesing Postgres and Redis (External network that you have created before).

To make sure the container is running. Try

docker ps

To kill the container. Try

docker container kill choco-app

The Frontend app, Backend app, Storyobook and Swagger will be combined into 1 image. The path rule will be defined in nginx.conf

Deployment

This project is deployed using Railway, cloud service. To deploy the app. You just have to push commits to

  • main branch for production.
  • dev branch for development.

Each deployment take about 5-10 mins.

Production

Development

About

Investment Consulting Platform for Investors and Expert Consultants Matching (Doji), Software Engineering II product.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages