This project is a RESTful API built with ASP.NET Core, following Clean Architecture principles. It provides authentication, role-based access control, and user profile management, leveraging Redis for refresh token storage.
- Authentication & Authorization: Implements JWT-based authentication with refresh token support.
- Role-Based Access Control: Manages user permissions based on roles.
- User Management: Allows user registration, profile updates, and password management.
- Redis Integration: Stores refresh tokens in Redis for enhanced performance.
- MediatR Integration: Implements CQRS pattern for better separation of concerns.
- ASP.NET Core
- Entity Framework Core
- Redis
- MediatR
- Docker
- MySQL
- Swagger
├── API (Presentation Layer)
├── Application (Business Logic Layer)
├── Infrastructure (Data & External Services Layer)
├── Domain (Entities & Core Business Logic)
- .NET 8 SDK
- Docker
- Clone the repository:
git clone https://github.com/william-le1004/dtp-backend.git cd dtp-backend
- Set up environment variables for local development:
- In the
API
project, right-click. - Choose Tools.
- Select .NET User Secrets.
- In the
- Create a
.env
file in the same folder asdtp-backend.sln
. - Start the API:
dotnet run --project API
- Open Swagger at
http://localhost:5000/swagger
.
To run the API with Redis and MySQL:
docker-compose up -d
Method | Endpoint | Description |
---|---|---|
POST |
/api/authentication/register |
User registration |
POST |
/api/authentication/login |
User login |
POST |
/api/authentication/refresh |
Refresh access token |
POST |
/api/authentication/logout |
User logout |
Method | Endpoint | Description |
---|---|---|
GET |
/api/users/profile |
Get user profile |
PUT |
/api/users/profile |
Update user profile |
- Fork the repository.
- Create a feature branch:
git checkout -b feature-branch
- Commit your changes:
git commit -m "Add new feature"
- Push to the branch:
git push origin feature-branch
- Open a Pull Request.
This project is licensed under the MIT License.
For questions or support, contact: