Skip to content

FernandaCastro/my-pantry

Repository files navigation

Myโ€‘Pantry ๐Ÿงบ

Home inventory and shopping list management built with a modern microservices architecture


๐Ÿš€ Overview

Myโ€‘Pantry is a full-stack web application developed as a personal project for managing pantry inventory and shopping lists. It showcases best practices using modern technologies such as microservices, JWT authentication, event-driven architecture, and Google API integration.


๐Ÿ”ง Tech Stack

  • Backend: Java, Spring Boot, Spring Security (JWT), Apache Kafka, Redis Cache
  • Frontend: ReactJS with React Query and i18n
  • Database: PostgreSQL
  • DevOps: Docker, GitHub Actions (CI/CD)
  • Integrations: Google API Client, Redis, Kafka

๐Ÿง  Features

  • User registration and login with Google Sign-in or traditional user/password
  • ๐ŸŒ Multi-language support (currently English and Portuguese)
  • Pantry inventory management
  • Shopping list creation and editing
  • Fast, reactive UI with React Query
  • Real-time updates via Kafka
  • Redis caching for optimized performance
  • RBAC and ability to share Pantries, Shopping Lists and Products among users.

๐Ÿ—‚๏ธ Project Structure

  • pantry-web (frontend): responsive UI using React Query and custom styles or Bootstrap
  • account-service: REST endpoints for authentication, authorization, RBAC and account-related api
  • pantry-service: REST endpoints for Pantry-related api
  • purchase-service: REST endpoints for Purchase-related api
  • commons, kafka, security and security-core: configurations and dependencies

๐Ÿ—๏ธ Architecture Overview

The system follows a microservices architecture, with communication via Kafka and JWT-secured REST APIs. Below is the architectural diagram:

  • Microservices with Spring Boot and Spring Security
  • Kafka events for decoupled, event-driven processing
  • JWT as http-only cookie for authentication
  • Redis for caching
  • RBAC

Microservice Port Description
account-service 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 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 isclosed
Stores data in Postgres
purchase-service 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

โš™๏ธ Running Locally

Prerequisites

Steps

git clone https://github.com/FernandaCastro/my-pantry.git
cd my-pantry
mvn clean install
docker compose up --build

Once up and running:


๐Ÿงช Testing & CI/CD

GitHub Actions for CI/CD: build, test, deploy

Unit and integration testing: JUnit & Mockito (backend)


๐Ÿ–ผ๏ธ User Interface

๐ŸŽฏ UI Icons & Actions

Hereโ€™s a quick guide to the main icons used in the UI:

Icon Description
Home Page Home 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.

๐Ÿ“ธ Screenshots

Hereโ€™s how the main interface looks, with icons for:

๐ŸŽจ Themes

Mono Light (default) Mono Dark Lila Light Lila Dark

๐Ÿ›ฃ๏ธ Roadmap

version: 0.11.0

  • pantry-web: v.0.10.0
  • account-service: v0.5.0
  • pantry-service: v0.7.0
  • purchase-service: v0.5.0

In this version:

  • pantry-web:

    • Add alert to inform the use of essencial cookie
    • Remove unused libraries
    • Add "Delete Account" to the slide menu
    • Add "View items" to Account Group in Group Members page
  • purchase-service:

    • Delete Account data
  • lib-dependencies:

    • refactoring

In next versions:

  • Delete provisioned products from the shopping list (on Shopping List page)
  • CRUD for Role and Permissions

Major Changelog


๐Ÿ“Œ About This Project

This project demonstrates modern backend/frontend development using:

  • Microservices and event-driven architecture

  • Secure backend with Spring Security + JWT in Http only cookie

  • Modern frontend with React and state management via React Query

  • Containerized architecture with Docker for reproducibility

  • Integration of third-party services (Google API, Kafka, Redis)


๐Ÿค Contributions & Contact

Contributions are welcome! Feel free to open an Issue or Pull Request. Contact: @FernandaCastro on GitHub


๐Ÿ“œ License

This project is licensed under the MIT License.


Credits

Icons