Create your own custom front-end or explore a complete blog API.
Live demo : https://blogcore.fly.dev/swagger
- Advanced search by combining criteria (filters) on all resources
- Advanced user permissions management by creating roles and permissions for users via the API at runtime (combination of Permission-Based Authorization & Resource-based Authorization)
- ex: create a role "mini-moderator" with the permissions CanEdit own Posts, CanDelete All Comments, etc.
- Default role(s) given to new users can also be defined via the API.
- Complete community features (create comments on a post, like a comment or a post, add a comment on a comment, consult profiles, etc.)
- Configurable log system that logs all user actions / events (implementation of Serilog library, can be connected to Kibana, Seq and other solutions, for monitoring)
- CRUD is provided on all resources. Everything can be manipulated via endpoints, giving the possibility out-of-the-box to develop an admin interface or a mobile app. (current Swagger interface can act as an administrator interface)
- Pagination strategy has been implemented.
- OAuth2.0 standard (access / refresh token) has been implemented for authorization.
- Email SMTP configuration : Email confirmation & password reset are provided by sending emails (can use Gmail SMTP server for example)
- Good code coverage
- The Project was developed by relying on guidelines from DDD (Domain Driven Design) and Clean Code Book by Robert C. Martin.
- SonarCloud used to ensure code quality
- Implementation of End-to-End Testing to ensure the functioning of Blog Core API endpoints.
- Utilization of Resharper and SonarLint during the development process to enhance code quality and consistency.
- The project follows Conventional Commits and Git Feature Workflow with Develop Branch, ensuring a clean and organized git history with meaningful and clear commit messages.
- Code Quality is one of the main focuses on this project
Compatible with Linux / Windows / MacOS and can be deployed with SQL Server or PostgreSQL database.
Docker is also available (Dockerfile at the root of the project).
- .NET 8
- EntityFramework
- Microsoft Dependency Injection (DI)
- FluentValidation
- Serilog
- Swashbuckle (Swagger)
- xUnit
- Moq
- AutoMapper
- Install Microsoft SQL Server or PostgreSQL
- Visual Studio (or Rider with Entity Framework Core UI Plugin)
- Open
appsettings.json
file inside BlogCoreAPI project and edit the database settings :
For Microsoft SQL Server :
"DatabaseProvider": "MsSQL",
"ConnectionStrings": {
"Default": "Server=.;Database=BlogCore;Integrated Security=True;TrustServerCertificate=True;"
}
For PostgreSQL :
"DatabaseProvider": "PostgreSQL",
"ConnectionStrings": {
"Default": "Host=localhost;Port=5432;Database=BlogCore;Username=postgres;Password=[YourPassword];"
}
Then in visual studio :
- Set BlogCoreApi as project to run
- Open the Package Manager Console (Tools -> Nuget Package Manager -> Package Manager Console).
- In the package Manager Console, select DBAccess as Default project
- Run the following commands:
- Microsoft SQL Server
Add-Migration CreateInitialDatabase -Context MsSqlDbContext
Update-Database -Context MsSqlDbContext
- PostgreSQL
Add-Migration CreateInitialDatabase -Context PostgreSqlDbContext
Update-Database -Context PostgreSqlDbContext
- Now press F5 and run the application.
- Refresh the page. The API was busy filling the default data in the database. Now it can respond.
Default users are :
User | Password | Role(s) |
---|---|---|
Sam | 0a1234A@ | User |
Frodon | 0a0000A@ | User |
Jamy | 0JamyRedactA@ | User, Redactor |
Fred | 0FredRedactA@ | User, Redactor |
AdminUser | 0adminPasswordA@ | User, Admin |
Roles and permissions can be created / configured by API endpoints.
The default configuration is :
User :
CanRead | CanCreate | CanUpdate | CanDelete | |
---|---|---|---|---|
Category | All | |||
Comment | All | Own | Own | Own |
Like | All | Own | Own | Own |
Post | All | |||
Tag | All | |||
User | All | X | X | X |
Role | All | |||
Permission | All | X | ||
Account | Own | Own | Own |
Redactor :
CanRead | CanCreate | CanUpdate | CanDelete | |
---|---|---|---|---|
Category | All | |||
Comment | ||||
Like | ||||
Post | Own | Own | Own | |
Tag | All | |||
User | X | X | X | |
Role | ||||
Permission | X | |||
Account |
Admin :
CanRead | CanCreate | CanUpdate | CanDelete | |
---|---|---|---|---|
Category | All | All | All | All |
Comment | All | All | All | All |
Like | All | All | All | All |
Post | All | All | All | All |
Tag | All | All | All | All |
User | All | X | X | X |
Role | All | All | All | All |
Permission | All | All | X | All |
Account | All | All | All | All |
A wiki for this project is available on github : link
The wiki give more explanations about configuration, online deployment (render, heroku) and architecture of the project.