Skip to content

Latest commit

 

History

History
160 lines (117 loc) · 11.6 KB

README.md

File metadata and controls

160 lines (117 loc) · 11.6 KB

My Pantry

version: 0.10.0

  • pantry-web: v.0.8.16
  • account-service: v0.4.11
  • pantry-service: v0.6.11
  • purchase-service: v0.4.8

In this version:

  • pantry-web:

    • Big refactoring replacing the use of React Context by React-Query as a global state manager
    • Use of react-query cache to improve the dashbord graph generation, fetching fresh data only when it's stale.
    • Totally refactoring of App.js, removing context dependencies and isolating routes to avoid unnecessary re-rendering.
    • Use of Link component from react-router-dom to correctly navigate among pages, avoiding complete re-render on transitions.
    • Apply theme based on the user logging in. It's no more based on the last theme saved on the browser LocalStorage.
  • account-service:

    • Remember Me Logic. When it's active, JWT and AUTH Cookie are valid for 30 days, otherwise it's valid for only 24 hours.

In next versions:

  • Delete provisioned products from the shopping list (on Shopping List page)

  • CRUD for Role and Permissions

Description:

My Pantry manages your pantries and creates shopping lists for you. Its core logic mechanism is the product consumption.

Simply tell My Pantry that you opened a new package of pasta. The app will analyse the ideal and current quantities in your pantry, and in case the current quantity is below 50%, it will add Pasta to the Shopping List.

RBAC is managed by account-service and uses Redis as a cache support.You can also share your Pantries, Shopping Lists and Products with other users, by adding them to your Account Group.

The Authentication is possible by either Google Sign-in (Google IDToken - configure it as localhost callback) or by the traditional user/password. A JWT is generated and stored as a http-only cookie.

The frontend is developed in Reactjs and Javascript.

Backend is written in Java 17, based on Spring Boot and Spring Security. It uses Postgres as database, Redis as cache for RBAC and Kafka as prov/sub for asynch communication between pantry-service and purchase-service.

How to run it locally:

Pre-steps:

  1. Install Docker and Maven
  2. Generate SECURITY_SECRET by running command: openssl rand -hex 64
  3. If you want to use Google Sign-in, then get a new Google Credentials for your MyPantry app:
    1. Log in at https://console.developers.google.com/apis
    2. Create a new project (MyPantry)
    3. Follow the instructions to configure it: https://developers.google.com/identity/gsi/web/guides/get-google-api-clientid

Steps:

  1. Download the source code
  2. Configure the environment variables in the docker-compose.yml:
  3. Navigate to my-pantry folder
  4. Run: mvn clean install
  5. Run: docker-compose up -d

Screenshots:

Themes:

Mono Light (default) Mono Dark Lila Light Lila Dark

pantry-web (localhost:3000) :

Path Description
Home Page When user is not logged in, show Login page link;
When no Pantry exists yet, suggests creation of first Pantry using the Pantry Wizard;
When at least one Pantry exists, show Pantry Dashboad.
Consume from Pantry

Select the pantries, you want to list and consume items.

Find the item using the search mechanism, and comsume the amount.

Once the consumption of an item is above 50%, an event to purchase more of that item is fired. You should be able to see the in tem in the Shopping List page.
Shopping List

Select the pantries, you want to list your Shopping Lists.Lists items to be purchased.

Open a New Order and choose the Supermarket you plan to go shopping. The items in your Shopping List will be sorted by the section categories order of the supermarket chosen. Making it easier to go shopping.

When you're done, click on Checkout, and it will update your Pantries with the purchased items.
Pantry Register

This is the Pantry register. It lists your pantries and its basic actions for pantries and pantry items: new, edit and delete.

Here you can add or remove items to your pantry, change the ideal quantity or fix the current quantity of an item.

Don't forget to click Analyse Pantry, so My Pantry can fix the current Shopping Lists, adding or removing items from it.
Product Register

This is the Product register. It lists your products and its basic actions: new, edit and delete.

If you plan to share products among different Account Groups (child groups), so keep the product in the highst Account Group (the parent group)
Supermarket Register

This is the Supermarket register. It lists your supermarkets and its basic actions: new, edit and delete.

Here you can inform the sections order of the Supermarket, and use it when going shopping.

account-service (localhost:8082) :

  • Manages Accounts, Account Groups and Account Group Members
  • Manages Roles and Permissions
  • Acts as Authentication server:
    • validating the Google IDToken or the user/password informed
    • issuing an JWT Token embedded in a Http Only Cookie
  • Acts as Authorization server:
    • verify and retrieves permissions e/or objects associated to the user in a group

pantry-service (localhost:8080) :

  • Manages pantry, pantry items and products.
  • Manages the consumption of the items in the pantry as well as their replenishment
  • Sends events to purchase-service through a Kafka Topic (PurchaseCreateTopic) when PantryItem reaches the defined threshold (50%)
  • Listens to Kafka Topic (PurchaseCompleteTopic) in order to update the Pantry Inventory once the Purchase Order is closed
  • Stores data in Postgres

purchase-service (localhost:8081) :

  • Manages shopping lists
  • Listens to Kafka Topic (PurchaseCreateTopic) to manage a list of items to be purchased
  • Once the purchase is closed, an event is sent back to pantry-service through a Kafka Topic (PurchaseCompleteTopic)
  • Stores data in Postgres

Major Changelog

Credits

Icons