This tutorial will help you set up your local development environment to build your first DHIS2 app using the DHIS2 Application Platform, which provides a full-featured DHIS2 app, with out-of-the-box tools and components ready to be customized for your use case.
In this section we will:
- Install Node.js and Yarn
- Install the DHIS2 CLI
- Initialize a new DHIS2 app
You will need to have the following installed before proceeding:
- Install Node.js
Make sure that you are running a compatible version of Node as using older versions may throw some errors during setup.
- Install Yarn
We'll start by installing the DHIS2 CLI (Command Line Interface) globally.
@dhis2/cli package provides a set of tools that are useful when developing DHIS2 apps. It contains a number of modules that lets you quickly create and maintain DHIS2 applications. It also allows you to manage local DHIS2 instances by running simple commands.
@dhis2/cli globally run the following command using
Verify your installation and check all the commands that are available to you:
You’re now ready to start using
@dhis2/cli commands to create a new app! ✨
Now you are ready to use the
d2 CLI tool to create your first DHIS2 app.
d2 CLI provides a simple way of initializing a new app. We'll use the d2-app-scripts init command to do that.
From your terminal, navigate to the where you want to create your project and then run the following command:
We can now navigate into the newly created folder and start your application locally:
yarn start a web-browser window should have popped up greeting you with a login dialog at http://localhost:3000.
Enter your DHIS2 server URL and the username and password of the default admin user (as shown in the example below):
You will then see your newly initialized application greeting screen like this one 👇
Congratulations! You are now ready to start developing a DHIS2 application! 👏🏽