8000 GitHub - ThecoderPinar/CoreXCrudAPI at 6d0d54ce7bba60491c3aa25212b6b3b4a91124d8
[go: up one dir, main page]

Skip to content

CoreXCrud API Projesi, modern yazılım geliştirme tekniklerini kullanarak, kullanıcı yönetimi, ürün yönetimi ve sipariş yönetimi gibi işlevleri sunan bir API projesidir. Projede .NET Core, Entity Framework Core, AutoMapper, FluentValidation, AspNetCoreRateLimit ve JWT Authentication gibi teknolojiler kullanılmıştır.

License

Notifications You must be signed in to change notification settings

ThecoderPinar/CoreXCrudAPI

Repository files navigation

CoreXCrud Projesi - Kapsamlı API Geliştirme

📌 Proje Açıklaması

CoreXCrud, modern, ölçeklenebilir ve güvenli bir ASP.NET Core Web API uygulamasıdır. CRUD işlemleri, JWT Authentication, Yetkilendirme, Rate Limiting, Serilog Loglama, Unit of Work & Repository Pattern, FluentValidation, AutoMapper, Mikroservis Mimarisine Uygun Yapı gibi modern yazılım geliştirme standartlarını içeren kapsamlı bir API geliştirme projesidir.

Bu proje, kurumsal seviyede API geliştirme süreçlerini kapsayan en iyi uygulamaları (best practices) içermektedir. Unit Testler ve Entegrasyon Testleri gibi birçok ileri düzey özellik içermektedir.


🚀 Öne Çıkan Özellikler

  • .NET 8 Web API kullanılarak geliştirilmiştir.
  • JWT Authentication ve Role-based Authorization desteği.
  • AutoMapper ile DTO kullanımı.
  • FluentValidation ile model doğrulama.
  • Serilog ile detaylı loglama (Dosya ve Konsol Destekli).
  • AspNetCoreRateLimit ile Rate Limiting (İstek Sınırlandırma).
  • Unit of Work & Repository Pattern ile veri yönetimi.
  • Mikroservis mimarisine uygun ölçeklenebilir yapı.
  • Swagger UI ile Test Edilebilir API Geliştirme.
  • RabbitMQ ile Event-Driven Mimarisi.

📁 Proje Yapısı

CoreXCrudSolution/
│── CoreXCrud/                     # Ana API Projesi
│   │── Controllers/               <
8000
span class="pl-c"># API Controller dosyaları
│   │── Data/                      # Veritabanı bağlantısı ve DbContext
│   │── DTOs/                      # Veri transfer objeleri (DTO)
│   │── Models/                    # Entity modelleri
│   │── Repositories/              # Repository ve Unit of Work yapısı
│   │── Services/                  # İş mantığı için servis katmanı
│   │── Validators/                # FluentValidation ile model doğrulama
│   │── logs/                      # Serilog log dosyaları
│   │── appsettings.json           # Konfigürasyon ayarları
│── CoreXCrud.UI/                  # Opsiyonel MVC UI Projesi (İptal Edildi)
│── README.md                      # Proje dokümantasyonu

🎨 Mimari Diyagram

graph TD;
    Client(Kullanıcı) -->|İstek| API_Gateway
    API_Gateway -->|Doğrulama| Authentication_Service
    API_Gateway -->|İstek Yönlendirme| Products_Service
    API_Gateway -->|İstek Yönlendirme| Orders_Service
    API_Gateway -->|İstek Yönlendirme| Users_Service
    Authentication_Service -->|JWT Token| API_Gateway
    Products_Service -->|CRUD| Database
    Orders_Service -->|CRUD| Database
    Users_Service -->|CRUD| Database
    Database[(SQL Server, PostgreSQL, MongoDB)]

    subgraph Kullanıcı Yönetimi
        Users_Service
    end

    subgraph Ürün Yönetimi
        Products_Service --> Database[(Veritabanı)]
    end

    subgraph Sipariş Yönetimi
        Orders_Service --> Database[(Veritabanı)]
    end

    subgraph Kimlik Doğrulama
        Authentication_Service
    end

Loading

🗂 Veri Akışı Diyagramı

graph TD;
    User[End User] -->|Login| AuthService[Authentication Service]
    AuthService -->|Token Generation| Token[JWT Token]
    Token -->|Authorized Request| APIGateway[API Gateway]
    APIGateway -->|Routes to| ProductService[Product Service]
    APIGateway -->|Routes to| OrderService[Order Service]
    APIGateway -->|Routes to| UserService[User Service]
    ProductService -->|Fetches| ProductDB[(Product Database)]
    OrderService -->|Fetches| OrderDB[(Order Database)]
    UserService -->|Fetches| UserDB[(User Database)]

Loading

📂 Veritabanı Şema Diyagramı

graph TD;
    DB[(Database)] -->|Contains| UsersTable[Users Table]
    DB -->|Contains| ProductsTable[Products Table]
    DB -->|Contains| OrdersTable[Orders Table]
    DB -->|Contains| OrderDetailsTable[Order Details Table]
    UsersTable -->|Primary Key| UserId[User ID]
    ProductsTable -->|Primary Key| ProductId[Product ID]
    OrdersTable -->|Foreign Key| UserId[User ID]
    OrdersTable -->|Primary Key| OrderId[Order ID]
    OrderDetailsTable -->|Foreign Key| OrderId[Order ID]
    OrderDetailsTable -->|Foreign Key| ProductId[Product ID]
    OrderDetailsTable -->|Primary Key| OrderDetailId[Order Detail ID]

Loading

🔐 Kimlik Doğrulama Akışı

graph TD;
    Client -->|Login Request| AuthService
    AuthService -->|Validates Credentials| UserStore[(User Store)]
    AuthService -->|Returns| JWTToken[JWT Token]
    Client -->|Attaches JWT| APIRequest[API Request]
    APIRequest -->|Validated by| APIGateway
    APIGateway -->|Sends Request| BackendServices[Backend Services]

Loading

🏗️ Hizmet Tabanlı Mimarisi

graph TD;
    API_Gateway -->|Routes Requests| Auth_Service[Authentication Service]
    API_Gateway -->|Routes Requests| Product_Service[Product Service]
    API_Gateway -->|Routes Requests| Order_Service[Order Service]
    Auth_Service -->|Generates Tokens| Token_Storage[(Token Storage)]
    Product_Service -->|CRUD Operations| Product_Database[(Product Database)]
    Order_Service -->|CRUD Operations| Order_Database[(Order Database)]
    Product_Service -->|Validates Stock| Stock_Validation[(Stock Validation Service)]

Loading

🏗 Kurulum ve Çalıştırma

1️⃣ Gerekli Bağımlılıkları Yükleyin

Öncelikle gerekli NuGet paketlerini yüklemek için aşağıdaki komutu çalıştırın:

 dotnet restore

2️⃣ Veritabanını Güncelleyin

Migration ve veritabanı güncellemesini şu komutlarla yapabilirsiniz:

 dotnet ef migrations add InitialCreate
 dotnet ef database update

3️⃣ Uygulamayı Çalıştırın

Aşağıdaki komutla API’yi çalıştırabilirsiniz:

 dotnet run

Swagger UI’ye erişmek için:

https://localhost:7252/swagger


📊 API Modülleri ve Uç Noktalar

Not: /api/Auth/login haricindeki tüm uç noktalar JWT ile korunur. İsteklerinizde Authorization: Bearer {token} başlığını göndermeniz gerekir.

🧑‍💼 1️⃣ Kullanıcı Yönetimi (Users)

Kullanıcı yönetimi API'si, sistemdeki kullanıcıları yönetmek için kullanılır.

HTTP Metodu

Uç Nokta

Açıklama

GET

/api/Users

📌 Tüm kullanıcıları getir

POST

/api/Users

➕ Yeni kullanıcı oluştur

GET

/api/Users/{id}

🔍 Belirli bir kullanıcıyı getir

PUT

/api/Users/{id}

✏️ Kullanıcıyı güncelle

DELETE

/api/Users/{id}

❌ Kullanıcıyı sil


📦 2️⃣ Ürün Yönetimi (Products)

Ürün yönetimi API'si, sistemdeki ürünleri yönetmek için kullanılır.

HTTP Metodu

Uç Nokta

Açıklama

GET

/api/Products

📌 Tüm ürünleri getir

POST

/api/Products

➕ Yeni ürün ekle

GET

/api/Products/{id}

🔍 Belirli bir ürünü getir

PUT

/api/Products/{id}

✏️ Ürünü güncelle

DELETE

/api/Products/{id}

❌ Ürünü sil


🛒 3️⃣ Sipariş Yönetimi (Orders)