Giter Club home page Giter Club logo

tracker-beer-app's Introduction

tracker-beer-app template

This is a template of a project using Tracker to build a simple platform where microbreweries can create their beer bottles and track the bottles to encourage customers to return their empty bottles after consumption. Buying new bottles is a marginal expense for microbreweries and putting in place a membership program where both the owner and the customers are winning is an interesting solution.

With that implementation, customers would rent their bottles and return them. That way, customers would only pay for the beer and brewers wouldn't need to buy new glass bottles as often.

Before you start

You might find it easier to implement this project after reading our documentation.

Functionalities

  • Create Beer bottles with detailed specifications
  • Use NFC tags to Create, Sell and Return bottles
  • Sell beer bottles to customers and track which customer owns which bottle
  • Accept bottle returns to deduct them from a customer's bottle wallet
  • View customer wallets to see which bottle they own at any time
  • Adjust a customer's membership to increase or reduce their bottle renting limit
  • Handle multiple users
  • User creation procedure
  • User identification with NFC tags

Prerequisites

Backend

You will need the update the following values in services/settingsService.js to run the backend project:

settings = {
    // The Mantle API you are using
    mantleApiUrl: 'http://api.mantleblockchain.com',
    // The URL of the front end 
    webAppUrl: 'http://localhost:8100',
    // The product Id of your Mantle Tracker instance
    trackerProductId: 'YOUR-TRACKER-PRODUCT-ID',
    // The email of the user in Mantle that acts as the owner
    ownerEmail: 'EMAIL-OF-THE-BREWERY-OWNER',
    // The API Key of the user that acts as the owner in Mantle
    ownerApiKey: 'OWNER-API-KEY',
    // The email of the user in Mantle that acts as a customer
    customerEmail: 'EMAIL-OF-ONE-OF-THE-CUSTOMERS',
    // The API Key of the user that acts as a customer in Mantle
    customerApiKey: 'CUSTOMER-API-KEY',
    // The Id of the asset in your Tracker instance that will act as the limit of bottles a customer can own
    membershipCoinId: 'ID-OF-THE-MEMBERSHIP-COIN-IN-TRACKER',
    // Serial Port where your NFC reader will publish new NFC tags
    nfcReaderSerialPort: "COM3",
    // Baud rate of your NFC reader's serial port
    nfcReaderBaudRate: 115200
}

Frontend

You will need the update the following values in src/providers/providers-settings.js to run the front end project:

{
    // The URL of the node backend
    public backendUrl: string = 'http://localhost:3000';
    // The email of the user in Mantle that acts as a customer
    public customerEmail: string = 'EMAIL-OF-ONE-OF-THE-CUSTOMERS';
}

Getting started

Install dependencies:

After the installations, run the following commands in your terminal at both the roots of the frontend and backend directory: npm install

Run the application:

Frontend:
  1. Go in the frontend directory
  2. Run the following command: ionic serve
Backend:
  1. Go in the backend directory
  2. Run the following command: npm start

Mantle API calls

In this section, we will explain how we used Tracker in our application.

BOTTLE CREATION

Create new bottle specifications POST /tracker/{product-id}/assets

Create one multi-asset per scanned bottle POST /tracker/{product-id}/multiassets

PRE-SALE VALIDATION

Find bottle ownership & membership limit GET /tracker/{product-id}/balances

Find existing bottles in the system GET /tracker/{product-id}/multiassets

BOTTLE SALES

Find existing bottles GET /tracker/{product-id}/multiassets

Issue one multi-asset for all scanned bottles POST /tracker/{product-id}/multiassets/issue/bulk

MEMBERSHIP ADJUSTMENT

Issue an amount of membership coin POST /tracker/{product-id}/assets/{asset-id}/issue

OR

Transfer an amount of membership coin POST /tracker/{product-id}/assets/{asset-id}/transfer

PRE-RETURN VALIDATION

Find bottle ownership & membership limit GET /tracker/{product-id}/balances

Find existing bottles & match with bottle ownership GET /tracker/{product-id}/multiassets

BOTTLE RETURNS

Find bottle ownership & membership limit GET /tracker/{product-id}/balances

Transfer one multi-asset for all scanned bottles POST /tracker/{product-id}/assets/transfer/bulk

More docs

tracker-beer-app's People

Contributors

lacoursieresimon avatar xshadow21 avatar

Watchers

James Cloos avatar  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.