Giter Site home page Giter Site logo

athomecrisiscommunity's Introduction

AtHomeCrisisCommunity

AtHomeCrisisCommunity

Open Source project that builds mobile application that organize distribution of food and mental health for people affected by events that require strict quarantine at home. In many cases people are isolated and strugling to find help without phisical contact.

How this works

Volounteers distributing leaflets in communities that can be scanned using phone (google forms) to answer couple basic questions about their current situation and any personal or medical neeeds. The same leaflet can be used to gather posible volounteers. Form is dynamically processed using Data aqusition dechniques to match people that might need help, seeking someone to talk or need critical resources to survive.

AtHomeCrisisCommunity is an Mobile Application (PWA) that can be used by volounteers to collaborate work and connect with vulnerable people.

Technical details

Application includes:

  • Integration with Graphback (http://graphback.dev) that helps you to generate your backend and client side queries based on user provided business model

  • Example React application that uses Offix client (http://offix.dev) to give you fully featured offline experience.

  • Integration with Keycloak (SSO) for server and client Authentication and User management.

  • GraphQL Subscriptions backed by an MQTT broker (AMQ)

GraphQL Client

The mobile application uses Offix Client to provide additional offline capabilities on top of Apollo GraphQL.

GraphQL Server

The GraphQL server uses Graphback to provide GraphQL capabilities.

Getting Started

Requirements:

  • Docker and docker-compose

  • Node.js 12.x or above

  • (optional) access to a running OpenShift instance

Running app and server

Install dependencies

  1. Build client

    yarn
  2. Build client

    yarn
    yarn prepare:client
  3. Start the server

    cd ./server
    docker-compose up -d
    yarn start

    === Running the Server with the Keycloak integration

Follow these instructions to set up Keycloak for Authentication/Authorization.

  1. Start Keycloak Server

    cd server
    npm run keycloak
  2. Configure the Keycloak Server

    cd server
    npm run keycloak:init

This command creates the necessary resources in Keycloak and prints instructions you must follow to enable the integration.

Follow the instructions and copy the JSON configurations to the appropriate locations. The DataSync Starter app and server will read these configurations and the integration will be enabled when they are started.

By default, two users that can log into the application are created.

  • username: developer, password: developer

  • username: admin, password: admin

Using the GraphQL playground with Keycloak

The GraphQL playground is available after a Keycloak login screen. Initially the following error will be displayed.

{
  "error": "Failed to fetch schema. Please check your connection"
}

The playground must be configured to send the Keycloak Authorization header with requests to the GraphQL server.

In the bottom left corner of the playground there is a field called HTTP Headers which will be added to requests sent by the playground.

Use scripts/getToken.js to get a valid header for the developer user.

The following script can be used to get a token for the default Keycloak credentials

cd server/scripts/keycloak
node getToken.js

Alternatively, the user-defined username and password can be passed into the script as arguments, as below

node getToken.js <username> <password>

The output will be in the form of a JSON object

{"Authorization":"Bearer <token string>"}

Copy the entire JSON object, then paste it into the HTTP Headers field in the playground. The error message should disappear and it is now possible to use the playground.

Note
The GraphQL server is using a public Keycloak client to redirect browsers to the login page. This is useful for testing the server locally but it is not recommended for production. For production GraphQL server applications you should use a bearer client.
Note

If Keycloak integration is enabled on the server, and the Keycloak server is running using a self-signed certificate, please make sure set this environment variable before running the server:

export NODE_TLS_REJECT_UNAUTHORIZED=0

Running the Client

  1. Install Ionic

    npm install -g @ionic/cli
  2. Change directory

    cd client
  3. Install dependencies

    npm install
  4. Start the app

    npm run start

Adding keycloak integration to the client

Rename keycloak.example.json file in the public directory to keycloak.json. Replace the contents of the file with the keycloak json object generated during the keycloak integration init script.

{
  "realm": "<your realm>",
  "auth-server-url": "https://your-server/auth",
  "ssl-required": "none",
  "resource": "<your-client>",
  "public-client": true,
  "use-resource-role-mappings": true,
  "confidential-port": 0
}
Note
When running in cloud, developers can swap this file dynamically using config-map or openshift secret

Running Native projects

IOS

cd client
yarn cap add ios
yarn run:ios

Android:

cd client
yarn cap add android
yarn run:android

When running locally you will need to also enable http traffic. For example for android add android:usesCleartextTraffic="true" to AndroidManifest.xml

Project should stard in IDE and can be launched as any other native application

Using MQTT for GraphQL subscriptions

  1. Go to scripts ./mqtt

  2. Execute docker-compose up

  3. Set MQTT_HOST environment variable in .env file

MQTT_HOST=127.0.0.1

Running On OpenShift

Please check .openshift folder for more information.

athomecrisiscommunity's People

Contributors

aliok avatar ankitjena avatar austincunningham avatar b1zzu avatar danielpassos avatar darahayes avatar evanshortiss avatar jhellar avatar jstaffor avatar kingsleyzissou avatar milenazuccarelli avatar mmusil avatar psturc avatar pwright avatar renovate-bot avatar renovate[bot] avatar stephencoady avatar wojta avatar wtrocki avatar ziccardi avatar

Watchers

 avatar

Forkers

gmk-mt tayduivn

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.