# mnegah/grpcsampleproject architecture

> Architecture diagram of the GitHub repository mnegah/grpcsampleproject, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mnegah/grpcsampleproject
- Repository: https://github.com/mnegah/grpcsampleproject

## Overview

This repository implements a person-record CRUD service exposed over gRPC. A client sends one of the defined RPC requests; the registered gRPC handler maps it to application operations, which translate DTOs to domain entities and call the repository; the repository uses Entity Framework to persist or query person records. The graph reflects calls and storage wiring visible in the excerpts. The validator and protocol definitions are present, but their runtime validation use and protocol generation links are not established by the sampled code.

Main entry points: [`SimpleCrudWithGRPC/Program.cs`](https://github.com/mnegah/grpcsampleproject/blob/main/SimpleCrudWithGRPC/Program.cs) (Service host), [`SimpleCrudWithGRPC.Application/Services/PersonService.cs`](https://github.com/mnegah/grpcsampleproject/blob/main/SimpleCrudWithGRPC.Application/Services/PersonService.cs) (Person operations), [`SimpleCrudWithGRPC/Services/PersonGrpcService .cs`](https://github.com/mnegah/grpcsampleproject/blob/main/SimpleCrudWithGRPC/Services/PersonGrpcService%20.cs) (Person RPC handler), [`SimpleCrudWithGRPC.Infrastructure/Repositories/PersonRepository.cs`](https://github.com/mnegah/grpcsampleproject/blob/main/SimpleCrudWithGRPC.Infrastructure/Repositories/PersonRepository.cs) (Person repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["gRPC API"]
  node_host["Service host<br/>[Program.cs]"]
  node_rpc["Person RPC handler"]
  node_rpc_contract["RPC contract<br/>[personproto.proto]"]
end

subgraph group_app["Application"]
  node_person_service["Person operations<br/>[PersonService.cs]"]
  node_person_dto["Person DTO<br/>[PersonDto.cs]"]
end

subgraph group_domain["Person domain"]
  node_person["Person entity<br/>[Person.cs]"]
  node_repository_contract["Repository interface"]
end

subgraph group_infra["Persistence"]
  node_repository["Person repository"]
  node_dbcontext["EF context"]
  node_database[("Person database<br/>[PersonDB.mdf]")]
end

node_client(("gRPC client"))

node_client -->|"sends RPCs"| node_host
node_host -->|"maps service"| node_rpc
node_host -->|"configures context"| node_dbcontext
node_host -->|"registers service"| node_person_service
node_host -->|"registers repository"| node_repository
node_rpc -->|"calls operations"| node_person_service
node_rpc -->|"maps requests"| node_person_dto
node_person_service -->|"calls repository"| node_repository_contract
node_person_service -->|"maps entities"| node_person
node_person_service -->|"maps DTOs"| node_person_dto
node_repository -->|"queries and saves"| node_dbcontext
node_repository -->|"reads and writes"| node_person
node_dbcontext -->|"stores records"| node_database

click node_host "https://github.com/mnegah/grpcsampleproject/blob/main/SimpleCrudWithGRPC/Program.cs"
click node_rpc "https://github.com/mnegah/grpcsampleproject/blob/main/SimpleCrudWithGRPC/Services/PersonGrpcService%20.cs"
click node_rpc_contract "https://github.com/mnegah/grpcsampleproject/blob/main/SimpleCrudWithGRPC/Protos/personproto.proto"
click node_person_service "https://github.com/mnegah/grpcsampleproject/blob/main/SimpleCrudWithGRPC.Application/Services/PersonService.cs"
click node_person_dto "https://github.com/mnegah/grpcsampleproject/blob/main/SimpleCrudWithGRPC.Application/DTOs/PersonDto.cs"
click node_person "https://github.com/mnegah/grpcsampleproject/blob/main/SimpleCrudWithGRPC.Core/Entities/Person.cs"
click node_repository_contract "https://github.com/mnegah/grpcsampleproject/blob/main/SimpleCrudWithGRPC.Core/IRepositories/IPersonRepository.cs"
click node_repository "https://github.com/mnegah/grpcsampleproject/blob/main/SimpleCrudWithGRPC.Infrastructure/Repositories/PersonRepository.cs"
click node_dbcontext "https://github.com/mnegah/grpcsampleproject/blob/main/SimpleCrudWithGRPC.Infrastructure/Data/ApplicationDbContext.cs"
click node_database "https://github.com/mnegah/grpcsampleproject/blob/main/Database/PersonDB.mdf"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_host,node_rpc,node_rpc_contract,node_client toneBlue
class node_person_service,node_person_dto toneAmber
class node_person,node_repository_contract toneMint
class node_repository,node_dbcontext,node_database toneRose
```

## Components

### gRPC API

- [Service host](https://github.com/mnegah/grpcsampleproject/blob/main/SimpleCrudWithGRPC/Program.cs): `SimpleCrudWithGRPC/Program.cs`
- [Person RPC handler](https://github.com/mnegah/grpcsampleproject/blob/main/SimpleCrudWithGRPC/Services/PersonGrpcService%20.cs): `SimpleCrudWithGRPC/Services/PersonGrpcService .cs`
- [RPC contract](https://github.com/mnegah/grpcsampleproject/blob/main/SimpleCrudWithGRPC/Protos/personproto.proto): `SimpleCrudWithGRPC/Protos/personproto.proto`

### Application

- [Person operations](https://github.com/mnegah/grpcsampleproject/blob/main/SimpleCrudWithGRPC.Application/Services/PersonService.cs): `SimpleCrudWithGRPC.Application/Services/PersonService.cs`
- [Person DTO](https://github.com/mnegah/grpcsampleproject/blob/main/SimpleCrudWithGRPC.Application/DTOs/PersonDto.cs): `SimpleCrudWithGRPC.Application/DTOs/PersonDto.cs`

### Person domain

- [Person entity](https://github.com/mnegah/grpcsampleproject/blob/main/SimpleCrudWithGRPC.Core/Entities/Person.cs): `SimpleCrudWithGRPC.Core/Entities/Person.cs`
- [Repository interface](https://github.com/mnegah/grpcsampleproject/blob/main/SimpleCrudWithGRPC.Core/IRepositories/IPersonRepository.cs): `SimpleCrudWithGRPC.Core/IRepositories/IPersonRepository.cs`

### Persistence

- [Person repository](https://github.com/mnegah/grpcsampleproject/blob/main/SimpleCrudWithGRPC.Infrastructure/Repositories/PersonRepository.cs): `SimpleCrudWithGRPC.Infrastructure/Repositories/PersonRepository.cs`
- [EF context](https://github.com/mnegah/grpcsampleproject/blob/main/SimpleCrudWithGRPC.Infrastructure/Data/ApplicationDbContext.cs): `SimpleCrudWithGRPC.Infrastructure/Data/ApplicationDbContext.cs`
- [Person database](https://github.com/mnegah/grpcsampleproject/blob/main/Database/PersonDB.mdf): `Database/PersonDB.mdf`

### Other components

- **gRPC client**

## Connections

- gRPC client → Service host: sends RPCs
- Service host → Person RPC handler: maps service (evidence: `SimpleCrudWithGRPC/Program.cs`)
- Service host → EF context: configures context (evidence: `SimpleCrudWithGRPC/Program.cs`)
- Service host → Person operations: registers service (evidence: `SimpleCrudWithGRPC/Program.cs`)
- Service host → Person repository: registers repository (evidence: `SimpleCrudWithGRPC/Program.cs`)
- Person RPC handler → Person operations: calls operations (evidence: `SimpleCrudWithGRPC/Services/PersonGrpcService .cs`)
- Person RPC handler → Person DTO: maps requests (evidence: `SimpleCrudWithGRPC/Services/PersonGrpcService .cs`)
- Person operations → Repository interface: calls repository (evidence: `SimpleCrudWithGRPC.Application/Services/PersonService.cs`)
- Person operations → Person entity: maps entities (evidence: `SimpleCrudWithGRPC.Application/Services/PersonService.cs`)
- Person operations → Person DTO: maps DTOs (evidence: `SimpleCrudWithGRPC.Application/Services/PersonService.cs`)
- Person repository → EF context: queries and saves (evidence: `SimpleCrudWithGRPC.Infrastructure/Repositories/PersonRepository.cs`)
- Person repository → Person entity: reads and writes (evidence: `SimpleCrudWithGRPC.Infrastructure/Repositories/PersonRepository.cs`)
- EF context → Person database: stores records
