Bu proje, .NET 9 ile geliştirilmiş, modern mikroservis mimarisini kullanan bir ürün yönetim sistemidir. Clean Architecture, CQRS pattern, Event-Driven Architecture ve 12-Factor App prensipleri uygulanmıştır.
Proje, birbirinden bağımsız çalışabilen 3 ana mikroservisten oluşmaktadır:
- Auth Service (Port: 5001) - Kimlik doğrulama ve yetkilendirme
- Product Service (Port: 5002) - Ürün yönetimi ve CRUD işlemleri
- Log Service (Port: 5003) - Merkezi loglama sistemi
- RabbitMQ - Mikroservisler arası asenkron mesajlaşma
- MassTransit - .NET için event bus implementasyonu```# 🛠️ Teknoloji Stack
- .NET 9 - Modern C# framework
- ASP.NET Core Web API - RESTful API geliştirme
- Entity Framework Core - ORM ve database operations
- PostgreSQL - İlişkisel veritabanı
- Redis - In-memory caching
- RabbitMQ - Message broker
- MassTransit - Service bus abstraction
- AutoMapper - Object-to-object mapping
- FluentValidation - Input validation
- Serilog - Structured logging
- Swashbuckle - API documentation
- BCrypt.Net - Password hashing
src/
├── Services/
│ ├── Auth/
│ │ ├── Auth.API/ # Web API Controller'ları
│ │ ├── Auth.Application/ # Business Logic, CQRS
│ │ ├── Auth.Core/ # Domain Entities, Interfaces
│ │ └── Auth.Infrastructure/ # Data Access, External Services
│ ├── Product/
│ │ ├── Product.API/
│ │ ├── Product.Application/
│ │ ├── Product.Core/
│ │ └── Product.Infrastructure/
│ └── Log/
│ └── Log.API/ # Centralized Logging Service
├── Shared/
│ └── Shared/ # Common models, events, services
- .NET 9 SDK
- PostgreSQL
- Redis
- RabbitMQ
- Docker (opsiyonel)
# PostgreSQL connection string'i güncelle
# appsettings.json dosyalarında connection string'leri düzenle
# Migration'ları çalıştır
cd src/Services/Auth/Auth.Infrastructure
dotnet ef database update --startup-project ../Auth.API
cd src/Services/Product/Product.Infrastructure
dotnet ef database update --startup-project ../Product.API
# Redis
docker run -d --name redis -p 6379:6379 redis:alpine
# RabbitMQ
docker run -d --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3-management
# Terminal 1 - Auth Service
cd src/Services/Auth/Auth.API
dotnet run --urls="https://localhost:5001"
# Terminal 2 - Product Service
cd src/Services/Product/Product.API
dotnet run --urls="https://localhost:5002"
# Terminal 3 - Log Service
cd src/Services/Log/Log.API
dotnet run --urls="https://localhost:5003"
Auth Service (https://localhost:5001)
POST /api/v1/auth/register- Kullanıcı kaydıPOST /api/v1/auth/login- Kullanıcı girişiPOST /api/v1/auth/refresh- Token yenileme
Product Service (https://localhost:5002)
GET /api/v1/products- Tüm ürünlerGET /api/v1/products/{id}- Ürün detayıPOST /api/v1/products- Ürün oluştur (JWT gerekli)PUT /api/v1/products/{id}- Ürün güncelle (JWT gerekli)DELETE /api/v1/products/{id}- Ürün sil (JWT gerekli)GET /api/v1/products/my-products- Kullanıcının ürünleri
Log Service (https://localhost:5003)
GET /api/v1/log/test- Servis durumuPOST /api/v1/log/information- Info logPOST /api/v1/log/error- Error log
curl -X POST https://localhost:5001/api/v1/auth/register \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "TestPassword123!",
"firstName": "Test",
"lastName": "User"
}'
curl -X POST https://localhost:5001/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "TestPassword123!"
}'
curl -X POST https://localhost:5002/api/v1/products \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Test Ürün",
"description": "Test açıklaması",
"price": 99.99,
"stock": 10,
"category": 0
}'
- Auth Service: https://localhost:5001/swagger
- Product Service: https://localhost:5002/swagger
- Log Service: https://localhost:5003/swagger
- URL: http://localhost:15672
- Username: guest / Password: guest
- Domain Layer - Business entities ve kurallar
- Application Layer - Use cases ve business logic
- Infrastructure Layer - External concerns (DB, cache, messaging)
- API Layer - Controllers ve HTTP concerns
- Commands - Veri değiştiren işlemler
- Queries - Veri okuma işlemleri
- Handlers - Business logic implementation
- Domain Events - Business olayları
- Event Handlers - Olay işleyicileri
- Message Bus - Mikroservisler arası iletişim
- JWT Authentication - Stateless token-based auth
- Password Hashing - BCrypt ile güvenli şifre saklama
- CORS - Cross-origin request handling
- Input Validation - FluentValidation ile comprehensive```lidation
- Redis - Distributed caching
- Cache Invalidation - Smart cache management
- Query Optimization - EF Core best practices
- Stateless Services - Horizontal scaling ready
- Database Indexing - Optimized queries
- Async Processing - Non-blocking operations