Add Code to Ushahidi

Technical Dependencies

You will need these on your development machine

  • git
  • PHP version 5.6 or greater
  • Node.js version 6 or greater

Workflow for Adding Code

Get a github account

Ushahidi code development is happening in Github.

First, create a github account.

Fork the repository

A fork is a copy of a repository. Forking a repository allows you to freely experiment with changes without affecting the original project.

The Ushahidi is built from 3 separate repositories. Depending on the task you'll need to fork one or more of these. Usually you'll need to fork at least the API and the Client repositories.

To fork a repository:

  1. Click the link above
  2. In the top-right corner of the page, click Fork.

Thats all! Now you have your very own fork of the original repository.

Clone your fork

If you hadn't yet cloned (and installed) the platform code, you can just go ahead an clone your fork:

git clone git@github.com:yourusername/platform.git

Add your fork as a remote

If you already cloned and installed the platform, you can add your new fork as a "remote" repository:

git remote rename origin upstream
git remote add origin git@github.com:yourusername/platform.git

When you clone a repository, the URL you clone is always created as the "origin" remote repository. The commands above rename the "origin" to "upstream", and create a new "origin" that points to your fork. This will allow you to pull in new versions of the platform, but push your own branches to your fork.

Find a feature to work on

The best way to pick a feature to work on is to say hi to Ushahidi’s developers, let them know what you’d like to work on (front end, back end, etc), and chat about what could be suitable for you.

Ushahidi issues (bugs, feature requests, etc) are in Github Issues. Find something that needs doing.

  • Community tasks in github are feature that are up for grabs by community devs.
  • Other tasks that we haven’t labeled yet may be suitable for work. Feel free to contact the team if you intend to work on something that grabs your attention.

Start a branch for your feature

If you’re working on a feature that nobody has claimed before, you will need to create a branch of Ushahidi that’s specific to this feature. To do this, cd (change directory) into your Ushahidi code in the terminal window, and type:

git checkout master
git pull
git checkout -b some-task

Where “some-task” is a short description without spaces of what this task is (e.g. “visualise-data”). Now you can start work on your code.

Write Code

Now write your code. Make sure you meet the Ushahidi coding standards and use the Ushahidi pattern library if you’re writing front-end code.

If you get stuck, or want to talk through ideas, you can contact other Ushahidi developers on the hipchat, IRC or Gitter.

Submit your code

When you’re ready to submit your code for approval, do this:

  1. Commit and push your code
    git add .
    git commit -m “message about this commit”
    git push origin some-task
    
  2. Then, open your fork on github, ie. https://www.github.com/yourusername/platform. You’ll see a banner indicating that you’ve recently pushed a new branch, and that you can submit this branch “upstream,” to the original repository:
  3. Click on "Compare and Pull Request" to create a pull request. Enter a title and description, then click "Create pull request"

The first time you submit code you may be asked to sign Ushahidi’s contributor agreement.

The Ushahidi admins will then review and comment on your code, and will either accept your code or ask you to make changes to it. If you are asked to make changes to your code, make those changes then resubmit your code using:

git add .
git commit -m “message about this commit”
git push origin some-task

If your code is accepted, then the admin will merge your pull request. Your code will then appear in the Ushahidi Platform github repository, with you credited for it.

Further Reading

Join the Community

Connect with the wider Ushahidi community: