Microservices tabanlı envanter ve stok yönetim sistemi. .NET 9 ile geliştirilmiş, FIFO (First In, First Out) stok takibi yapan bir çözüm.
┌──────────────────┐
│ GATEWAY │
│ (YARP Proxy) │
└────────┬─────────┘
│
┌─────────────────────────┼─────────────────────────┐
│ │ │
▼ ▼ ▼
┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐
│ PROCUREMENT │ │ INVENTORY │ │ SALES │
│ Port: 7034 │ │ Port: 7198 │ │ Port: 7029 │
│ │ │ │ │ │
│ • Tedarikçiler │ │ • Stok Lotları │ │ • Satış Sipariş │
│ • Ürünler │ │ • FIFO Takip │ │ │
│ • Mal Kabul │ │ │ │ │
└────────┬─────────┘ └────────▲─────────┘ └────────┬─────────┘
│ │ │
│ RabbitMQ │ RabbitMQ │
└──────────────────────▶ │ ◀───────────────────────┘
StockArrivedEvent OrderCreatedEvent
Tedarikçi ve ürün yönetimi, mal kabul işlemleri.
Entities:
Supplier- Tedarikçi bilgileri (ad, vergi no, email)Product- Ürün bilgileri (ad, SKU, barkod)InboundOrder- Mal kabul siparişi (beyanname no, tarih, kalemler)
API Endpoints:
POST /api/supplier- Yeni tedarikçi oluşturGET /api/product- Tüm ürünleri listelePOST /api/product- Yeni ürün oluşturPOST /api/orders- Mal kabul siparişi oluştur (stok girişi tetikler)
FIFO bazlı stok lot takibi. Sadece event consumer olarak çalışır.
Entity:
InventoryLot- Stok partisi (ürün ID, beyanname no, maliyet, miktar)
Consumers:
StockArrivedConsumer- Mal kabul eventi geldiğinde stok lotu oluştururOrderCreatedConsumer- Satış eventi geldiğinde FIFO ile stok düşer
Satış sipariş yönetimi.
Entities:
SalesOrder- Satış siparişi (müşteri adı, tarih)SalesOrderItem- Sipariş kalemi (ürün, miktar, fiyat)
API Endpoint:
POST /api/sales- Yeni satış oluştur (stok düşümü tetikler)
YARP tabanlı reverse proxy. Tüm servisleri tek endpoint üzerinden sunar.
- .NET 9 SDK (Gateway için .NET 10)
- Docker & Docker Compose
- MySQL 8.0
- RabbitMQ 3.x
# MySQL, RabbitMQ ve phpMyAdmin'i başlat
docker-compose up -dErişim Bilgileri:
| Servis | URL | Kullanıcı/Şifre |
|---|---|---|
| MySQL | localhost:3306 | root / e1e2e3e4 |
| RabbitMQ | localhost:15672 | guest / guest |
| phpMyAdmin | localhost:8080 | root / root |
Her servisi ayrı terminal penceresinde çalıştırın:
# Procurement Service
dotnet run --project src/Services/Procurement/InventoryFlow.Procurement.Api.csproj
# Inventory Service
dotnet run --project src/Services/Inventory/InventoryFlow.Inventory.Api.csproj
# Sales Service
dotnet run --project src/Services/Sales/InventoryFlow.Sales.Api.csproj
# Gateway
dotnet run --project src/Gateways/InventoryFlow.Gateway/InventoryFlow.Gateway.csproj# Tedarikçi oluştur
curl -X POST https://localhost:7034/api/supplier \
-H "Content-Type: application/json" \
-d '{"name": "ABC Tedarik", "taxNumber": "1234567890", "contactEmail": "info@abc.com"}'
# Ürün oluştur
curl -X POST https://localhost:7034/api/product \
-H "Content-Type: application/json" \
-d '{"name": "Laptop", "sku": "LPT-001", "barcode": "8690000000001", "description": "Gaming Laptop"}'curl -X POST https://localhost:7034/api/orders \
-H "Content-Type: application/json" \
-d '{
"supplierId": "<supplier-guid>",
"declarationNumber": "TR-2024-001",
"declarationDate": "2024-01-15",
"items": [
{"productId": "<product-guid>", "quantity": 100, "unitCost": 15000}
]
}'Bu işlem:
InboundOrderkaydı oluştururIStockArrivedEventpublish eder- Inventory servisi eventi alır ve
InventoryLotoluşturur
curl -X POST https://localhost:7029/api/sales \
-H "Content-Type: application/json" \
-d '{
"customerName": "Mehmet Yılmaz",
"items": [
{"productId": "<product-guid>", "quantity": 5, "unitPrice": 20000}
]
}'Bu işlem:
SalesOrderkaydı oluştururIOrderCreatedEventpublish eder- Inventory servisi FIFO ile stok düşer (en eski lottan başlar)
Her servis kendi veritabanını kullanır (Database per Service pattern):
| Servis | Veritabanı |
|---|---|
| Procurement | inventory_flow |
| Inventory | inventory_stock |
| Sales | inventory_sales |
Inventory servisi stokları "lot" bazında takip eder. Her lot:
- Hangi beyanname ile geldiğini (
DeclarationNumber) - Maliyet fiyatını (
CostPrice) - Orijinal ve kalan miktarı (
OriginalQuantity,RemainingQuantity)
Satış olduğunda:
- İlgili ürünün lotları
CreatedDate'e göre sıralanır (eskiden yeniye) - En eski lottan stok düşülür
- Lot tükenirse sonraki lota geçilir
InventoryFlow/
├── src/
│ ├── Gateways/
│ │ └── InventoryFlow.Gateway/ # YARP Reverse Proxy
│ ├── Services/
│ │ ├── Procurement/ # Satın alma servisi
│ │ │ ├── Controllers/
│ │ │ ├── Data/
│ │ │ ├── Entities/
│ │ │ ├── Features/ # CQRS Commands & Queries
│ │ │ │ ├── Orders/
│ │ │ │ ├── Products/
│ │ │ │ └── Suppliers/
│ │ │ └── Repositories/
│ │ ├── Inventory/ # Stok servisi
│ │ │ ├── Consumers/ # RabbitMQ event handlers
│ │ │ ├── Data/
│ │ │ └── Entities/
│ │ └── Sales/ # Satış servisi
│ │ ├── Controllers/
│ │ ├── Data/
│ │ ├── Entities/
│ │ └── Features/
│ └── Shared/
│ └── InventoryFlow.Shared/ # Paylaşılan event ve DTO'lar
├── docker-compose.yml
└── InventoryFlow.sln
| Kategori | Teknoloji |
|---|---|
| Framework | .NET 9 / .NET 10 |
| ORM | Entity Framework Core 9 |
| Database | MySQL 8.0 (Pomelo Provider) |
| Message Broker | RabbitMQ |
| Messaging Library | MassTransit |
| CQRS | MediatR |
| API Gateway | YARP |
| API Docs | Swagger (Swashbuckle) |
| Kuyruk | Publisher | Consumer | Event |
|---|---|---|---|
stock-arrived-queue |
Procurement | Inventory | IStockArrivedEvent |
stock-sales-queue |
Sales | Inventory | IOrderCreatedEvent |
Modern, responsive admin dashboard. src/client klasoründe bulunur.
| Kategori | Teknoloji |
|---|---|
| Build Tool | Vite |
| Framework | React 18 + TypeScript |
| State Management | Redux Toolkit + RTK Query |
| Styling | Tailwind CSS |
| UI Components | shadcn/ui + Radix UI |
| Charts | Recharts |
| Icons | Lucide React |
| Routing | React Router v6 |
- Dashboard: Gerçek zamanlı istatistikler, satış grafikleri, düşük stok uyarıları
- Ürünler: CRUD işlemleri, arama, silme onayı
- Tedarikçiler: CRUD işlemleri, sipariş sayısı takibi
- Mal Kabul: Çok kalemli sipariş oluşturma, tedarikçi seçimi
- Satışlar: Stok kontrollü satış, müşteri bilgileri
- Envanter: Stok seviyeleri, FIFO lot takibi
- Tema: Light/Dark mode desteği
- Bildirimler: Toast mesajları, silme onay dialogları
cd src/client
# Bağımlılıkları yükle
npm install
# Geliştirme sunucusunu başlat (Port 3000)
npm run dev
# Production build
npm run buildsrc/client/
├── src/
│ ├── app/
│ │ ├── store.ts # Redux store
│ │ ├── baseApi.ts # RTK Query config
│ │ └── hooks.ts # Typed hooks
│ ├── components/
│ │ ├── ui/ # shadcn components
│ │ └── layout/ # Sidebar, Header, Layout
│ ├── features/
│ │ ├── auth/ # Login, Register
│ │ ├── products/ # Products API
│ │ ├── suppliers/ # Suppliers API
│ │ ├── orders/ # Orders API
│ │ ├── sales/ # Sales API
│ │ ├── inventory/ # Inventory API
│ │ └── dashboard/ # Dashboard API
│ ├── pages/ # Route pages
│ ├── hooks/ # Custom hooks
│ ├── types/ # TypeScript types
│ └── lib/ # Utilities
├── vite.config.ts
└── package.json
Frontend, Gateway üzerinden backend servislerine erişir:
// vite.config.ts
server: {
port: 3000,
proxy: {
'/api': {
target: 'https://localhost:5000',
changeOrigin: true,
secure: false,
},
},
}| Frontend Path | Gateway Route | Backend Service |
|---|---|---|
/api/auth/* |
auth-cluster | Auth (7100) |
/api/products/* |
procurement-cluster | Procurement (7034) |
/api/suppliers/* |
procurement-cluster | Procurement (7034) |
/api/orders/* |
procurement-cluster | Procurement (7034) |
/api/sales/* |
sales-cluster | Sales (7029) |
/api/inventory/* |
inventory-cluster | Inventory (7198) |
docker-compose up -d# Auth Service (Port 7100)
dotnet run --project src/Services/Auth/InventoryFlow.Auth.Api
# Procurement Service (Port 7034)
dotnet run --project src/Services/Procurement
# Sales Service (Port 7029)
dotnet run --project src/Services/Sales
# Inventory Service (Port 7198)
dotnet run --project src/Services/Inventory
# Gateway (Port 5000)
dotnet run --project src/Gateways/InventoryFlow.Gatewaycd src/client && npm run devTarayıcıda http://localhost:3000 adresini açın.
MIT License