How amrut-pol-mp/httpservice works
Project type and purpose
• This repository contains two cooperating .NET Core 8.0 services:
• GrpcService – a gRPC microservice project that implements full CRUD for Organization, User, and User-Organization Association domains.
• HttpService – an ASP.NET Core Web API that exposes those same CRUD operations over HTTP by acting as a gateway/adapter to the gRPC back end.
• The README confirms that HttpService “consumes the GrpcService” via generated gRPC clients and re-exposes endpoints for external HTTP clients.
File structure
• Top level:
• GrpcService (not shown in file tree but referenced by README)
• HttpService – contains Configuration, Controllers, Models, Protos, and Services directories.
• HttpService/Configuration holds startup wiring (GrpcClientRegistrationExtensions, GrpcErrorHandler).
• HttpService/Protos defines the same three service contracts.
• HttpService/Controllers maps HTTP routes to domain operations (OrganizationController, UserController, etc.).
• HttpService/Services holds per-domain adapters that encapsulate gRPC client calls behind IUserService, IOrganizationService, IUserOrganizationAssociationService interfaces.
• Models/Common define shared DTOs (Pagination, ResponseId).
• No direct database access here—all persistence is delegated to GrpcService.
Key insights from README
• GrpcService must be up for HttpService to work.
• HttpService acts purely as an HTTP-to-gRPC proxy/gateway.
• Technology stack: .NET Core 8.0, gRPC, ASP.NET Core Web API.
Main components and relationships
a. External client(s):
• Web/Mobile/UI or API consumer makes HTTP requests to HttpService.
b. HttpService (API Gateway):
• Controllers receive HTTP requests.
• Controllers call domain Services (OrganizationService, UserService, UserOrganizationAssociationService).
• Domain Services use injected gRPC clients (configured in Configuration/GrpcClientRegistrationExtensions) to send RPCs to GrpcService.
c. GrpcService (gRPC microservices):
• OrganizationService, UserService, UserOrganizationAssociationService gRPC servers process commands, perform CRUD, communicate with databases (not shown in this repo).
d. Data stores (one per service or shared)—the backing databases for Organization, User, and Association data.
e. Configuration & Cross-cutting:
• Error handling via GrpcErrorHandler.
• appsettings.json for endpoints and credentials.
Architectural patterns and design principles
• API Gateway pattern: HttpService fronts the gRPC back end.
• Adapter/Facade pattern: domain Services adapt gRPC clients to your own interfaces.
• Dependency Injection: Startup wiring in Program.cs and GrpcClientRegistrationExtensions.
• Separation of Concerns: Controllers (HTTP logic) vs. Services (business/gRPC logic) vs. Models (DTOs).