This project provides the backend API for the CodeStorm Educational Platform. It is developed based on Clean Architecture principles and designed using nArchitectureGen. The project offers a high-performance and scalable structure.
- Clean Architecture | - CQRS (Command Query Responsibility Segregation) |
- Advanced Repository Pattern | - Role-Based Access Control (Instructor, Student, Admin) |
- Dynamic Query | - Pagination |
- OTP (One-Time Password) | - Authentication with JWT |
- Logging with Serilog | - PDF Generation (Certificate) |
- Cloudinary Media Service | - Global Exception Handling |
- MsSQL | - Refresh Token and Token Renewal |
- Token Revocation | - Mail Service |
- Mediatr |
This project adopts Clean Architecture and CQRS (Command Query Responsibility Segregation) principles. This architectural structure ensures the project is modular, testable, and maintainable. Mediatr is used in the implementation of the CQRS pattern.
Developed inspired by Clean Architecture, nArchitecture is a monolithic project showcasing advanced development techniques. The project includes Clean Architecture, CQRS, Advanced Repository, Dynamic Querying, JWT, OTP, Google and Microsoft Authentication, Role-Based Management, Distributed Caching (Redis), Logging (Serilog), Elastic Search, Code Generator, and more.API Documentation You can use Swagger UI for all API endpoints and details used in the project.
Clean Architecture This project applies Clean Architecture principles to provide a modular, testable, and maintainable structure. It minimizes dependencies between layers and makes business logic independent of the UI, database, or other external dependencies.
CQRS separates commands (data modification operations) and queries (data reading operations). This improves performance optimization and better data integrity.
Authentication is performed using JWT (JSON Web Token). This offers a secure and stateless authentication method. The JWT Payload decode part is as shown in the image.We provide an extra layer of security by using one-time passwords to verify user identities.
Using Serilog, logs in the application are configured and recorded. This is very useful for debugging and monitoring the application. In the current demo, log records are stored as text files, and the infrastructure for MongoDB usage is available.Dynamic querying capabilities allow flexible and customizable queries according to the needs of the user or the application.
Global exception handling manages errors centrally by capturing them at a single point, regardless of where they occur in the application. This provides more consistent error messages and a better user experience.
Using refresh tokens, we extend user session durations, so users do not need to log in again. When a user logs out or in case of a security breach, the token is revoked, blocking access. RefreshToken is created as HttpOnly Cookie when the user logs in. HttpOnly type allows this cookie to be carried only with http requests.Token revocation allows users to manually end their sessions or block access in case of security breaches. This is an important feature that enhances application security.
In our project, we use the iTextSharp library to generate certificates when users complete their training. This library allows us to dynamically create and edit PDF files. It enables users to create documents like course completion certificates in PDF format. This provides users with a tangible indicator of achievement and enhances the platform's professionalism. We use the MailKit library and Gmail's SMTP server to send emails to users. This structure provides a reliable and flexible solution for performing actions such as email verification and password reset. Emails are sent for various operations (password reset, account verification, two-factor authentication), enhancing user experience and security. Mail bodies are stored as HTML files, and when a mail is sent, the appropriate link or one-time code field in the file is filled out and sent.If you want to contribute to this project, please follow the steps below:
- Fork the repository.
- Create a new branch: git checkout -b my-new-feature
- Commit your changes: git commit -am 'Add some feature'
- Push to the branch: git push origin my-new-feature
- Create a Pull Request.
If you have any questions or feedback about this project, please contact us here.