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, usenvm use v18.16.1
). If this is not installed, runnvm install v18.16.1
.
Steps to implement local environment
You can set this up locally with the following steps.
- make sure Mongo is running
- install npm dependencies with
npm ci
- a new file will be created
.env
(update the environment variables for GitHub OAuth if you want to login) - start the app with
npm run dev
and visit in the browserhttp://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
- Make sure you have cloned the repository and are in the root of the project.
- Execute the following command, this will build the images and start the containers.
docker compose up
- You can now access the application at
http://localhost:3000
. - If you make any changes to the dependencies, it's recommended to rebuild the images with the following command.
docker compose up --build
- 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:
-
npm install
-
Modify.env file
BIODROP_MONGO_CONNECTION_STRING
value withmongodb://localhost:27017/biodrop
-
docker run --name my_mongodb_instance -p 27017:27017 -d mongo
-
npm run dev
-
In the browser
localhost:3000/api/system/reload?secret=development