# westamz/microservices architecture

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

- Interactive diagram: https://gitdiagram.com/westamz/microservices
- Repository: https://github.com/westamz/microservices

## Overview

Carsties is a vehicle-auction application organized around an authoritative auction service and an asynchronously maintained search read model. A browser client authenticates through IdentityService, sends requests through the gateway, and searches listings or performs auction operations. Auction lifecycle events flow through RabbitMQ to SearchService consumers; startup synchronization can also fetch auction updates directly. The README documents the overall service topology and frontend capabilities; several implementation details, including gateway routes and frontend request wiring, were not sampled, so those relationships rely on README evidence.

Main entry points: [`src/GatewayService/Program.cs`](https://github.com/westamz/microservices/blob/main/src/GatewayService/Program.cs) (HTTP gateway), [`src/AuctionService/Controllers/AuctionController.cs`](https://github.com/westamz/microservices/blob/main/src/AuctionService/Controllers/AuctionController.cs) (Auction API), [`src/IdentityService/Program.cs`](https://github.com/westamz/microservices/blob/main/src/IdentityService/Program.cs) (Identity and tokens), [`frontend/web-app/app/page.tsx`](https://github.com/westamz/microservices/blob/main/frontend/web-app/app/page.tsx) (Next.js client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_web["Next.js client<br/>[page.tsx]"]
  node_listing["Listings and filters<br/>[Listings.tsx]"]
  node_listing_state["Listing parameters"]
  node_auction_actions["Auction actions<br/>[auctionActions.tsx]"]
  node_session["Session dashboard<br/>[page.tsx]"]
  node_nextauth["NextAuth integration<br/>[auth.ts]"]
end

subgraph group_edge["Gateway and identity"]
  node_gateway["HTTP gateway<br/>[Program.cs]"]
  node_identity["Identity and tokens<br/>[Program.cs]"]
  node_profile["Token profile claims"]
  node_identity_store[("Identity database")]
end

subgraph group_auction["Auction domain"]
  node_auction_api["Auction API"]
  node_auction_store[("Auction database")]
  node_auction_events["Auction event contracts<br/>[AuctionCreated.cs]"]
  node_auction_consumers["Auction event consumers"]
end

subgraph group_search["Search read model"]
  node_search_api["Search API"]
  node_search_store[("MongoDB search model<br/>[Item.cs]")]
  node_search_consumers["Search event consumers"]
  node_sync_client["Auction sync client"]
  node_search_init["Read-model initialization<br/>[DbInitializer.cs]"]
end

node_browser(("Browser user"))
node_broker["RabbitMQ"]

node_browser -->|"uses"| node_web
node_web -->|"renders"| node_listing
node_listing -.->|"stores filters"| node_listing_state
node_listing -->|"requests search"| node_gateway
node_auction_actions -->|"requests auctions"| node_gateway
node_web -->|"uses sessions"| node_nextauth
node_session -->|"reads session"| node_nextauth
node_nextauth -->|"authenticates"| node_identity
node_gateway -->|"routes requests"| node_auction_api
node_gateway -->|"routes requests"| node_search_api
node_gateway -.->|"validates tokens"| node_identity
node_identity -->|"stores users"| node_identity_store
node_identity -->|"issues claims"| node_profile
node_auction_api -->|"reads and writes"| node_auction_store
node_auction_api -->|"publishes events"| node_broker
node_auction_api -->|"maps payloads"| node_auction_events
node_broker -->|"delivers events"| node_search_consumers
node_search_consumers -->|"updates model"| node_search_store
node_search_api -->|"queries model"| node_search_store
node_search_init -->|"requests sync"| node_sync_client
node_sync_client -->|"fetches updates"| node_auction_api
node_search_init -->|"initializes model"| node_search_store
node_broker -->|"delivers events"| node_auction_consumers
node_auction_consumers -->|"updates auction"| node_auction_store

click node_web "https://github.com/westamz/microservices/blob/main/frontend/web-app/app/page.tsx"
click node_listing "https://github.com/westamz/microservices/blob/main/frontend/web-app/app/auctions/Listings.tsx"
click node_listing_state "https://github.com/westamz/microservices/blob/main/frontend/web-app/hooks/userParamsStore.tsx"
click node_auction_actions "https://github.com/westamz/microservices/blob/main/frontend/web-app/app/actions/auctionActions.tsx"
click node_session "https://github.com/westamz/microservices/blob/main/frontend/web-app/app/session/page.tsx"
click node_nextauth "https://github.com/westamz/microservices/blob/main/frontend/web-app/auth.ts"
click node_gateway "https://github.com/westamz/microservices/blob/main/src/GatewayService/Program.cs"
click node_identity "https://github.com/westamz/microservices/blob/main/src/IdentityService/Program.cs"
click node_profile "https://github.com/westamz/microservices/blob/main/src/IdentityService/Services/CustomProfileService.cs"
click node_identity_store "https://github.com/westamz/microservices/blob/main/src/IdentityService/Data/ApplicationDbContext.cs"
click node_auction_api "https://github.com/westamz/microservices/blob/main/src/AuctionService/Controllers/AuctionController.cs"
click node_auction_store "https://github.com/westamz/microservices/blob/main/src/AuctionService/Data/AuctionDbContext.cs"
click node_auction_events "https://github.com/westamz/microservices/blob/main/src/Contracts/AuctionCreated.cs"
click node_auction_consumers "https://github.com/westamz/microservices/blob/main/src/AuctionService/Consumers/AuctionFinishedConsumer.cs"
click node_search_api "https://github.com/westamz/microservices/blob/main/src/SearchService/Controllers/SearchController.cs"
click node_search_store "https://github.com/westamz/microservices/blob/main/src/SearchService/Models/Item.cs"
click node_search_consumers "https://github.com/westamz/microservices/blob/main/src/SearchService/Consumers/AuctionCreatedConsumer.cs"
click node_sync_client "https://github.com/westamz/microservices/blob/main/src/SearchService/Services/AuctionSvcHttpClient.cs"
click node_search_init "https://github.com/westamz/microservices/blob/main/src/SearchService/Data/DbInitializer.cs"

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_web,node_listing,node_listing_state,node_auction_actions,node_session,node_nextauth,node_browser toneBlue
class node_gateway,node_identity,node_profile,node_identity_store toneAmber
class node_auction_api,node_auction_store,node_auction_events,node_auction_consumers toneMint
class node_search_api,node_search_store,node_search_consumers,node_sync_client,node_search_init toneRose
class node_broker toneIndigo
```

## Components

### Web client

- [Next.js client](https://github.com/westamz/microservices/blob/main/frontend/web-app/app/page.tsx): `frontend/web-app/app/page.tsx`
- [Listings and filters](https://github.com/westamz/microservices/blob/main/frontend/web-app/app/auctions/Listings.tsx): `frontend/web-app/app/auctions/Listings.tsx`
- [Listing parameters](https://github.com/westamz/microservices/blob/main/frontend/web-app/hooks/userParamsStore.tsx): `frontend/web-app/hooks/userParamsStore.tsx`
- [Auction actions](https://github.com/westamz/microservices/blob/main/frontend/web-app/app/actions/auctionActions.tsx): `frontend/web-app/app/actions/auctionActions.tsx`
- [Session dashboard](https://github.com/westamz/microservices/blob/main/frontend/web-app/app/session/page.tsx): `frontend/web-app/app/session/page.tsx`
- [NextAuth integration](https://github.com/westamz/microservices/blob/main/frontend/web-app/auth.ts): `frontend/web-app/auth.ts`

### Gateway and identity

- [HTTP gateway](https://github.com/westamz/microservices/blob/main/src/GatewayService/Program.cs): `src/GatewayService/Program.cs`
- [Identity and tokens](https://github.com/westamz/microservices/blob/main/src/IdentityService/Program.cs): `src/IdentityService/Program.cs`
- [Token profile claims](https://github.com/westamz/microservices/blob/main/src/IdentityService/Services/CustomProfileService.cs): `src/IdentityService/Services/CustomProfileService.cs`
- [Identity database](https://github.com/westamz/microservices/blob/main/src/IdentityService/Data/ApplicationDbContext.cs): `src/IdentityService/Data/ApplicationDbContext.cs`

### Auction domain

- [Auction API](https://github.com/westamz/microservices/blob/main/src/AuctionService/Controllers/AuctionController.cs): `src/AuctionService/Controllers/AuctionController.cs`
- [Auction database](https://github.com/westamz/microservices/blob/main/src/AuctionService/Data/AuctionDbContext.cs): `src/AuctionService/Data/AuctionDbContext.cs`
- [Auction event contracts](https://github.com/westamz/microservices/blob/main/src/Contracts/AuctionCreated.cs): `src/Contracts/AuctionCreated.cs`
- [Auction event consumers](https://github.com/westamz/microservices/blob/main/src/AuctionService/Consumers/AuctionFinishedConsumer.cs): `src/AuctionService/Consumers/AuctionFinishedConsumer.cs`

### Search read model

- [Search API](https://github.com/westamz/microservices/blob/main/src/SearchService/Controllers/SearchController.cs): `src/SearchService/Controllers/SearchController.cs`
- [MongoDB search model](https://github.com/westamz/microservices/blob/main/src/SearchService/Models/Item.cs): `src/SearchService/Models/Item.cs`
- [Search event consumers](https://github.com/westamz/microservices/blob/main/src/SearchService/Consumers/AuctionCreatedConsumer.cs): `src/SearchService/Consumers/AuctionCreatedConsumer.cs`
- [Auction sync client](https://github.com/westamz/microservices/blob/main/src/SearchService/Services/AuctionSvcHttpClient.cs): `src/SearchService/Services/AuctionSvcHttpClient.cs`
- [Read-model initialization](https://github.com/westamz/microservices/blob/main/src/SearchService/Data/DbInitializer.cs): `src/SearchService/Data/DbInitializer.cs`

### Other components

- **Browser user**
- **RabbitMQ**

## Connections

- Browser user → Next.js client: uses (evidence: `README.md`)
- Next.js client → Listings and filters: renders (evidence: `README.md`)
- Listings and filters → Listing parameters: stores filters
- Listings and filters → HTTP gateway: requests search (evidence: `README.md`)
- Auction actions → HTTP gateway: requests auctions (evidence: `README.md`)
- Next.js client → NextAuth integration: uses sessions (evidence: `README.md`)
- Session dashboard → NextAuth integration: reads session (evidence: `frontend/web-app/app/session/page.tsx`)
- NextAuth integration → Identity and tokens: authenticates (evidence: `README.md`)
- HTTP gateway → Auction API: routes requests (evidence: `README.md`)
- HTTP gateway → Search API: routes requests (evidence: `README.md`)
- HTTP gateway → Identity and tokens: validates tokens (evidence: `README.md`)
- Identity and tokens → Identity database: stores users (evidence: `README.md`)
- Identity and tokens → Token profile claims: issues claims (evidence: `src/IdentityService/Services/CustomProfileService.cs`)
- Auction API → Auction database: reads and writes (evidence: `src/AuctionService/Controllers/AuctionController.cs`)
- Auction API → RabbitMQ: publishes events (evidence: `README.md`)
- Auction API → Auction event contracts: maps payloads (evidence: `src/AuctionService/Controllers/AuctionController.cs`)
- RabbitMQ → Search event consumers: delivers events (evidence: `README.md`)
- Search event consumers → MongoDB search model: updates model (evidence: `README.md`)
- Search API → MongoDB search model: queries model (evidence: `src/SearchService/Controllers/SearchController.cs`)
- Read-model initialization → Auction sync client: requests sync
- Auction sync client → Auction API: fetches updates (evidence: `src/SearchService/Services/AuctionSvcHttpClient.cs`)
- Read-model initialization → MongoDB search model: initializes model (evidence: `README.md`)
- RabbitMQ → Auction event consumers: delivers events (evidence: `README.md`)
- Auction event consumers → Auction database: updates auction (evidence: `src/AuctionService/Consumers/AuctionFinishedConsumer.cs`)
