Skip to Main Content

You can setup BioDrop code base using Local or with Docker environment.

Local Development

If you're not comfortable using Docker, don't worry! We have an alternative method for you to set up the BioDrop codebase locally. By following the steps outlined below, you'll have a local codebase ready for development. While a complete local setup offers the most customization for your development environment, it requires more setup time. So, let's get started!

Prerequisites

Before contributing or adding a new feature, please make sure you have already installed the following tools:

  • NodeJs (Works with Node LTS version v18.16.1)
  • MongoDB
  • Optional NVM: Switch Node version by using nvm use (on Windows, use nvm use v18.16.1). If this is not installed, run nvm install v18.16.1.

Steps to implement local environment

You can set this up locally with the following steps.

  1. make sure Mongo is running
  2. install npm dependencies with npm ci
  3. a new file will be created .env (update the environment variables for GitHub OAuth if you want to login)
  4. start the app with npm run dev and visit in the browser http://localhost:3000

Any changes you make will automatically be reloaded in the browser.


Docker Compose

This might sound scary but it is actually the easiest solution for a local development environment. The environment will allow you to run the application locally with Docker Compose. Everything will run in containers (e.g.,MongoDB), so you don't need to install anything on your machine.

Prerequisites

You will need Docker and Docker Compose v2 installed.

Setup

  1. Make sure you have cloned the repository and are in the root of the project.
  2. Ensure that the Docker daemon is running, which is required to execute Docker commands. To do this, launch your Docker Desktop application; this will start the daemon automatically in the background. For users who have installed Docker through the CLI, please refer to the official Docker documentation for instructions on starting the Docker daemon based on your operating system.
  3. Execute the following command, this will build the images and start the containers.
docker compose up
  1. You can now access the application at http://localhost:3000.
  2. If you make any changes to the dependencies, it's recommended to rebuild the images with the following command.
docker compose up --build
  1. If you want to stop the containers, you can use the following command:
docker compose down

Troubleshooting

If you are getting an error, try to rebuild the images with docker compose up --build. If that doesn't work, stop the containers with docker compose down and remove the stopped BioDrop container with docker rm biodrop. Then, remove the images with docker rmi biodrop-app. Lastly, rebuild the images with docker compose up --build.

Running mongo container separately

If you want to have more flexibility you have a choice to run mongo separate, and start nextjs application locally:

  1. npm install

  2. Modify.env file BIODROP_MONGO_CONNECTION_STRING value with mongodb://localhost:27017/biodrop

  3. docker run --name my_mongodb_instance -p 27017:27017 -d mongo

  4. npm run dev

  5. In the browser localhost:3000/api/system/reload?secret=development