Skip to content

Location microservice including country, state and city which automatically loads all data at the begining

License

Notifications You must be signed in to change notification settings

Matozap/Location-Microservice

Repository files navigation

Location Microservice

Build Issues Commits

A microservice that is responsible for handling requests for location information, such as country, state and city, and maintaining a database of location information which should not be updated by external systems.

Exposes an API in 3 flavors: Web API, GRPC* and Azure Functions and it allows other services or applications to query the location information. The API starts with the basic types of queries, such as:

  • GetAll
  • Get
  • Create
  • Update
  • Delete
  • Disable

It can be integrated with other services via message brokers, such as RabbitMQ or Azure Service Bus, to provide eventual consistency about a specific location.

Overall, this microservice provides a scalable and flexible solution for handling location information in a distributed system, allowing other services or applications to easily and reliably retrieve location information as needed.

* Using GRPC code-first approach


Architecture

  • Onion Architecture structure
  • CQRS architectural pattern

Design Patterns

  • Mediator
  • Dependency Injection
  • Options
  • Repository
  • Outbox
  • Pub/Sub

Development

  • Uses latest .Net version .Net 7
  • Uses Docker and Docker Compose to load all external components required
  • Uses controllers (Web API)
  • Uses Azure Functions (dotnet-isolated)
  • Message broker with Azure Service Bus, RabbitMQ or InMemory out of the box just changing the settings
  • Distributed Cache with Redis, Sql Server or InMemory out of the box with just changing the settings
  • Uses EF core
  • Uses Serilog
  • Uses Swagger
  • Uses Mapster for mapping DTOs
  • Uses BenchmarkDotNet for performance testing (removed)
  • Unit Tests using XUnit with NSubstitute, AutoFixture and fluentAssertions

Not included Features

  • JWT Authentication

Usage With Docker

docker compose up -d It will load the external components:

  • Databases (SQL server, MySql and Postgres),
  • Cache (Redis and SQL Server),
  • Message broker (RabbitMQ)
  • The application's Web API.

docker compose down -v to stop all containers and remove all their volumes

docker rmi location.service:1.0 to delete the application image from Docker

Usage Without Docker

Run or debug the application maintaining the appsettings.Development.json with all options using In-Memory or add the required types and connection strings to point to the desired external services.


Learning Material

Additional material: