Giter Club home page Giter Club logo

sunstain's Introduction

Sunstain

This solution starter was created as part of the IBM call for code.

Authors

  • Johnny Chalikiopoulos
  • Ioannis Katsoridas
  • Eirini Lygerou

Contents

  1. Overview
  2. The idea and how it works
  3. Diagrams
  4. Technology
  5. Getting started
  6. Resources
  7. License

Overview

What's the problem?

Our planet is dying. The main energy resources are being depleted and the global energy challenges are increasing, and this can only lead to catastrophic results. Today’s generation takes the natural elements for granted and does not regard for their sustainability and survival. This disrespect, though, will leave the planet in an uninhabitable state for future generations and force them into an apocalyptic scenario, despite them not being at fault. It is of vital importance, therefore, to take action now against this dystopian prediction and secure a bright and vivid next day. To achieve that, we need to protect our ecosystem and find ways with which to imprint this need to every person’s mind. This needs to be a holistic approach and we all need to collaborate for its success.

How can technology help?

This is the problem that Sunstain comes to solve. By understanding the current landscape and the importance of the depletion of natural resources, Sunstain provides an easy and accessible solution for everyone to use. It takes advantage of one of the few elements that can assist in producing energy without harming the environment at the same time, the sun. By harvesting solar energy, most of our everyday needs can be satisfied without requiring additional sources. Several households, though, produce more that they can consume, leaving them with both wasted energy and increased costs. By using Sunstain they are given the option to sell that extra energy to willing buyers and recycle it instead of throwing it away.

The idea and how it works

The whole process takes place inside the Sunstain mobile application. Users can either sell some the solar energy they produce to assist in sustaining the environment while making financial profit along the way or buy from existing buyers. This is achieved through a bidding contest where participants share the price they are willing to pay for a given service. The seller can then select the desired user. The settled agreement with the national energy providers ensures the smooth transition and billing of the service and the recipient will be able to take advantage of the solar energy purchased without other complications.

Diagrams

Cooperation architecture diagram

The solution is a mobile interface and a data storage to hold the energy products. In the client side we have a mobile application (both in IOS and Android) developed with React native and on the server side we have the utilized the IBM Cloud and IBM Cloudant.

  1. The user sign ups and can be a buyer or seller interchangably.
  2. The user can buy/search or sell energy products.
  3. The energy provider sends a confirmation via a notification when the purchase is processed.
  4. The user can view previws history and edit his own products availabe for sale.

Technology

IBM Cloud Services

Getting started

Prerequisites

Steps

  1. Provision a CouchDB instance using Cloudant.
  2. Run the server.
  3. Run the react native engine.
  4. Run the mobile application.

1: Provision a CouchDB instance using Cloudant

Log into the IBM Cloud and provision a CouchDB instance using Cloudant.

  1. From the catalog, select Databases and then the Cloudant panel.
  2. Once selected, you can choose your Cloudant plan -- there is a free tier for simple testing that is sufficient to run this CIR example. You should choose an appropriate region, give the service a name, and it is recommended you choose Use only IAM under Available authentication methods. You can leave the other settings with their defaults. Click the blue Create button when ready.
  3. Once your Cloudant instance has been created, you need to create a service credential that the CIR API Server can use to communicate with it. By selecting your running Cloudant instance, you can choose Service credentials from the left-hand menu. Create a new service credential and give it a name (it doesn't matter what you call it).
  4. Once created, you can display the credentials by selecting view service credentials, and then copy the credential, so you are ready to paste it into the code of the API server in Step 4.

2. Run the server

To set up and launch the server application:

  1. Go to the Sunstain/server directory of the cloned repo.
  2. Copy the .env.example file in the Sunstain/server directory, and create a new file named .env.
  3. Edit the name value in the manifest.yml file to your application name (for example, my-app-name).
  4. From a terminal:
    1. Go to the Sunstain/server directory of the cloned repo.
    2. Install the dependencies: npm install.
    3. Launch the server application locally or deploy to IBM Cloud:
      • To run locally:
        1. Start the application: npm start.
        2. The server can be accessed at http://localhost:3000.
      • To deploy to IBM Cloud (Optional):
        1. Log in to your IBM Cloud account using the IBM Cloud CLI: ibmcloud login.
        2. Target a Cloud Foundry org and space: ibmcloud target --cf.
        3. Push the app to IBM Cloud: ibmcloud app push.
        4. The server can be accessed at a URL using the name given in the manifest.yml file (for example, https://my-app-name.bluemix.net).

3. Run the react native engine

To run the react-native engine

  1. Go to the Sunstain directory of the cloned repo.
  2. Open a cmd and run npx react-native start

4. Run the mobile application

To run the mobile application (using the Xcode iOS Simulator or Android Studio Emulator):

  1. Go to the Sunstain directory of the cloned repo.

  2. Copy the .env.example file in the Sunstain directory, and create a file named .env.

  3. Edit the newly created .env file:

    • Update the SUNSTAIN_SERVER_URL with the URL to the server app launched in the previous step.

      Note: If you are running the server locally and testing with the Android Emulator set the SUNSTAIN_SERVER_URL using the local machine's URL (e.g., http://10.0.2.2:3000) instead of localhost

  4. From a terminal:

    1. Go to the Sunstain directory.
    2. Install the dependencies: yarn install.
    3. iOS only: Go to the ios directory: cd ios.
    4. iOS only: Install pod dependencies: pod install.
    5. iOS only: Return to the mobile-app directory: cd ../.
    6. Launch the app in the simulator/emulator:
      • iOS only: npm run ios

        Note: You should be running at least iOS 13.0. The first time you launch the simulator, you should ensure that you set a Location in the Features menu.

      • Android only: npx react-native run-android

        Note: Your Android Studio needs to have the Android 9 (Pie) SDK and a Pie API Level 28 virtual device

      • Alternative way to run on Android: react-native run-android
        1. Android only: Open Android Studio and setup the project with the android folder.
        2. Android only: Open Android Virtual Device Manager and launch the virtual device installed.
        3. Android only: Click on Debug in Android Studio.

With the application running in the simulator/emulator, you should be able to navigate through the various screens:

Login Screen

Sign in Screen

Welcome Screen

Buy/Search Screen

Buy Notification Screen

Resources

License

This solution is made available under the GNU General Public License v3.0.

sunstain's People

Contributors

irinil avatar

Watchers

 avatar

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.