Skip to content

Nairda015/IGroceryStore

Repository files navigation

IGroceryStore

.NET

Loosely coupled monolith app where users will track personal basket price.

Projects Structure:

IGroceryStore-Diagram

Main features:

  • Watching product prices over time
  • Comparing basket price across stores
  • Searching for allergens free products
  • Rating products and stores
  • Searching for similar products

Modules:

  • Event Store for storing historical data about products prices and promotions
  • MongoDb for storing projections and users baskets
  • Create Basket
  • Consumers for product creation events and price changes events
  • Auth with JWT
  • Refresh tokens handling (in future I'll move storing tokens to Redis or integrate project with OpenId)
  • BCrypt for hashing passwords
  • Postgres for storing users (I'm considering changing it to noSql - mongoDb, casandra or dynamodb)
  • Register
  • Login
  • Refresh Token
  • GetAll/GetUser
  • Storing shops location and current price of product
  • calculating best basket price in shops near me (coming soon)
  • Report new product price
  • Postgres for relational data
  • Module publishes events for other modules about new products
  • I'm considering using apache lucene to enable searching for similar products
  • Create Product
  • Mark Product As Obsolete
  • Add Allergens To Product
  • CRUD for Categories
  • CRUD for Allergens

Stack

.Net7.0 C#11 with Minimal API
Docker - containerization for tests aln local development
Terraform - for infrastructure as code (IaC)
Event Store - storing historical data of products prices
MongoDb - storing projections from historical data
DynamoDb - storing data from shop module
AWS Systems Manager - runtime configuration
JWT.Net - authorisation and authentication
BCrypt.net - password hashing
GitHubAction - CI/CD
RabbitMQ - asynchronous messaging
MassTransit - asynchronous messaging library
PostgreSQL - database with json support
Entity Framework Core - ORM used for product module
OpenTelemetry - Traces, Metrics
Jaeger - Exporter/UI for OpenTelemetry
image

For Contributors

Git Branching Strategy

I'm using Feature Branch Workflow for simplicity and
I encourage you to use it also in your fork.
You can read more about flow here

Requirements

  • docker
  • terraform (optional)
  • aws account (optional)

How to run

  • From the tools/docker directory run the command:
    docker compose --profiles webapi,jaeger up -d (look at profiles section)
  • if you want to run shop module you can create all required resources with terraform from tools/terraform/dev directory
    terraform init
    terraform apply
  • Run ASP and/or Worker Project (add compound configuration in Rider) img
  • API endpoints: localhost:5000/swagger
  • All ports for infrastructure available in docker-compose file
  • To connect to pgadmin from docker use:
    docker run -p 5050:80 -e "[email protected]" -e "PGADMIN_DEFAULT_PASSWORD=admin" -d dpage/pgadmin4

docker compose profiles (optional):

  • all - all containers
  • webapi - all except observability
  • shops - dynamodb
  • users - postgres
  • baskets - eventstore, mongodb
  • products - postgres
  • logs - elasticsearch, kibana
  • kibana
  • jaeger
  • elastic

rabbitmq and redis will run by default