Skip to content

The code base for Boxtribute 2.0, a humanitarian aid web application making it easy to source, store and distribute goods to people in need in a fair and dignified way

License

Notifications You must be signed in to change notification settings

kagaba/boxtribute

 
 

Repository files navigation

JWT Auth for open source projects

Frontend Test Coverage: codecov

Backend Test Coverage: codecov

Build: CircleCI

boxtribute

This is the repository for version 2 of the humanitarian relief web app Boxtribute. We support the distribution of over 1 million items each year and are deployed in over 15 locations across Europe and the Middle East (check our website for the most current list of partners).

Built by aid workers for aid workers, it is designed with three top priorities in mind:

  1. Quick deployment into crisis situations, including easy integration into z large range of relief operations, whether they're new or already up and running.
  2. Effective even with minimal training - doesn't require any professional expertise to use well. Can be run smoothly with short-term volunteers of all backgrounds.
  3. Dignity and choice-based distribution as a first priority for vulnerable individuals.

The web app consists of a React front-end bootstrapped with Create React App, and a Python Flask back-end.

Please check out Contribution Guidelines before you get started!

Table of Contents

  1. Contribution Guidelines
  2. Installation
    1. Basic steps
    2. Front-end
    3. Back-end
  3. About Docker
  4. Development Database Seed
  5. CircleCI
  6. Architecture overview
  7. Sponsors

Preparation for Installation

How do I get set up?

🌟 Only TWO commands required to get the full-stack app up and running 🌟

At the end of this section, there are links to further instructions to set up additional tools for your front-end and back-end environment.

  1. Environment variables are managed in a single file. Therefore copy example.env into .env

  2. To build and start the involved Docker services, execute

    docker-compose up
    
  3. Open your web browser on http://localhost:3000

NB: In case you get out-of-memory related errors, make sure your max memory is at least 4GB in your Docker settings (via Docker Settings UI -> Resources -> Memory) and try again. In (Linux) Docker there is no UI to set the memory limits globally. In that case, please specify the following in docker-compose.yml:

version: "2.4"
services:
    [...]
    react:
        mem_limit: 4G

Further Steps

About Docker

We are using Docker containers to make it easy for everyone to spin up an development environment which is the same everywhere. In docker-compose.yaml three Docker containers are specified - one for the MySQL database called db, one for the Flask back-end called webapp and one for the react front-end called react.

Development Database Seed

Boxtribute is an application for organisations who run distribution/warehouses in multiple bases. Therefore the development database seed holds at least two organisations and three bases:

  • Organisation BoxAid working on Lesvos and
  • Organisation BoxCare working on Samos and in Thessaloniki and Athens.

Each organisation has at least 3 user groups with different access levels in the app:

  • Head of Operations (Admin access)
  • Coordinator
  • Volunteer

In the development seed and Auth0 dev tenant we created the following login credentials with names telling their role and access to the various bases:

BoxAid (all have access to only one base: Lesvos):

BoxCare (there are 3 bases associated - Thessaloniki, Samos, Athens):

The password of all of these users is Browser_tests.

Furthermore, here a collection of QR-Codes which have been seeded in the dev db and can be used to test the box scanning and box creation.

Codes connected to existing boxes in the seed

Box in base 1

9627242265f5a7f3a1db910eb18410f

Box in base 2

1efb9f5633ebf01645934bd509d93e2

Box in base 3

46985d9e6d5a244cf683bacdb7d0f33

Codes not yet connected to boxes in the seed

0af9ec1a97906cf1cac5f50617a687b

Codes that don't exist in the seed

387b0f0f5e62cebcafd48383035a92a cba56d486db6d39209dbbf9e45353c4 a61e0efe25b75032b91106372674c26 f6f20e805192618def2cb400776a2aa 12ca607ce60c484bdbb703def950c5b d0e144a0a4dc0d8af55e2b686a2e97e 69107b2e2b4157b5efe10415bc0bba0 b8f0730d36571e4149ba3862379bb88 e1fdfdd942db0e764c9bea06c03ba2b 149ff66629377f6404b5c8d32936855 91c1def0b674d4e7cb92b61dbe00846 f660f96618eaa81e16b7869aca8d67d 98b51c8cd1a02e54ab47edcc5733139 168842e6389b520d4b1836562aa1f05 22324b7a180bdd31e125d5d50791d17

CircleCI

We are use CircleCI for automated testing of PRs and deployment to Google Cloud. To develop the CircleCI scripts you can run a CircleCI client locally. Please check out the documentation.

The most important commands are

circleci config validate
circleci local execute --job JOB_NAME

CircleCI development tips/learnings

  • You can only trigger a job locally if it is part of a CircleCI workflow.
  • Each run-step in the config of CircleCI should be treated as its own terminal. If you have for example activated an virtual environment in a run-step, this environment is not activated in the next run-step.

Deployment

About the versioning scheme:

  • major version is always 2
  • minor version is incremented if any database migration is part of the release
  • "bugfix" version is incremented otherwise
  1. Please commit (at least the last commit) using the command git commit -S -m "..." to make your commits verifiable. See this ticket for more info
  2. Create a new list in trello named "Boxtribute 2.0 || merged to production date (v2.X.Y)"
  3. Move the cards from the list "Boxtribute 2.0 || merged to staging" to the new list
  4. Checkout the production branch and update it to the latest version: git checkout production && git pull --tags origin production
  5. Merge master into production WITHOUT creating a merge commit (we want production to have the same history as master): git pull origin master
  6. Publish the changes to the remote repo: git push origin production
  7. Create a verifiable tag with the version number (check out the production branch after the merge, run git tag -s v2.X.Y and push the tag with git push --tags

Architecture overview

All our architecture decisions are logged in ADRs which you can find here. Here, is a list of intro tutorials for each technologies / frameworks / languages below.

Front-end

Interface

Back-end

Authentication

Testing

License

See the LICENSE file for license rights and limitations (Apache 2.0).

Sponsors

This project was funded 3x by the German Federal Ministry of Education and Research (BMBF) via the Prototype Fund. Read more here (German only):

BMBF logo

About

The code base for Boxtribute 2.0, a humanitarian aid web application making it easy to source, store and distribute goods to people in need in a fair and dignified way

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 63.8%
  • Python 34.8%
  • JavaScript 1.2%
  • Other 0.2%