Skip to content

rushikesh-jagdale/user-management-api

Repository files navigation

.NET Architecture Auth Status

🌐 Live API

πŸ”— Base URL: https://user-management-api-dsp6.onrender.com

πŸ“˜ Swagger UI: https://user-management-api-dsp6.onrender.com/swagger

πŸš€ User Management & Authentication System

A production-ready ASP.NET Core Web API for managing users, roles, authentication, and permissions using Clean Architecture and JWT-based security.


πŸ“Œ Project Overview

This project is a multi-tenant User Management System designed with industry best practices:

  • πŸ”’ Secure authentication using JWT
  • πŸ›‘οΈ Role-based and permission-based authorization
  • πŸ—οΈ Clean Architecture (Domain, Application, Infrastructure, API)
  • πŸ’Ύ Entity Framework Core with SQL Server
  • ♻️ Soft Delete with Audit Logging
  • ⚑ Rate Limiting + Global Exception Handling
  • πŸ“„ Swagger API documentation

✨ Features

πŸ” Authentication & Security

  • JWT Access Token & Refresh Token
  • Secure password hashing
  • Token validation with custom claims

πŸ‘₯ User Management

  • Create, update, delete users
  • Multi-tenant support
  • Pagination support

βš–οΈ Authorization

  • Role-based access (Admin, User)
  • Permission-based policies
  • Custom authorization handlers

πŸ—‘οΈ Soft Delete & Audit

  • Users are not deleted permanently
  • IsDeleted, DeletedAt, DeletedBy
  • Global query filters (auto exclude deleted data)

βš™οΈ System Features

  • Rate limiting (API protection)
  • Global exception middleware
  • Logging with Serilog
  • Health check endpoint

πŸ—οΈ Architecture

This project follows Clean Architecture with clear separation of concerns:

User Management System
β”‚
β”œβ”€β”€ 🟦 UserManagement.Api
β”‚   └── Controllers, Middleware, Swagger
β”‚
β”œβ”€β”€ 🟩 UserManagement.Application
β”‚   └── Business Logic (CQRS, MediatR, Validators)
β”‚
β”œβ”€β”€ 🟨 UserManagement.Domain
β”‚   └── Entities, Enums, Interfaces
β”‚
└── πŸŸ₯ UserManagement.Infrastructure
    └── EF Core, Repositories, Security, Persistence

πŸ” Request Flow

Client β†’ API β†’ Application β†’ Domain β†’ Infrastructure β†’ Database


πŸ“Š Architecture Diagram

graph TD
    A[Client] --> B[API Layer]
    B --> C[Application Layer]
    C --> D[Domain Layer]
    C --> E[Infrastructure Layer]
    E --> F[(Database)]
Loading

πŸ’» Tech Stack

  • Backend: ASP.NET Core Web API (.NET 8)
  • Database: SQL Server
  • ORM: Entity Framework Core
  • Authentication: JWT
  • Architecture: Clean Architecture + CQRS

Libraries:

  • MediatR
  • FluentValidation
  • Serilog
  • ASP.NET Rate Limiting

πŸš€ How to Run

1. Clone Repository

git clone https://github.com/rushikesh-jagdale/user-management-api.git

2. Update Database Connection

{
  "ConnectionStrings": {
    "DefaultConnection": "your-sql-server-connection"
  }
}

3. Run Migration

dotnet ef database update

4. Run Project

dotnet run

5. Open Swagger

http://localhost:xxxx/swagger

πŸ”‘ Default Admin Credentials


πŸ”— API Endpoints

πŸ” Auth

  • POST /api/auth/register
  • POST /api/auth/login
  • POST /api/auth/refresh
  • POST /api/auth/logout

πŸ‘€ Users

  • GET /api/users
  • GET /api/users/{id}
  • POST /api/users
  • PUT /api/users/{id}
  • DELETE /api/users/{id} (Soft Delete)

πŸ“Έ Screenshots

πŸ”Ή API Preview

Swagger UI Login API
Users API Database

⭐ Key Highlights

βœ”οΈ Implemented Clean Architecture + CQRS pattern
βœ”οΈ Designed multi-tenant system with tenant isolation
βœ”οΈ Built JWT Authentication with Refresh Token mechanism
βœ”οΈ Implemented role-based & permission-based authorization
βœ”οΈ Created custom authorization policies & handlers
βœ”οΈ Added soft delete with global query filters (EF Core)
βœ”οΈ Integrated rate limiting for API protection
βœ”οΈ Implemented global exception handling middleware
βœ”οΈ Added structured logging using Serilog
βœ”οΈ Built production-ready scalable backend structure


πŸ“ˆ Future Improvements

  • Add Audit Log Table (history tracking)
  • Add Restore (Undo delete)
  • Docker support
  • CI/CD pipeline
  • Deployment on Azure / AWS

πŸ‘¨β€πŸ’» Author

Rushikesh Jagdale


🌟 If you like this project

Give it a ⭐ on GitHub!

About

Production-ready ASP.NET Core Web API with Clean Architecture, JWT Authentication, Role & Permission-based Authorization, and Multi-Tenant support.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors