Development
Ce contenu n’est pas encore disponible dans votre langue.
This tutorial describes the procedure to run Open Data Capture on your local system in development mode. For information on how to deploy Open Data Capture in production, please refer to our deployment guide.
System Prerequisites
This setup is designed for Unix-like operating systems and has been tested on MacOS and Linux. We do not support running Open Data Capture on Windows. For Windows users, we recommend using WSL.
Required Packages
First, make sure that homebrew is installed on your system. This will also ensure that the Xcode Command Line Tools are available. Then, install the following packages:
Please ensure that the following packages are installed:
Please ensure that the following packages are installed:
Git Setup
We use Git for version control and host our source code on GitHub. Please fork our repository and clone your fork:
Next, navigate to the root of the repository:
Configuration
All of the required configuration is stored in the file .env
, which can be generated from .env.template
using the following script:
System Dependencies
Now, in order to run the code, we need to install some additional system dependencies (i.e., a JavaScript runtime and database).
Node.js
We use Node Version Manager (nvm) to manage the supported Node version. Please follow the installation instructions to install nvm on your system. Then, install the current Node version with the following command:
Once installed, enable the pnpm
package manager:
MongoDB
Now, you need to setup a MongoDB instance. There are several ways you can do this. Please follow the guide for your prefered method:
First, make sure that Docker and Docker Compose are installed on your system (for installation instructions, please refer to the official documentation). Then, launch the MongoDB container:
Once the container is running, we need to create a replication set, as is required by Prisma. This can be done with the following command:
First, install MongoDB using Homebrew:
Then, open /opt/homebrew/etc/mongod.conf
and make the following changes:
Next, run MongoDB as a MacOS service:
Finally, initiate the replication set:
Runtime Dependencies
Next, install runtime dependencies:
Run Dev Server
Now, you should be able to start the development server, which is configured with hot module replacement.
Navigate to http://localhost:3000 and you should be greeted with a setup screen. Follow the instructions to create the first admin user and seed the database.